Skip to content

Commit

Permalink
chore: change <SvgIcon> "kind" prop to "purpose"
Browse files Browse the repository at this point in the history
"kind" is kind of generic, and "purpose" better describes the... purpose... of the prop.
  • Loading branch information
ahuth committed Aug 2, 2021
1 parent f0222dc commit 2d165c0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/components/src/Button/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const linkWithIcon = Template.bind(null);
linkWithIcon.args = {
children: (
<>
Link with icon <CheckCircle type="decorative" />
Link with icon <CheckCircle purpose="decorative" />
</>
),
color: "success",
Expand All @@ -87,7 +87,7 @@ export const outlineWithIcon = Template.bind(null);
outlineWithIcon.args = {
children: (
<>
Outline with icon <CheckCircle type="decorative" />
Outline with icon <CheckCircle purpose="decorative" />
</>
),
color: "warning",
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/SvgIcon/SvgIcon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ export const InText = ({ icon, ...rest }: Args) => {
return (
<Text size="h1">
The svg icon defaults to the surrounding text size (
<Icon {...rest} type="informative" title="icon with 1em line height" />,
1em), but often looks better with the line height (
<Icon {...rest} purpose="informative" title="icon with 1em line height" />
, 1em), but often looks better with the line height (
<Icon
{...rest}
type="informative"
purpose="informative"
title="icon with 2em line height"
size="2rem"
/>
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/SvgIcon/SvgIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ interface InformativeIconProps extends IconPropsBase {
* Use "informative" when the icon **_does_** provide additional meaning to other text on the
* page. You'll be required to pass in a title to label the icon.
*/
type: "informative";
purpose: "informative";
title: string;
}

Expand All @@ -54,7 +54,7 @@ interface DecorativeIconProps extends IconPropsBase {
* associated text. Basically the icon is for show and people don't need it to understand what's
* on the page.
*/
type: "decorative";
purpose: "decorative";
}

export type SvgIconProps = DecorativeIconProps | InformativeIconProps;
Expand Down Expand Up @@ -100,7 +100,7 @@ function SvgIcon(props: SvgIconProps) {
xmlns: "http://www.w3.org/2000/svg",
};

if (props.type === "informative") {
if (props.purpose === "informative") {
return (
<svg {...svgCommonProps} role="img">
<title>{props.title}</title>
Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/Tag/Tag.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ OutlineVariants.args = {
export const WithIcon = Template.bind(null);
WithIcon.args = {
...defaultArgs,
icon: <WarningIcon key="icon" type="informative" title="warning" />,
icon: <WarningIcon key="icon" purpose="informative" title="warning" />,
};

export const WithLongTextAndIcon = Template.bind(null);
WithLongTextAndIcon.args = {
...defaultArgs,
children: "This tag has a really long text message",
icon: <WarningIcon key="icon" type="informative" title="warning" />,
icon: <WarningIcon key="icon" purpose="informative" title="warning" />,
};
2 changes: 1 addition & 1 deletion packages/components/src/common/CloseButton/CloseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const CloseButton = ({ className, color, onClose, size }: CloseButtonProps) => (
onClick={onClose}
variant="link"
>
<CloseIcon type="informative" size={size} title="close" />
<CloseIcon purpose="informative" size={size} title="close" />
</Button>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const NotificationIcon = ({ variant }: Props) => {

return (
<div className={iconAssets.style}>
<iconAssets.icon type="informative" title={iconAssets.title} />
<iconAssets.icon purpose="informative" title={iconAssets.title} />
</div>
);
};
Expand Down

0 comments on commit 2d165c0

Please sign in to comment.