-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-dialog): replace
closeButton
to a more generic action
…
…slot (#24719) * feat(react-dialog): replace `closeButton` to a more generic `action` slot * chore: updates e2e tests * chore: updates title custom action
- Loading branch information
1 parent
81191d9
commit 0865ee9
Showing
19 changed files
with
185 additions
and
61 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@fluentui-react-dialog-beceb7aa-8aa2-4e44-9992-df048001834d.json
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,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "feat(react-dialog): replace `closeButton` to a more generic `action` slot", | ||
"packageName": "@fluentui/react-dialog", | ||
"email": "bernardo.sunderhus@gmail.com", | ||
"dependentChangeType": "patch" | ||
} |
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
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
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
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
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
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
6 changes: 4 additions & 2 deletions
6
packages/react-components/react-dialog/src/components/DialogTitle/DialogTitle.types.ts
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
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
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
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
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
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
3 changes: 3 additions & 0 deletions
3
...eact-components/react-dialog/src/stories/DialogTitle/DialogTitleCustomAction.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 @@ | ||
By default if `Dialog` has `modalType='non-modal'` a button with a close icon is provided to close the dialog as `action` slot. | ||
|
||
This slot can be customized to add a different kind of action, that it'll be available in any kind of `Dialog`, ignoring the `modalType` property, here's an example replacing the simple close icon with a [Fluent UI Button](./?path=/docs/components-button-button--default) using the same icon. |
39 changes: 39 additions & 0 deletions
39
...react-components/react-dialog/src/stories/DialogTitle/DialogTitleCustomAction.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,39 @@ | ||
import * as React from 'react'; | ||
import { Dialog, DialogTrigger, DialogSurface, DialogTitle, DialogBody } from '@fluentui/react-dialog'; | ||
import { Button } from '@fluentui/react-components'; | ||
import story from './DialogTitleCustomAction.md'; | ||
import { Dismiss24Regular } from '@fluentui/react-icons'; | ||
|
||
export const CustomAction = () => { | ||
return ( | ||
<Dialog> | ||
<DialogTrigger> | ||
<Button>Open dialog</Button> | ||
</DialogTrigger> | ||
<DialogSurface> | ||
<DialogTitle | ||
action={ | ||
<DialogTrigger action="close"> | ||
<Button appearance="subtle" aria-label="close" icon={<Dismiss24Regular />} /> | ||
</DialogTrigger> | ||
} | ||
> | ||
Dialog title | ||
</DialogTitle> | ||
<DialogBody> | ||
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Aliquid, explicabo repudiandae impedit doloribus | ||
laborum quidem maxime dolores perspiciatis non ipsam, nostrum commodi quis autem sequi, incidunt cum? | ||
Consequuntur, repellendus nostrum? | ||
</DialogBody> | ||
</DialogSurface> | ||
</Dialog> | ||
); | ||
}; | ||
|
||
CustomAction.parameters = { | ||
docs: { | ||
description: { | ||
story, | ||
}, | ||
}, | ||
}; |
Oops, something went wrong.