-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(react-dialog): creates story for DialogActions (#30629)
- Loading branch information
1 parent
418e4cd
commit 068ebb4
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
packages/react-components/react-dialog/stories/Dialog/DialogActions.md
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,3 @@ | ||
Dialogs should be used for providing the user with quick prompt options where decisions should be made quickly. They should be used for actions that are not reversible, such as deleting an item. | ||
|
||
`DialogActions` should be used to provide the user with a set of actions to choose from. The actions should be clear and concise, and should be used to guide the user to the next step in the process. |
63 changes: 63 additions & 0 deletions
63
packages/react-components/react-dialog/stories/Dialog/DialogActions.stories.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,63 @@ | ||
import * as React from 'react'; | ||
import { | ||
Dialog, | ||
DialogTrigger, | ||
DialogSurface, | ||
DialogTitle, | ||
DialogContent, | ||
DialogBody, | ||
DialogActions, | ||
Button, | ||
Checkbox, | ||
CheckboxOnChangeData, | ||
} from '@fluentui/react-components'; | ||
import story from './DialogActions.md'; | ||
|
||
export const Actions = () => { | ||
const [checked, setChecked] = React.useState(false); | ||
const handleChange = (ev: React.ChangeEvent<HTMLInputElement>, data: CheckboxOnChangeData) => { | ||
setChecked(Boolean(data.checked)); | ||
}; | ||
return ( | ||
<Dialog modalType="non-modal"> | ||
<DialogTrigger disableButtonEnhancement> | ||
<Button>Open campaign dialog</Button> | ||
</DialogTrigger> | ||
<DialogSurface aria-describedby={undefined}> | ||
<DialogBody> | ||
<DialogTitle>Delete this campaign?</DialogTitle> | ||
<DialogContent> | ||
<p> | ||
You're about to delete the campaign group "Campaign name that goes up to two lines". This will also delete | ||
all associated campaign resources, including the overview page, files, publications, conversations, and so | ||
forth. Please back up any content you need before proceeding. | ||
</p> | ||
<Checkbox | ||
checked={checked} | ||
onChange={handleChange} | ||
label="Yes, delete this campaign and all its associated resources" | ||
/> | ||
</DialogContent> | ||
<DialogActions> | ||
<DialogTrigger disableButtonEnhancement> | ||
<Button disabled={!checked} appearance="primary"> | ||
Delete | ||
</Button> | ||
</DialogTrigger> | ||
<DialogTrigger disableButtonEnhancement> | ||
<Button appearance="secondary">Cancel</Button> | ||
</DialogTrigger> | ||
</DialogActions> | ||
</DialogBody> | ||
</DialogSurface> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
Actions.parameters = { | ||
docs: { | ||
description: { | ||
story, | ||
}, | ||
}, | ||
}; |
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