Skip to content

Commit

Permalink
feat: accessible icon
Browse files Browse the repository at this point in the history
  • Loading branch information
gndz07 authored Jun 15, 2023
1 parent 163dfdb commit a317c4e
Show file tree
Hide file tree
Showing 6 changed files with 183 additions and 0 deletions.
26 changes: 26 additions & 0 deletions components/AccessibleIcon/AccessibleIcon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ComponentMeta, ComponentStory } from '@storybook/react';
import { AccessibleIcon } from './AccessibleIcon';
import * as Icons from '@radix-ui/react-icons';
import { Flex } from '../Flex';
import { IconButton } from '../IconButton';

export default {
title: 'Components/AccessibleIcon',
component: AccessibleIcon,
} as ComponentMeta<any>;

export const Basic: ComponentStory<any> = (args) => (
<Flex gap={3} align="center">
<IconButton>
<AccessibleIcon label="notification" {...args} size="1">
<Icons.BellIcon />
</AccessibleIcon>
</IconButton>

<IconButton>
<AccessibleIcon label="user settings" {...args} size="2">
<Icons.AvatarIcon />
</AccessibleIcon>
</IconButton>
</Flex>
);
3 changes: 3 additions & 0 deletions components/AccessibleIcon/AccessibleIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as AccessibleIconPrimitive from '@radix-ui/react-accessible-icon';

export const AccessibleIcon = AccessibleIconPrimitive.Root;
1 change: 1 addition & 0 deletions components/AccessibleIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './AccessibleIcon';
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export { VisuallyHidden } from './components/VisuallyHidden';
export { Avatar } from './components/Avatar';
export { ButtonSwitchContainer, ButtonSwitchItem } from './components/ButtonSwitch';
export { TabsContainer, TabsList, TabsTrigger, TabsContent } from './components/Tabs';
export { AccessibleIcon } from './components/AccessibleIcon';

// Stitches
export {
Expand Down
151 changes: 151 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
},
"dependencies": {
"@radix-ui/colors": "^0.1.8",
"@radix-ui/react-accessible-icon": "^1.0.3",
"@radix-ui/react-accordion": "^1.0.1",
"@radix-ui/react-alert-dialog": "^1.0.2",
"@radix-ui/react-aspect-ratio": "^1.0.1",
Expand Down

0 comments on commit a317c4e

Please sign in to comment.