Skip to content

Commit 5130256

Browse files
committed
chore(Icon stories): tighten ResponsiveGridContainer typing and apply prettier
Address Copilot review feedback on PR #1050: type ResponsiveGridContainer as `ComponentProps<typeof GridContainer>` and merge className via `cn` so callers can extend the wrapper without losing the responsive-grid class. Also runs prettier on the file to clear pre-existing code-quality CI failures from the migration commit (one-line JSX expressions that prettier wants on multiple lines). Auto-format, no behavior change. The unaddressed Copilot point — `circle[fill]` appearing in both the stroke and fill rules of Icon.module.css — is a pre-existing bug that the migration deliberately preserved per the byte-for-byte parity rule (`circle[stroke]` was missing from the original styled-components source too). Fix in a separate PR after this lands.
1 parent 9f430ea commit 5130256

1 file changed

Lines changed: 112 additions & 20 deletions

File tree

src/components/Icon/Icon.stories.tsx

Lines changed: 112 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import { Icon } from '@/components/Icon';
66
import { IconName, IconProps, ImageType } from '@/components/Icon/Icon.types';
77
import { ICONS_MAP } from '@/components/Icon/IconCommon';
88
import { Container } from '@/components/Container';
9-
import { useState } from 'react';
9+
import { ComponentProps, useState } from 'react';
10+
import { cn } from '@/lib/cva';
1011
import { SearchField } from '@/components/SearchField';
1112
import { Title } from '@/components/Title';
1213
import { Panel } from '@/components/Panel';
@@ -73,71 +74,159 @@ export const DefaultMd: Story = {
7374
};
7475

7576
export const SizeXs: Story = {
76-
render: () => <IconHarness name="users" size="xs" />,
77+
render: () => (
78+
<IconHarness
79+
name="users"
80+
size="xs"
81+
/>
82+
),
7783
};
7884

7985
export const SizeSm: Story = {
80-
render: () => <IconHarness name="users" size="sm" />,
86+
render: () => (
87+
<IconHarness
88+
name="users"
89+
size="sm"
90+
/>
91+
),
8192
};
8293

8394
export const SizeMd: Story = {
84-
render: () => <IconHarness name="users" size="md" />,
95+
render: () => (
96+
<IconHarness
97+
name="users"
98+
size="md"
99+
/>
100+
),
85101
};
86102

87103
export const SizeLg: Story = {
88-
render: () => <IconHarness name="users" size="lg" />,
104+
render: () => (
105+
<IconHarness
106+
name="users"
107+
size="lg"
108+
/>
109+
),
89110
};
90111

91112
export const SizeXl: Story = {
92-
render: () => <IconHarness name="users" size="xl" />,
113+
render: () => (
114+
<IconHarness
115+
name="users"
116+
size="xl"
117+
/>
118+
),
93119
};
94120

95121
export const SizeXxl: Story = {
96-
render: () => <IconHarness name="users" size="xxl" />,
122+
render: () => (
123+
<IconHarness
124+
name="users"
125+
size="xxl"
126+
/>
127+
),
97128
};
98129

99130
export const StateSuccess: Story = {
100-
render: () => <IconHarness name="users" state="success" />,
131+
render: () => (
132+
<IconHarness
133+
name="users"
134+
state="success"
135+
/>
136+
),
101137
};
102138

103139
export const StateWarning: Story = {
104-
render: () => <IconHarness name="users" state="warning" />,
140+
render: () => (
141+
<IconHarness
142+
name="users"
143+
state="warning"
144+
/>
145+
),
105146
};
106147

107148
export const StateDanger: Story = {
108-
render: () => <IconHarness name="users" state="danger" />,
149+
render: () => (
150+
<IconHarness
151+
name="users"
152+
state="danger"
153+
/>
154+
),
109155
};
110156

111157
export const StateInfo: Story = {
112-
render: () => <IconHarness name="users" state="info" />,
158+
render: () => (
159+
<IconHarness
160+
name="users"
161+
state="info"
162+
/>
163+
),
113164
};
114165

115166
export const StateSuccessSm: Story = {
116-
render: () => <IconHarness name="users" state="success" size="sm" />,
167+
render: () => (
168+
<IconHarness
169+
name="users"
170+
state="success"
171+
size="sm"
172+
/>
173+
),
117174
};
118175

119176
export const StateSuccessXl: Story = {
120-
render: () => <IconHarness name="users" state="success" size="xl" />,
177+
render: () => (
178+
<IconHarness
179+
name="users"
180+
state="success"
181+
size="xl"
182+
/>
183+
),
121184
};
122185

123186
export const CustomColor: Story = {
124-
render: () => <IconHarness name="users" color="#c10000" />,
187+
render: () => (
188+
<IconHarness
189+
name="users"
190+
color="#c10000"
191+
/>
192+
),
125193
};
126194

127195
export const CustomWidthHeight: Story = {
128-
render: () => <IconHarness name="users" width={40} height={40} />,
196+
render: () => (
197+
<IconHarness
198+
name="users"
199+
width={40}
200+
height={40}
201+
/>
202+
),
129203
};
130204

131205
export const FlagAsset: Story = {
132-
render: () => <IconHarness name="australia" size="md" />,
206+
render: () => (
207+
<IconHarness
208+
name="australia"
209+
size="md"
210+
/>
211+
),
133212
};
134213

135214
export const LogoAsset: Story = {
136-
render: () => <IconHarness name="clickhouse" size="md" />,
215+
render: () => (
216+
<IconHarness
217+
name="clickhouse"
218+
size="md"
219+
/>
220+
),
137221
};
138222

139223
export const PaymentAsset: Story = {
140-
render: () => <IconHarness name="visa" size="md" />,
224+
render: () => (
225+
<IconHarness
226+
name="visa"
227+
size="md"
228+
/>
229+
),
141230
};
142231

143232
type IconGalleryProps = {
@@ -164,9 +253,12 @@ const IconGallery = ({ name }: IconGalleryProps) => (
164253
</Container>
165254
);
166255

167-
const ResponsiveGridContainer = (props: { children: React.ReactNode }) => (
256+
const ResponsiveGridContainer = ({
257+
className,
258+
...props
259+
}: ComponentProps<typeof GridContainer>) => (
168260
<GridContainer
169-
className={storyStyles['responsive-grid']}
261+
className={cn(storyStyles['responsive-grid'], className)}
170262
{...props}
171263
/>
172264
);

0 commit comments

Comments
 (0)