Skip to content
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

Open
wants to merge 3 commits into
base: feat/ds-1656-split-button-react
Choose a base branch
from

Conversation

pavelklibani
Copy link
Contributor

@pavelklibani pavelklibani commented Feb 17, 2025

Description

TODO

  • Test

Additional context

Uncontrolled demo will be removed before merge

Issue reference

Component UncontrolledSplitButton | React

@pavelklibani pavelklibani self-assigned this Feb 17, 2025
@github-actions github-actions bot added the feature New feature or request label Feb 17, 2025
Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for spirit-design-system-storybook ready!

Name Link
🔨 Latest commit d715d63
🔍 Latest deploy log https://app.netlify.com/sites/spirit-design-system-storybook/deploys/67b83ddd033e6d00086d15ed
😎 Deploy Preview https://deploy-preview-1949--spirit-design-system-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for spirit-design-system ready!

Name Link
🔨 Latest commit d715d63
🔍 Latest deploy log https://app.netlify.com/sites/spirit-design-system/deploys/67b83ddd6a7dc8000865835b
😎 Deploy Preview https://deploy-preview-1949--spirit-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 96 (no change from production)
Accessibility: 91 (no change from production)
Best Practices: 100 (no change from production)
SEO: 91 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch 2 times, most recently from 3b8eebe to f57727c Compare February 18, 2025 12:58
@pavelklibani pavelklibani marked this pull request as ready for review February 18, 2025 12:58
@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch from f57727c to 9539fbd Compare February 18, 2025 13:11
@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch from 9539fbd to 0bd4f4e Compare February 19, 2025 12:48
Copy link
Collaborator

@literat literat left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch 2 times, most recently from dedd130 to 0c1eac2 Compare February 19, 2025 14:00
@pavelklibani pavelklibani force-pushed the feat/ds-1656-split-button-react branch from 992f1b2 to f14714e Compare February 20, 2025 09:58
@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch from 0c1eac2 to 8d37fbd Compare February 20, 2025 09:59
@coveralls
Copy link

Coverage Status

coverage: 96.838%. remained the same
when pulling 8d37fbd on feat/ds-1671-uncontrolled-splitbutton
into f14714e on feat/ds-1656-split-button-react.

@pavelklibani pavelklibani force-pushed the feat/ds-1656-split-button-react branch from f14714e to 23274aa Compare February 20, 2025 10:13
@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch from 8d37fbd to 951c3ec Compare February 20, 2025 10:14
@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch from 951c3ec to 03e3a26 Compare February 20, 2025 13:54
| `isDisabled` | `boolean` | `false` | ✕ | Disables the Split Button |
| `size` | [Size dictionary][dictionary-size] | `medium` | ✕ | Size variant |

(\*) Conditionally required: either `buttonIconName` or `buttonLabel` must be provided.
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

screenshot update?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch from 03e3a26 to 791bb5d Compare February 20, 2025 15:03
@pavelklibani pavelklibani force-pushed the feat/ds-1671-uncontrolled-splitbutton branch from 791bb5d to 56dfb38 Compare February 20, 2025 15:05
| `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 |
Copy link
Contributor

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} />}
Copy link
Contributor

@curdaj curdaj Feb 21, 2025

Choose a reason for hiding this comment

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

Suggested change
{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'}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants