Skip to content

Commit adf9b80

Browse files
committed
feat(ui): add CircularIcon
1 parent 3ecfbcb commit adf9b80

File tree

3 files changed

+69
-0
lines changed

3 files changed

+69
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@reference "../../styles/index.css";
2+
3+
.icon {
4+
@apply flex
5+
items-center
6+
justify-center
7+
rounded-full
8+
font-semibold
9+
text-white;
10+
11+
&.lg {
12+
@apply h-12
13+
w-12
14+
text-2xl;
15+
}
16+
17+
&.md {
18+
@apply h-10
19+
w-10
20+
text-xl;
21+
}
22+
23+
&.sm {
24+
@apply h-8
25+
w-8;
26+
}
27+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
2+
3+
import CircularIcon from '#ui/Common/CircularIcon';
4+
5+
type Story = StoryObj<typeof CircularIcon>;
6+
type Meta = MetaObj<typeof CircularIcon>;
7+
8+
export const Icons: Story = {
9+
render: () => (
10+
<div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
11+
<CircularIcon symbol="B" color="#3b82f6" size="sm" />
12+
<CircularIcon symbol="G" color="#10b981" size="md" />
13+
<CircularIcon symbol="R" color="#ef4444" size="lg" />
14+
</div>
15+
),
16+
};
17+
18+
export default { component: CircularIcon } as Meta;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import classNames from 'classnames';
2+
3+
import styles from './index.module.css';
4+
5+
interface CircularIconProps {
6+
symbol: string;
7+
color: string;
8+
size?: 'lg' | 'md' | 'sm';
9+
}
10+
11+
export default function CircularIcon({
12+
symbol,
13+
color,
14+
size = 'md',
15+
}: CircularIconProps) {
16+
return (
17+
<div
18+
className={classNames(styles.icon, styles[size])}
19+
style={{ backgroundColor: color }}
20+
>
21+
<span>{symbol}</span>
22+
</div>
23+
);
24+
}

0 commit comments

Comments
 (0)