-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PreviewCard] Create new component (#469)
- Loading branch information
Showing
75 changed files
with
3,287 additions
and
22 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
docs/data/base/components/preview-card/UnstyledPreviewCardIntroduction/system/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import * as React from 'react'; | ||
import * as PreviewCard from '@base_ui/react/PreviewCard'; | ||
import { styled } from '@mui/system'; | ||
|
||
export default function UnstyledPreviewCardIntroduction() { | ||
return ( | ||
<PreviewCard.Root> | ||
<TriggerLink href="#">@Base_UI</TriggerLink> | ||
<PreviewCard.Positioner sideOffset={8}> | ||
<PreviewCardPopup> | ||
<img | ||
src="https://pbs.twimg.com/profile_images/1798056009291997184/B-prVmUP_400x400.jpg" | ||
alt="Base UI Logo" | ||
width={80} | ||
height={80} | ||
style={{ borderRadius: '50%' }} | ||
/> | ||
<h2 style={{ fontSize: 20, margin: 0 }}>Base UI</h2> | ||
<p>Unstyled React components and hooks (@base_ui/react), by @MUI_hq.</p> | ||
<div style={{ display: 'flex', gap: 10 }}> | ||
<span> | ||
<strong>1</strong> Following | ||
</span> | ||
<span> | ||
<strong>1,000</strong> Followers | ||
</span> | ||
</div> | ||
<PreviewCardArrow /> | ||
</PreviewCardPopup> | ||
</PreviewCard.Positioner> | ||
</PreviewCard.Root> | ||
); | ||
} | ||
|
||
const blue = { | ||
400: '#3399FF', | ||
600: '#0072E6', | ||
800: '#004C99', | ||
}; | ||
|
||
export const PreviewCardPopup = styled(PreviewCard.Popup)` | ||
position: relative; | ||
background: white; | ||
color: black; | ||
border-radius: 10px; | ||
filter: drop-shadow(0 2px 4px rgb(0 10 20 / 0.25)); | ||
outline: 0; | ||
padding: 12px 16px; | ||
max-width: min(300px, var(--available-width)); | ||
`; | ||
|
||
export const TriggerLink = styled(PreviewCard.Trigger)` | ||
border: none; | ||
color: ${blue[600]}; | ||
font-size: 18px; | ||
text-decoration: none; | ||
&:hover { | ||
color: ${blue[800]}; | ||
} | ||
&:focus-visible { | ||
outline: 2px solid ${blue[400]}; | ||
outline-offset: 2px; | ||
} | ||
`; | ||
|
||
export const PreviewCardArrow = styled(PreviewCard.Arrow)` | ||
width: 10px; | ||
height: 10px; | ||
transform: rotate(45deg); | ||
background: white; | ||
z-index: -1; | ||
&[data-side='top'] { | ||
bottom: -5px; | ||
} | ||
&[data-side='right'] { | ||
left: -5px; | ||
} | ||
&[data-side='bottom'] { | ||
top: -5px; | ||
} | ||
&[data-side='left'] { | ||
right: -5px; | ||
} | ||
`; |
90 changes: 90 additions & 0 deletions
90
docs/data/base/components/preview-card/UnstyledPreviewCardIntroduction/system/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import * as React from 'react'; | ||
import * as PreviewCard from '@base_ui/react/PreviewCard'; | ||
import { styled } from '@mui/system'; | ||
|
||
export default function UnstyledPreviewCardIntroduction() { | ||
return ( | ||
<PreviewCard.Root> | ||
<TriggerLink href="#">@Base_UI</TriggerLink> | ||
<PreviewCard.Positioner sideOffset={8}> | ||
<PreviewCardPopup> | ||
<img | ||
src="https://pbs.twimg.com/profile_images/1798056009291997184/B-prVmUP_400x400.jpg" | ||
alt="Base UI Logo" | ||
width={80} | ||
height={80} | ||
style={{ borderRadius: '50%' }} | ||
/> | ||
<h2 style={{ fontSize: 20, margin: 0 }}>Base UI</h2> | ||
<p>Unstyled React components and hooks (@base_ui/react), by @MUI_hq.</p> | ||
<div style={{ display: 'flex', gap: 10 }}> | ||
<span> | ||
<strong>1</strong> Following | ||
</span> | ||
<span> | ||
<strong>1,000</strong> Followers | ||
</span> | ||
</div> | ||
<PreviewCardArrow /> | ||
</PreviewCardPopup> | ||
</PreviewCard.Positioner> | ||
</PreviewCard.Root> | ||
); | ||
} | ||
|
||
const blue = { | ||
400: '#3399FF', | ||
600: '#0072E6', | ||
800: '#004C99', | ||
}; | ||
|
||
export const PreviewCardPopup = styled(PreviewCard.Popup)` | ||
position: relative; | ||
background: white; | ||
color: black; | ||
border-radius: 10px; | ||
filter: drop-shadow(0 2px 4px rgb(0 10 20 / 0.25)); | ||
outline: 0; | ||
padding: 12px 16px; | ||
max-width: min(300px, var(--available-width)); | ||
`; | ||
|
||
export const TriggerLink = styled(PreviewCard.Trigger)` | ||
border: none; | ||
color: ${blue[600]}; | ||
font-size: 18px; | ||
text-decoration: none; | ||
&:hover { | ||
color: ${blue[800]}; | ||
} | ||
&:focus-visible { | ||
outline: 2px solid ${blue[400]}; | ||
outline-offset: 2px; | ||
} | ||
`; | ||
|
||
export const PreviewCardArrow = styled(PreviewCard.Arrow)` | ||
width: 10px; | ||
height: 10px; | ||
transform: rotate(45deg); | ||
background: white; | ||
z-index: -1; | ||
&[data-side='top'] { | ||
bottom: -5px; | ||
} | ||
&[data-side='right'] { | ||
left: -5px; | ||
} | ||
&[data-side='bottom'] { | ||
top: -5px; | ||
} | ||
&[data-side='left'] { | ||
right: -5px; | ||
} | ||
`; |
81 changes: 81 additions & 0 deletions
81
docs/data/base/components/preview-card/UnstyledPreviewCardTransition.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import * as React from 'react'; | ||
import * as PreviewCard from '@base_ui/react/PreviewCard'; | ||
import { styled } from '@mui/system'; | ||
|
||
export default function UnstyledPreviewCardTransition() { | ||
return ( | ||
<div style={{ display: 'flex', gap: 12 }}> | ||
<PreviewCard.Root> | ||
<TriggerLink href="#">Trigger</TriggerLink> | ||
<PreviewCard.Positioner sideOffset={5}> | ||
<PreviewCardPopup> | ||
<img | ||
src="https://pbs.twimg.com/profile_images/1798056009291997184/B-prVmUP_400x400.jpg" | ||
alt="Base UI Logo" | ||
width={80} | ||
height={80} | ||
style={{ borderRadius: '50%' }} | ||
/> | ||
<h2 style={{ fontSize: 20, margin: 0 }}>Base UI</h2> | ||
<p>Unstyled React components and hooks (@base_ui/react), by @MUI_hq.</p> | ||
<div style={{ display: 'flex', gap: 10 }}> | ||
<span> | ||
<strong>1</strong> Following | ||
</span> | ||
<span> | ||
<strong>1,000</strong> Followers | ||
</span> | ||
</div> | ||
</PreviewCardPopup> | ||
</PreviewCard.Positioner> | ||
</PreviewCard.Root> | ||
</div> | ||
); | ||
} | ||
|
||
const blue = { | ||
400: '#3399FF', | ||
600: '#0072E6', | ||
800: '#004C99', | ||
}; | ||
|
||
export const PreviewCardPopup = styled(PreviewCard.Popup)` | ||
position: relative; | ||
background: white; | ||
color: black; | ||
border-radius: 5px; | ||
filter: drop-shadow(0 0.1rem 0.25rem rgb(0 10 20 / 0.25)); | ||
outline: 0; | ||
padding: 12px 16px; | ||
max-width: min(300px, var(--available-width)); | ||
transition-property: opacity, transform; | ||
transition-duration: 0.2s; | ||
opacity: 0; | ||
transform-origin: var(--transform-origin); | ||
&[data-state='open'] { | ||
opacity: 1; | ||
transform: scale(1); | ||
} | ||
&[data-entering] { | ||
opacity: 0; | ||
transform: scale(0.95); | ||
} | ||
`; | ||
|
||
export const TriggerLink = styled(PreviewCard.Trigger)` | ||
border: none; | ||
color: ${blue[600]}; | ||
font-size: 18px; | ||
text-decoration: none; | ||
&:hover { | ||
color: ${blue[800]}; | ||
} | ||
&:focus-visible { | ||
outline: 2px solid ${blue[400]}; | ||
outline-offset: 2px; | ||
} | ||
`; |
81 changes: 81 additions & 0 deletions
81
docs/data/base/components/preview-card/UnstyledPreviewCardTransition.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import * as React from 'react'; | ||
import * as PreviewCard from '@base_ui/react/PreviewCard'; | ||
import { styled } from '@mui/system'; | ||
|
||
export default function UnstyledPreviewCardTransition() { | ||
return ( | ||
<div style={{ display: 'flex', gap: 12 }}> | ||
<PreviewCard.Root> | ||
<TriggerLink href="#">Trigger</TriggerLink> | ||
<PreviewCard.Positioner sideOffset={5}> | ||
<PreviewCardPopup> | ||
<img | ||
src="https://pbs.twimg.com/profile_images/1798056009291997184/B-prVmUP_400x400.jpg" | ||
alt="Base UI Logo" | ||
width={80} | ||
height={80} | ||
style={{ borderRadius: '50%' }} | ||
/> | ||
<h2 style={{ fontSize: 20, margin: 0 }}>Base UI</h2> | ||
<p>Unstyled React components and hooks (@base_ui/react), by @MUI_hq.</p> | ||
<div style={{ display: 'flex', gap: 10 }}> | ||
<span> | ||
<strong>1</strong> Following | ||
</span> | ||
<span> | ||
<strong>1,000</strong> Followers | ||
</span> | ||
</div> | ||
</PreviewCardPopup> | ||
</PreviewCard.Positioner> | ||
</PreviewCard.Root> | ||
</div> | ||
); | ||
} | ||
|
||
const blue = { | ||
400: '#3399FF', | ||
600: '#0072E6', | ||
800: '#004C99', | ||
}; | ||
|
||
export const PreviewCardPopup = styled(PreviewCard.Popup)` | ||
position: relative; | ||
background: white; | ||
color: black; | ||
border-radius: 5px; | ||
filter: drop-shadow(0 0.1rem 0.25rem rgb(0 10 20 / 0.25)); | ||
outline: 0; | ||
padding: 12px 16px; | ||
max-width: min(300px, var(--available-width)); | ||
transition-property: opacity, transform; | ||
transition-duration: 0.2s; | ||
opacity: 0; | ||
transform-origin: var(--transform-origin); | ||
&[data-state='open'] { | ||
opacity: 1; | ||
transform: scale(1); | ||
} | ||
&[data-entering] { | ||
opacity: 0; | ||
transform: scale(0.95); | ||
} | ||
`; | ||
|
||
export const TriggerLink = styled(PreviewCard.Trigger)` | ||
border: none; | ||
color: ${blue[600]}; | ||
font-size: 18px; | ||
text-decoration: none; | ||
&:hover { | ||
color: ${blue[800]}; | ||
} | ||
&:focus-visible { | ||
outline: 2px solid ${blue[400]}; | ||
outline-offset: 2px; | ||
} | ||
`; |
Oops, something went wrong.