Skip to content

Commit 3d068a3

Browse files
committed
chore: extract iconControl out into a shared import
1 parent 6aa8123 commit 3d068a3

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

packages/component-library/src/Button/index.stories.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
1-
import * as icons from "@phosphor-icons/react/dist/ssr";
21
import type { Meta, StoryObj } from "@storybook/react";
32

43
import { Button as ButtonComponent, VARIANTS, SIZES } from "./index.jsx";
5-
6-
const iconControl = {
7-
control: "select",
8-
options: Object.keys(icons),
9-
mapping: Object.fromEntries(
10-
Object.entries(icons).map(([iconName, Icon]) => [
11-
iconName,
12-
<Icon key={iconName} weights={new Map()} />,
13-
]),
14-
),
15-
} as const;
4+
import { iconControl } from "../icon-control.jsx";
165

176
const meta = {
187
component: ButtonComponent,

packages/component-library/src/Card/index.stories.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import * as Icon from "@phosphor-icons/react/dist/ssr";
21
import type { Meta, StoryObj } from "@storybook/react";
32

43
import { Card as CardComponent, VARIANTS } from "./index.jsx";
4+
import { iconControl } from "../icon-control.jsx";
55

66
const meta = {
77
component: CardComponent,
@@ -44,14 +44,7 @@ const meta = {
4444
},
4545
},
4646
icon: {
47-
control: "select",
48-
options: Object.keys(Icon),
49-
mapping: Object.fromEntries(
50-
Object.entries(Icon).map(([key, Icon]) => [
51-
key,
52-
<Icon weights={new Map()} key={key} />,
53-
]),
54-
),
47+
...iconControl,
5548
table: {
5649
category: "Contents",
5750
},
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import * as icons from "@phosphor-icons/react/dist/ssr";
2+
3+
export const iconControl = {
4+
control: "select",
5+
options: Object.keys(icons),
6+
mapping: Object.fromEntries(
7+
Object.entries(icons).map(([iconName, Icon]) => [
8+
iconName,
9+
<Icon key={iconName} weights={new Map()} />,
10+
]),
11+
),
12+
} as const;

0 commit comments

Comments
 (0)