Skip to content

Commit 082cdd1

Browse files
committed
fixup!
1 parent a21a809 commit 082cdd1

File tree

3 files changed

+66
-20
lines changed

3 files changed

+66
-20
lines changed

packages/ui-components/Common/CircularIcon/index.module.css

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,34 @@
1919
}
2020

2121
&.sm {
22-
@apply size-8
22+
@apply size-8;
23+
}
24+
25+
&.event {
26+
@apply bg-purple-600;
27+
}
28+
29+
&.method {
30+
@apply bg-info-600;
31+
}
32+
33+
&.property {
34+
@apply bg-green-600;
35+
}
36+
37+
&.class {
38+
@apply bg-warning-600;
39+
}
40+
41+
&.module {
42+
@apply bg-red-600;
43+
}
44+
45+
&.classMethod {
46+
@apply bg-blue-600;
47+
}
48+
49+
&.ctor {
50+
@apply bg-pink-600;
2351
}
2452
}

packages/ui-components/Common/CircularIcon/index.stories.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
import type { Meta as MetaObj, StoryObj } from '@storybook/react';
22

3-
import CircularIcon from '#ui/Common/CircularIcon';
3+
import CircularIcon, { type CircularIconProps } from '#ui/Common/CircularIcon';
44

55
type Story = StoryObj<typeof CircularIcon>;
66
type Meta = MetaObj<typeof CircularIcon>;
77

88
export const Icons: Story = {
99
render: () => (
10-
<div className="flex items-center gap-4">
11-
<CircularIcon symbol="B" color="#3b82f6" size="sm" />
12-
<CircularIcon symbol="G" color="#10b981" size="md" />
13-
<CircularIcon symbol="R" color="#ef4444" size="lg" />
10+
<div className="grid grid-cols-3 gap-6 p-6">
11+
{['event', 'method', 'property', 'class', 'module', 'classMethod', 'ctor']
12+
.map(kind =>
13+
['sm', 'md', 'lg'].map(size => (
14+
<div key={`${kind}-${size}`} className="flex justify-center">
15+
<CircularIcon
16+
kind={kind as CircularIconProps['kind']}
17+
size={size as CircularIconProps['size']}
18+
/>
19+
</div>
20+
))
21+
)
22+
.flat()}
1423
</div>
1524
),
1625
};

packages/ui-components/Common/CircularIcon/index.tsx

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,32 @@ import classNames from 'classnames';
22

33
import styles from './index.module.css';
44

5-
interface CircularIconProps {
6-
symbol: string;
7-
color: string;
5+
export type CircularIconProps = {
6+
kind:
7+
| 'event'
8+
| 'method'
9+
| 'property'
10+
| 'class'
11+
| 'module'
12+
| 'classMethod'
13+
| 'ctor';
814
size?: 'lg' | 'md' | 'sm';
9-
}
15+
};
16+
17+
const symbolMap = {
18+
event: 'E',
19+
method: 'M',
20+
property: 'P',
21+
class: 'C',
22+
module: 'M',
23+
classMethod: 'S',
24+
ctor: 'C',
25+
} as const;
1026

11-
export default function CircularIcon({
12-
symbol,
13-
color,
14-
size = 'md',
15-
}: CircularIconProps) {
27+
export default function CircularIcon({ kind, size = 'md' }: CircularIconProps) {
1628
return (
17-
<div
18-
className={classNames(styles.icon, styles[size])}
19-
style={{ backgroundColor: color }}
20-
>
21-
<span>{symbol}</span>
29+
<div className={classNames(styles.icon, styles[size], styles[kind])}>
30+
<span>{symbolMap[kind]}</span>
2231
</div>
2332
);
2433
}

0 commit comments

Comments
 (0)