-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
[DSRN] Added ButtonIcon #386
base: main
Are you sure you want to change the base?
Conversation
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.
Nice work! Well structured and documented component. One blocking question about an accessibilityLabel
export const AllIcons: Story = { | ||
render: () => ( | ||
<ScrollView> | ||
<View style={{ flexWrap: 'wrap', flexDirection: 'row', padding: 16 }}> | ||
{Object.values(IconName).map((iconName) => ( | ||
<ButtonIconStory | ||
key={iconName} | ||
iconName={iconName} | ||
size={DEFAULT_BUTTONICON_PROPS.size} | ||
/> | ||
))} | ||
</View> | ||
</ScrollView> | ||
), | ||
}; |
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.
ButtonIconProps, | ||
'iconName' | 'size' | 'isDisabled' | 'isInverse' | 'isFloating' | ||
> = { | ||
iconName: IconName.Add, |
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.
nit: would close be a more appropriate default icon as it's likely the most used with ButtonIcon
|
||
### `size` | ||
|
||
Optional prop to control the size of the `ButtonIcon`. |
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.
nit: add default size
export type ButtonIconProps = { | ||
/** | ||
* Optional prop to control the size of the icon | ||
* Different sizes map to specific pixel dimensions | ||
* @default IconSize.Md | ||
*/ | ||
size?: ButtonIconSize; | ||
/** | ||
* Optional prop to specify an icon to show | ||
*/ | ||
iconName: IconName; | ||
/** | ||
* Optional prop to pass additional properties to the icon | ||
*/ | ||
iconProps?: Partial<IconProps>; | ||
/** | ||
* Optional prop that when true, disables the button | ||
* @default false | ||
*/ | ||
isDisabled?: boolean; | ||
/** | ||
* Optional prop to show the inverse state of the button, which is reserved for buttons on colored backgrounds. | ||
* @default false | ||
*/ | ||
isInverse?: boolean; | ||
/** | ||
* Optional prop to show the floating/contained state of the button, which is reserved for floating buttons. | ||
* Note: This prop provides styling only. There is no positioning logic. | ||
* @default false | ||
*/ | ||
isFloating?: boolean; | ||
/** | ||
* Optional prop to add twrnc overriding classNames. | ||
*/ | ||
twClassName?: string; | ||
/** | ||
* Optional prop to control the style. | ||
*/ | ||
style?: StyleProp<ViewStyle>; | ||
} & Omit<PressableProps, 'children'>; |
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.
possibly blocking: I noticed we don't have a required accessibilityLabel
prop for the icon. I'm not very familiar with accessibility best practices for mobile, but I think labeling icon buttons is important. How should we handle the equivalent of aria-label
in React Native, and how should it be applied here?
Description
This PR adds
ButtonIcon
to the dsrn libraryRelated issues
Fixes: #315
Manual testing steps
yarn storybook:ios
from rootScreenshots/Recordings
Before
After
Simulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2025-01-29.at.11.59.09.mp4
Pre-merge author checklist
Pre-merge reviewer checklist