-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat(web-react): Introduce UncontrolledSplitButton
#DS-1656
#1949
base: feat/ds-1656-split-button-react
Are you sure you want to change the base?
Feat(web-react): Introduce UncontrolledSplitButton
#DS-1656
#1949
Conversation
✅ Deploy Preview for spirit-design-system-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
✅ Deploy Preview for spirit-design-system ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
3b8eebe
to
f57727c
Compare
f57727c
to
9539fbd
Compare
9539fbd
to
0bd4f4e
Compare
packages/web-react/src/components/SplitButton/UncontrolledSplitButton.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
dedd130
to
0c1eac2
Compare
packages/web-react/src/components/SplitButton/__tests__/UncontrolledSplitButton.test.tsx
Show resolved
Hide resolved
992f1b2
to
f14714e
Compare
0c1eac2
to
8d37fbd
Compare
f14714e
to
23274aa
Compare
8d37fbd
to
951c3ec
Compare
packages/web-react/src/components/SplitButton/stories/UncontrolledSplitButton.stories.tsx
Show resolved
Hide resolved
951c3ec
to
03e3a26
Compare
| `isDisabled` | `boolean` | `false` | ✕ | Disables the Split Button | | ||
| `size` | [Size dictionary][dictionary-size] | `medium` | ✕ | Size variant | | ||
|
||
(\*) Conditionally required: either `buttonIconName` or `buttonLabel` must be provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I add a label (for a11y) to a button with only an icon, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a new prop, isLabelHidden
, so the label is always required, and the button has its label.
packages/web-react/src/components/SplitButton/UncontrolledSplitButton.tsx
Outdated
Show resolved
Hide resolved
packages/web-react/src/components/SplitButton/UncontrolledSplitButton.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
screenshot update?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have uncontrolled demos visible due to visual tests, but I keep the demo files for development and debugging, so we don’t need to create a new demo to test it, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But uncontrolled variant is available in Storybook
- Solves #DS-1671
03e3a26
to
791bb5d
Compare
791bb5d
to
56dfb38
Compare
packages/web-react/src/components/SplitButton/UncontrolledSplitButton.tsx
Outdated
Show resolved
Hide resolved
| `id` | `string` | - | ✓ | Id of the Split Button and part of Dropdown id | | ||
| `isDisabled` | `bool` | `false` | ✕ | Disables the Split Button | | ||
| `isLabelHidden` | `bool` | `false` | ✕ \* | Whether is label hidden | | ||
| `isDropdownLabelHidden` | `bool` | `false` | ✕ \*\* | Whether is label hidden | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what **
means? There is legend only for one *
return ( | ||
<SplitButton id={id} {...restProps} isDisabled={isDisabled}> | ||
<Button onClick={buttonOnClick}> | ||
{buttonIconName && <Icon name={buttonIconName} marginRight={!isLabelHidden ? 'space-400' : undefined} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{buttonIconName && <Icon name={buttonIconName} marginRight={!isLabelHidden ? 'space-400' : undefined} />} | |
{buttonIconName && <Icon name={buttonIconName} marginRight={isLabelHidden ? undefined : 'space-400'} />} |
IMHO more readable.
Or maybe marginRight={isLabelHidden && 'space-400'}
Description
TODO
Additional context
Uncontrolled demo will be removed before merge
Issue reference
Component UncontrolledSplitButton | React