-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
52 additions
and
42 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"@primer/react": patch | ||
--- | ||
|
||
Octicon: Add aria-label to the Icon instead of it's container |
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
55 changes: 25 additions & 30 deletions
55
packages/react/src/CircleOcticon/CircleOcticon.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 |
---|---|---|
@@ -1,59 +1,54 @@ | ||
import React from 'react' | ||
import type {Meta, StoryFn} from '@storybook/react' | ||
import CircleOcticon from './CircleOcticon' | ||
import type {CircleOcticonProps} from './CircleOcticon' | ||
import {CheckIcon} from '@primer/octicons-react' | ||
// eslint-disable-next-line import/no-namespace | ||
import * as Icons from '@primer/octicons-react' | ||
|
||
export default { | ||
const meta: Meta<typeof CircleOcticon> = { | ||
title: 'Components/CircleOcticon', | ||
component: CircleOcticon, | ||
} as Meta<typeof CircleOcticon> | ||
} | ||
export default meta | ||
|
||
export const Default = () => ( | ||
<CircleOcticon icon={CheckIcon} size={32} sx={{backgroundColor: 'success.emphasis', color: 'fg.onEmphasis'}} /> | ||
<CircleOcticon | ||
icon={CheckIcon} | ||
size={32} | ||
sx={{backgroundColor: 'success.emphasis', color: 'fg.onEmphasis'}} | ||
aria-label="Changes approved" | ||
/> | ||
) | ||
|
||
export const Playground: StoryFn<typeof CircleOcticon> = args => <CircleOcticon {...args} /> | ||
type PlaygroundTypes = Omit<CircleOcticonProps, 'icon'> & {icon: keyof typeof Icons} | ||
export const Playground: StoryFn<PlaygroundTypes> = ({icon: iconName, 'aria-label': ariaLabel, ...args}) => ( | ||
<CircleOcticon icon={Icons[iconName]} aria-label={ariaLabel ? ariaLabel : undefined} {...args} /> | ||
) | ||
|
||
Playground.args = { | ||
icon: CheckIcon, | ||
size: 32, | ||
icon: 'CheckIcon', | ||
'aria-label': undefined, | ||
sx: {backgroundColor: 'success.emphasis', color: 'fg.onEmphasis'}, | ||
} | ||
|
||
Playground.argTypes = { | ||
icon: { | ||
controls: false, | ||
table: { | ||
disable: true, | ||
}, | ||
}, | ||
size: { | ||
controls: { | ||
type: 'number', | ||
}, | ||
}, | ||
sx: { | ||
controls: false, | ||
table: { | ||
disable: true, | ||
}, | ||
}, | ||
as: { | ||
controls: false, | ||
table: { | ||
disable: true, | ||
icon: { | ||
control: { | ||
type: 'select', | ||
}, | ||
options: Object.keys(Icons), | ||
}, | ||
ref: { | ||
controls: false, | ||
table: { | ||
disable: true, | ||
}, | ||
'aria-label': { | ||
type: 'string', | ||
}, | ||
theme: { | ||
sx: { | ||
controls: false, | ||
table: { | ||
disable: true, | ||
}, | ||
}, | ||
} |
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