Skip to content

Commit a266d11

Browse files
author
Mykola Ptushchuk
committed
Change icons name to camelCase, standard typo fix
1 parent 12ce74c commit a266d11

File tree

2 files changed

+78
-74
lines changed

2 files changed

+78
-74
lines changed

src/components/Icon/Icon.stories.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@ import { Meta, StoryObj } from "@storybook/react";
33

44
import Icon, {
55
ICONS,
6-
STANDART_ICONS,
6+
STANDARD_ICONS,
77
ADDITIONAL_ICONS,
88
SOCIAL_ICONS,
99
STATUS_ICONS,
1010
} from "./Icon";
1111

1212
import "./Icon.stories.scss";
1313

14+
const Template = ({ name }: { name: keyof typeof ICONS }) => (
15+
<Icon name={ICONS[name]} />
16+
);
17+
1418
const meta: Meta<typeof Icon> = {
15-
component: Icon,
19+
component: Template,
1620
tags: ["autodocs"],
1721
};
1822

@@ -33,16 +37,16 @@ export const Base: Story = {
3337
},
3438
};
3539

36-
export const Standart: Story = {
37-
name: "Standart",
40+
export const Standard: Story = {
41+
name: "Standard",
3842
argTypes: {
3943
name: {
40-
options: Object.keys(STANDART_ICONS),
44+
options: Object.keys(STANDARD_ICONS),
4145
control: { type: "select" },
4246
},
4347
},
4448
args: {
45-
name: STANDART_ICONS.plus,
49+
name: STANDARD_ICONS.plus,
4650
},
4751
};
4852

@@ -88,7 +92,7 @@ export const Additional: Story = {
8892
};
8993

9094
const allIcons = {
91-
Standard: STANDART_ICONS,
95+
Standard: STANDARD_ICONS,
9296
Additional: ADDITIONAL_ICONS,
9397
Social: SOCIAL_ICONS,
9498
Status: STATUS_ICONS,
@@ -101,19 +105,19 @@ export const AllIcons: Story = {
101105
render: () => (
102106
<>
103107
{Object.entries(allIcons).map(([name, icons]) => (
104-
<>
108+
<div key={name}>
105109
<h2>{name}</h2>
106110
<div className="grid-row">
107111
{Object.keys(icons).map((icon) => (
108112
<div key={icon} className="p-card grid-col-2">
109113
<p>
110-
<Icon name={icon} style={{ marginRight: ".5rem" }} />
114+
<Icon name={ICONS[icon]} style={{ marginRight: ".5rem" }} />
111115
<span>{icon}</span>
112116
</p>
113117
</div>
114118
))}
115119
</div>
116-
</>
120+
</div>
117121
))}
118122
</>
119123
),

src/components/Icon/Icon.tsx

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import React from "react";
44

55
import type { ClassName, PropsWithSpread, ValueOf } from "types";
66

7-
export const STANDART_ICONS = {
7+
export const STANDARD_ICONS = {
88
anchor: "anchor",
9-
"chevron-down": "chevron-down",
10-
"chevron-left": "chevron-left",
11-
"chevron-right": "chevron-right",
12-
"chevron-up": "chevron-up",
9+
chevronDown: "chevron-down",
10+
chevronLeft: "chevron-left",
11+
chevronRight: "chevron-right",
12+
chevronUp: "chevron-up",
1313
close: "close",
1414
code: "code",
1515
collapse: "collapse",
1616
copy: "copy",
1717
delete: "delete",
1818
drag: "drag",
19-
"error-grey": "error-grey",
19+
errorGrey: "error-grey",
2020
expand: "expand",
21-
"external-link": "external-link",
21+
externalLink: "external-link",
2222
help: "help",
2323
hide: "hide",
2424
menu: "menu",
@@ -28,7 +28,7 @@ export const STANDART_ICONS = {
2828
share: "share",
2929
show: "show",
3030
spinner: "spinner",
31-
"success-grey": "success-grey",
31+
successGrey: "success-grey",
3232
user: "user",
3333
} as const;
3434

@@ -47,94 +47,94 @@ export const ADDITIONAL_ICONS = {
4747
machines: "machines",
4848
pin: "pin",
4949
units: "units",
50-
"priority-critical": "priority-critical",
51-
"priority-high": "priority-high",
52-
"priority-low": "priority-low",
53-
"priority-medium": "priority-medium",
54-
"priority-negligible": "priority-negligible",
55-
"priority-unknown": "priority-unknown",
56-
"add-canvas": "add-canvas",
57-
"add-logical-volume": "add-logical-volume",
58-
"add-partition": "add-partition",
59-
"back-to-top": "back-to-top",
60-
"begin-downloading": "begin-downloading",
50+
priorityCritical: "priority-critical",
51+
priorityHigh: "priority-high",
52+
priorityLow: "priority-low",
53+
priorityMedium: "priority-medium",
54+
priorityNegligible: "priority-negligible",
55+
priorityUnknown: "priority-unknown",
56+
addCanvas: "add-canvas",
57+
addLogicalVolume: "add-logical-volume",
58+
addPartition: "add-partition",
59+
backToTop: "back-to-top",
60+
beginDownloading: "begin-downloading",
6161
bundle: "bundle",
6262
canvas: "canvas",
63-
"change-version": "change-version",
63+
changeVersion: "change-version",
6464
comments: "comments",
65-
"conflict-grey": "conflict-grey",
66-
"conflict-resolution-grey": "conflict-resolution-grey",
67-
"conflict-resolution": "conflict-resolution",
65+
conflictGrey: "conflict-grey",
66+
conflictResolutionGrey: "conflict-resolution-grey",
67+
conflictResolution: "conflict-resolution",
6868
conflict: "conflict",
6969
connected: "connected",
7070
containers: "containers",
71-
"copy-to-clipboard": "copy-to-clipboard",
71+
copyToClipboard: "copy-to-clipboard",
7272
desktop: "desktop",
7373
disconnect: "disconnect",
7474
edit: "edit",
7575
export: "export",
7676
exposed: "exposed",
7777
filter: "filter",
7878
fork: "fork",
79-
"get-link": "get-link",
80-
"halfscreen-bar": "halfscreen-bar",
81-
"highlight-off": "highlight-off",
82-
"highlight-on": "highlight-on",
79+
getLink: "get-link",
80+
halfscreenBar: "halfscreen-bar",
81+
highlightOff: "highlight-off",
82+
highlightOn: "highlight-on",
8383
home: "home",
8484
import: "import",
85-
"in-progress": "in-progress",
86-
"inspector-debug": "inspector-debug",
87-
"loading-steps": "loading-steps",
88-
"lock-locked-active": "lock-locked-active",
89-
"lock-locked": "lock-locked",
90-
"lock-unlock": "lock-unlock",
91-
"maximise-bar": "maximise-bar",
92-
"minimise-bar": "minimise-bar",
93-
"mount-2": "mount-2",
85+
inProgress: "in-progress",
86+
inspectorDebug: "inspector-debug",
87+
loadingSteps: "loading-steps",
88+
lockLockedActive: "lock-locked-active",
89+
lockLocked: "lock-locked",
90+
lockUnlock: "lock-unlock",
91+
maximiseBar: "maximise-bar",
92+
minimiseBar: "minimise-bar",
93+
mount2: "mount-2",
9494
mount: "mount",
95-
"open-terminal": "open-terminal",
95+
openTerminal: "open-terminal",
9696
pause: "pause",
9797
plans: "plans",
9898
play: "play",
9999
pods: "pods",
100-
"power-error": "power-error",
101-
"power-off": "power-off",
102-
"power-on": "power-on",
100+
powerError: "power-error",
101+
powerOff: "power-off",
102+
powerOn: "power-on",
103103
profile: "profile",
104104
restart: "restart",
105105
revisions: "revisions",
106106
security: "security",
107107
settings: "settings",
108-
"sort-both": "sort-both",
109-
"sort-down": "sort-down",
110-
"sort-up": "sort-up",
108+
sortBoth: "sort-both",
109+
sortDown: "sort-down",
110+
sortUp: "sort-up",
111111
starred: "starred",
112-
"status-failed-small": "status-failed-small",
113-
"status-in-progress-small": "status-in-progress-small",
114-
"status-in-progress": "status-in-progress",
115-
"status-queued-small": "status-queued-small",
116-
"status-queued": "status-queued",
117-
"status-succeeded-small": "status-succeeded-small",
118-
"status-waiting-small": "status-waiting-small",
119-
"status-waiting": "status-waiting",
112+
statusFailedSmall: "status-failed-small",
113+
statusInProgressSmall: "status-in-progress-small",
114+
statusInProgress: "status-in-progress",
115+
statusQueuedSmall: "status-queued-small",
116+
statusQueued: "status-queued",
117+
statusSucceededSmall: "status-succeeded-small",
118+
statusWaitingSmall: "status-waiting-small",
119+
statusWaiting: "status-waiting",
120120
status: "status",
121121
stop: "stop",
122-
"submit-bug": "submit-bug",
123-
"switcher-dashboard": "switcher-dashboard",
124-
"switcher-environments": "switcher-environments",
122+
submitBug: "submit-bug",
123+
switcherDashboard: "switcher-dashboard",
124+
switcherEnvironments: "switcher-environments",
125125
switcher: "switcher",
126126
tag: "tag",
127-
"task-outstanding": "task-outstanding",
128-
"timed-out-grey": "timed-out-grey",
129-
"timed-out": "timed-out",
127+
taskOutstanding: "task-outstanding",
128+
timedOutGrey: "timed-out-grey",
129+
timedOut: "timed-out",
130130
topic: "topic",
131-
"unit-pending": "unit-pending",
132-
"unit-running": "unit-running",
131+
unitPending: "unit-pending",
132+
unitRunning: "unit-running",
133133
unmount: "unmount",
134134
unstarred: "unstarred",
135-
"user-group": "user-group",
136-
"video-play": "video-play",
137-
"warning-grey": "warning-grey",
135+
userGroup: "user-group",
136+
videoPlay: "video-play",
137+
warningGrey: "warning-grey",
138138
} as const;
139139

140140
export const SOCIAL_ICONS = {
@@ -149,7 +149,7 @@ export const SOCIAL_ICONS = {
149149
} as const;
150150

151151
export const ICONS = {
152-
...STANDART_ICONS,
152+
...STANDARD_ICONS,
153153
...STATUS_ICONS,
154154
...ADDITIONAL_ICONS,
155155
...SOCIAL_ICONS,

0 commit comments

Comments
 (0)