Skip to content

Commit

Permalink
fix: S2 examples Popover and add CustomDialog (#7459)
Browse files Browse the repository at this point in the history
* fix: using Popover and s2-parcel example has meta veiwport defined

* adding CustomDialog example

* vw not vh
  • Loading branch information
ktabors authored Dec 4, 2024
1 parent e14088a commit 5757c3a
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/s2-parcel-example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function App() {
})}
>
<Section title="Buttons">
<ButtonGroup>
<ButtonGroup align="center" styles={style({maxWidth: '[100vw]'})}>
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<ActionButton>
Expand Down
26 changes: 21 additions & 5 deletions examples/s2-parcel-example/src/Lazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ButtonGroup,
Checkbox,
CheckboxGroup,
CloseButton,
ColorArea,
ColorField,
ColorSlider,
Expand All @@ -23,6 +24,7 @@ import {
ComboBoxItem,
Content,
ContextualHelp,
CustomDialog,
Dialog,
DialogContainer,
DialogTrigger,
Expand All @@ -44,6 +46,7 @@ import {
NumberField,
Picker,
PickerItem,
Popover,
ProgressBar,
ProgressCircle,
Radio,
Expand All @@ -67,6 +70,7 @@ import {
Tooltip,
TooltipTrigger,
} from "@react-spectrum/s2";
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
import Edit from "@react-spectrum/s2/icons/Edit";
Expand Down Expand Up @@ -247,15 +251,27 @@ export default function Lazy() {
</Dialog>
</DialogTrigger>

<DialogTrigger type="popover">
<DialogTrigger>
<ActionButton>Illustration</ActionButton>
<CustomDialog size="M">
<div className={style({display: 'flex', flexDirection: 'column', rowGap: 8, alignItems: 'center'})}>
<Checkmark />
<Heading slot="title" styles={style({font: 'heading-lg', textAlign: 'center', marginY: 0})}>Thank you!</Heading>
<p className={style({font: 'body', textAlign: 'center', marginY: 0})}>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<CloseButton styles={style({position: 'absolute', top: 12, insetEnd: 12})} />
</div>
</CustomDialog>
</DialogTrigger>

<DialogTrigger>
<ActionButton>Disk Status</ActionButton>
<Dialog>
<Heading>C://</Heading>
<Popover>
<Heading styles={style({font: 'heading', marginTop: 0, marginBottom: 20})}>C://</Heading>

<Content>
<Content styles={style({font: 'ui'})}>
<Text>50% disk space remaining.</Text>
</Content>
</Dialog>
</Popover>
</DialogTrigger>

<TooltipTrigger>
Expand Down
1 change: 1 addition & 0 deletions examples/s2-parcel-example/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Spectrum 2 + Parcel</title>
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion examples/s2-vite-project/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function App() {
})}
>
<Section title="Buttons">
<ButtonGroup>
<ButtonGroup align="center" styles={style({maxWidth: '[100vw]'})}>
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<ActionButton>
Expand Down
26 changes: 21 additions & 5 deletions examples/s2-vite-project/src/Lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ButtonGroup,
Checkbox,
CheckboxGroup,
CloseButton,
ColorArea,
ColorField,
ColorSlider,
Expand All @@ -23,6 +24,7 @@ import {
ComboBoxItem,
Content,
ContextualHelp,
CustomDialog,
Dialog,
DialogContainer,
DialogTrigger,
Expand All @@ -44,6 +46,7 @@ import {
NumberField,
Picker,
PickerItem,
Popover,
ProgressBar,
ProgressCircle,
Radio,
Expand All @@ -67,6 +70,7 @@ import {
Tooltip,
TooltipTrigger,
} from "@react-spectrum/s2";
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
import Edit from "@react-spectrum/s2/icons/Edit";
Expand Down Expand Up @@ -247,15 +251,27 @@ export default function Lazy() {
</Dialog>
</DialogTrigger>

<DialogTrigger type="popover">
<DialogTrigger>
<ActionButton>Illustration</ActionButton>
<CustomDialog size="M">
<div className={style({display: 'flex', flexDirection: 'column', rowGap: 8, alignItems: 'center'})}>
<Checkmark />
<Heading slot="title" styles={style({font: 'heading-lg', textAlign: 'center', marginY: 0})}>Thank you!</Heading>
<p className={style({font: 'body', textAlign: 'center', marginY: 0})}>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<CloseButton styles={style({position: 'absolute', top: 12, insetEnd: 12})} />
</div>
</CustomDialog>
</DialogTrigger>

<DialogTrigger>
<ActionButton>Disk Status</ActionButton>
<Dialog>
<Heading>C://</Heading>
<Popover>
<Heading styles={style({font: 'heading', marginTop: 0, marginBottom: 20})}>C://</Heading>

<Content>
<Content styles={style({font: 'ui'})}>
<Text>50% disk space remaining.</Text>
</Content>
</Dialog>
</Popover>
</DialogTrigger>

<TooltipTrigger>
Expand Down
2 changes: 1 addition & 1 deletion examples/s2-webpack-5-example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function App() {
})}
>
<Section title="Buttons">
<ButtonGroup>
<ButtonGroup align="center" styles={style({maxWidth: '[100vw]'})}>
<Button variant="primary">Primary</Button>
<Button variant="secondary">Secondary</Button>
<ActionButton>
Expand Down
26 changes: 21 additions & 5 deletions examples/s2-webpack-5-example/src/Lazy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ButtonGroup,
Checkbox,
CheckboxGroup,
CloseButton,
ColorArea,
ColorField,
ColorSlider,
Expand All @@ -23,6 +24,7 @@ import {
ComboBoxItem,
Content,
ContextualHelp,
CustomDialog,
Dialog,
DialogContainer,
DialogTrigger,
Expand All @@ -44,6 +46,7 @@ import {
NumberField,
Picker,
PickerItem,
Popover,
ProgressBar,
ProgressCircle,
Radio,
Expand All @@ -67,6 +70,7 @@ import {
Tooltip,
TooltipTrigger,
} from "@react-spectrum/s2";
import Checkmark from '@react-spectrum/s2/illustrations/gradient/generic1/Checkmark';
import Cloud from "@react-spectrum/s2/illustrations/linear/Cloud";
import DropToUpload from "@react-spectrum/s2/illustrations/linear/DropToUpload";
import Edit from "@react-spectrum/s2/icons/Edit";
Expand Down Expand Up @@ -247,15 +251,27 @@ export default function Lazy() {
</Dialog>
</DialogTrigger>

<DialogTrigger type="popover">
<DialogTrigger>
<ActionButton>Illustration</ActionButton>
<CustomDialog size="M">
<div className={style({display: 'flex', flexDirection: 'column', rowGap: 8, alignItems: 'center'})}>
<Checkmark />
<Heading slot="title" styles={style({font: 'heading-lg', textAlign: 'center', marginY: 0})}>Thank you!</Heading>
<p className={style({font: 'body', textAlign: 'center', marginY: 0})}>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<CloseButton styles={style({position: 'absolute', top: 12, insetEnd: 12})} />
</div>
</CustomDialog>
</DialogTrigger>

<DialogTrigger>
<ActionButton>Disk Status</ActionButton>
<Dialog>
<Heading>C://</Heading>
<Popover>
<Heading styles={style({font: 'heading', marginTop: 0, marginBottom: 20})}>C://</Heading>

<Content>
<Content styles={style({font: 'ui'})}>
<Text>50% disk space remaining.</Text>
</Content>
</Dialog>
</Popover>
</DialogTrigger>

<TooltipTrigger>
Expand Down

1 comment on commit 5757c3a

@rspbot
Copy link

@rspbot rspbot commented on 5757c3a Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.