-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Expose width and height of nimble-dialog & add tokens (#1553)
# Pull Request ## 🤨 Rationale <!--- Provide some background and a description of your work. What problem does this change solve? Include links to issues, work items, or other discussions. --> #1117 ## 👩💻 Implementation <!--- Describe how the change addresses the problem. Consider factors such as complexity, alternative solutions, performance impact, etc. Consider listing files with important changes or comment on them directly in the pull request. --> - Performed the tasks that are enumerated in the issue linked above. - Create 2 tokens for the existing (small) dialog: width & max-height - Create 2 tokens for the large dialog: width & height - Have the small dialog as the default (width & max-height of small dialog; height set to `fit-content`, this was the default height that was applied to the dialog until now) - Added storybook documentation. ## 🧪 Testing <!--- Detail the testing done to ensure this submission meets requirements. Include automated/manual test additions or modifications, testing done on a local build, private CI run results, and additional testing not covered by automatic pull request validation. If any functionality is not covered by automated testing, provide justification. --> Manually thorugh the storybook tests & matrix tests in chromatic. The sizes are configurable in the storybook similarly to how the width is configurable for the nimble drawer. For the matrix tests, I added 2 stories: one for the small dialog and one for the large dialog: https://www.chromatic.com/build?appId=60e89457a987cf003efc0a5b&number=7776 ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [X] I have updated the project documentation to reflect my changes or determined no changes are needed.
- Loading branch information
Showing
11 changed files
with
210 additions
and
6 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
change/@ni-nimble-components-1e4a5579-af4c-4960-8cfc-32d8417d1a34.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": "minor", | ||
"comment": "Expose width and height of nimble-dialog & add tokens", | ||
"packageName": "@ni/nimble-components", | ||
"email": "[email protected]", | ||
"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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { | ||
DocsStory, | ||
Meta, | ||
Controls, | ||
Stories, | ||
Title, | ||
Description | ||
} from '@storybook/blocks'; | ||
import * as dialogStories from './dialog.stories'; | ||
|
||
<Meta of={dialogStories} /> | ||
|
||
<Title of={dialogStories} /> | ||
<Description of={dialogStories} /> | ||
|
||
<DocsStory of={dialogStories.dialog} expanded={false} /> | ||
<Controls of={dialogStories.dialog} /> | ||
|
||
# Usage Docs | ||
|
||
<br /> | ||
|
||
## Sizing | ||
|
||
The dialog size can be customized by modyfing the width, height and max-height properties of `nimble-dialog::part(control)`. | ||
|
||
By default, the dialog is sized to be small and growable. This should be used for small dialogs like a confirmation dialog. | ||
This is equivalent of using the following style configuration: | ||
|
||
```scss | ||
nimble-dialog::part(control) { | ||
width: $ni-nimble-dialog-small-width; | ||
height: $ni-nimble-dialog-small-height; | ||
max-height: $ni-nimble-dialog-small-max-height; | ||
} | ||
``` | ||
|
||
For larger dialogs, for example a wizard-like dialog, the following style configuration should be used: | ||
|
||
```scss | ||
nimble-dialog::part(control) { | ||
width: $ni-nimble-dialog-large-width; | ||
height: $ni-nimble-dialog-large-height; | ||
max-height: $ni-nimble-dialog-large-max-height; | ||
} | ||
``` |
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