Skip to content

Commit f5a89fe

Browse files
chore: add DIAL_ICON_SIZE constant (#541)
1 parent be511a5 commit f5a89fe

File tree

22 files changed

+114
-68
lines changed

22 files changed

+114
-68
lines changed

src/components/Alert/Alert.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
alertVariantClassNameMap,
1717
variantIcons,
1818
} from './constants';
19+
import { DIAL_ICON_SIZE } from '@/constants/icon';
1920

2021
export interface DialAlertProps extends HTMLAttributes<HTMLDivElement> {
2122
variant?: AlertVariant;
@@ -100,7 +101,7 @@ export const DialAlert: FC<DialAlertProps> = ({
100101
<DialButton
101102
className="ml-2 text-secondary hover:text-primary"
102103
aria-label="Close alert"
103-
iconBefore={<IconX size={16} />}
104+
iconBefore={<IconX size={DIAL_ICON_SIZE.SM} />}
104105
onClick={onClose}
105106
/>
106107
)}

src/components/Breadcrumb/Breadcrumb.stories.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DialBreadcrumb } from './Breadcrumb';
44
import { DialBreadcrumbItem } from './BreadcrumbItem';
55
import { IconFolder } from '@tabler/icons-react';
66
import { useState } from 'react';
7+
import { DIAL_ICON_SIZE } from '@/constants/icon';
78

89
const meta = {
910
title: 'Navigation/Breadcrumb',
@@ -183,7 +184,7 @@ export const WithFolderIcons: Story = {
183184
<DialBreadcrumbItem
184185
label="Projects"
185186
href="#"
186-
iconBefore={<IconFolder size={16} aria-label="folder" />}
187+
iconBefore={<IconFolder size={DIAL_ICON_SIZE.SM} aria-label="folder" />}
187188
onClick={(e) => {
188189
e.preventDefault();
189190
alert('Clicked Projects folder');
@@ -192,15 +193,15 @@ export const WithFolderIcons: Story = {
192193
<DialBreadcrumbItem
193194
label="2025"
194195
href="#"
195-
iconBefore={<IconFolder size={16} aria-label="folder" />}
196+
iconBefore={<IconFolder size={DIAL_ICON_SIZE.SM} aria-label="folder" />}
196197
onClick={(e) => {
197198
e.preventDefault();
198199
alert('Clicked 2025 folder');
199200
}}
200201
/>
201202
<DialBreadcrumbItem
202203
label="Design System"
203-
iconBefore={<IconFolder size={16} aria-label="folder" />}
204+
iconBefore={<IconFolder size={DIAL_ICON_SIZE.SM} aria-label="folder" />}
204205
onClick={(e) => {
205206
e.preventDefault();
206207
alert('Clicked Design System folder');

src/components/Breadcrumb/Breadcrumb.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type {
2020
import { DialDropdown } from '@/components/Dropdown/Dropdown';
2121
import { IconDots } from '@tabler/icons-react';
2222
import type { DropdownItem } from '@/models/dropdown';
23+
import { DIAL_ICON_SIZE } from '@/constants/icon';
2324

2425
export interface DialBreadcrumbProps {
2526
pathItems?: DialBreadcrumbPathItem[];
@@ -176,7 +177,7 @@ export const DialBreadcrumb: FC<DialBreadcrumbProps> = ({
176177
aria-label="More breadcrumbs"
177178
className={breadcrumbEllipsisButtonClassName}
178179
>
179-
<IconDots size={16} />
180+
<IconDots size={DIAL_ICON_SIZE.SM} />
180181
</button>
181182
</DialDropdown>
182183
<span className={breadcrumbSeparatorClassName}>{separator}</span>

src/components/Breadcrumb/constants.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { ReactNode } from 'react';
22
import { IconChevronRight } from '@tabler/icons-react';
3+
import { DIAL_ICON_SIZE } from '@/constants/icon';
34

45
export const breadcrumbBaseClassName = 'w-full overflow-hidden';
56
export const breadcrumbListClassName =
@@ -27,5 +28,5 @@ export const breadcrumbEllipsisButtonClassName =
2728
'items-center gap-1 min-w-0 transition-colors text-secondary hover:text-accent-primary';
2829

2930
export const defaultSeparator: ReactNode = (
30-
<IconChevronRight size={16} aria-hidden="true" />
31+
<IconChevronRight size={DIAL_ICON_SIZE.SM} aria-hidden="true" />
3132
);

src/components/Button/Button.stories.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
DialPrimaryButton,
1212
} from './ButtonWrappers';
1313
import { ElementSize } from '@/types/size';
14+
import { DIAL_ICON_SIZE } from '@/constants/icon';
1415

1516
const meta = {
1617
title: 'DIAL/Elements/Buttons/Button',
@@ -200,14 +201,14 @@ export const AllVariants: Story = {
200201
render: () => {
201202
const baseProps: DialButtonProps = {
202203
label: 'Standard',
203-
iconAfter: <IconArrowRight size={20} />,
204-
iconBefore: <IconArrowLeft size={20} />,
204+
iconAfter: <IconArrowRight size={DIAL_ICON_SIZE.MD} />,
205+
iconBefore: <IconArrowLeft size={DIAL_ICON_SIZE.MD} />,
205206
};
206207

207208
const smallProps: DialButtonProps = {
208209
label: 'Small',
209-
iconAfter: <IconArrowRight size={16} />,
210-
iconBefore: <IconArrowLeft size={16} />,
210+
iconAfter: <IconArrowRight size={DIAL_ICON_SIZE.SM} />,
211+
iconBefore: <IconArrowLeft size={DIAL_ICON_SIZE.SM} />,
211212
size: ElementSize.Small,
212213
};
213214

@@ -299,15 +300,15 @@ export const WithIconsBeforeAfter: Story = {
299300
args: {
300301
label: 'With Icons',
301302
variant: ButtonVariant.Primary,
302-
iconBefore: <IconArrowLeft size={20} />,
303-
iconAfter: <IconArrowRight size={20} />,
303+
iconBefore: <IconArrowLeft size={DIAL_ICON_SIZE.MD} />,
304+
iconAfter: <IconArrowRight size={DIAL_ICON_SIZE.MD} />,
304305
},
305306
};
306307

307308
export const IconOnlyButton: Story = {
308309
args: {
309310
variant: ButtonVariant.Primary,
310-
iconBefore: <IconArrowRight size={20} />,
311+
iconBefore: <IconArrowRight size={DIAL_ICON_SIZE.MD} />,
311312
'aria-label': 'Next',
312313
},
313314
parameters: {
@@ -325,8 +326,8 @@ export const HideTitleOnMobile: Story = {
325326
label: 'Hidden on mobile',
326327
variant: ButtonVariant.Primary,
327328
hideTitleOnMobile: true,
328-
iconBefore: <IconArrowLeft size={20} />,
329-
iconAfter: <IconArrowRight size={20} />,
329+
iconBefore: <IconArrowLeft size={DIAL_ICON_SIZE.MD} />,
330+
iconAfter: <IconArrowRight size={DIAL_ICON_SIZE.MD} />,
330331
},
331332
parameters: {
332333
docs: {
@@ -366,7 +367,7 @@ export const LinkWrapperButton: Story = {
366367
render: (args) => <DialLinkButton {...args} />,
367368
args: {
368369
label: 'Link Button',
369-
iconAfter: <IconArrowRight size={20} />,
370+
iconAfter: <IconArrowRight size={DIAL_ICON_SIZE.MD} />,
370371
},
371372
parameters: {
372373
docs: {
@@ -382,7 +383,7 @@ export const GhostWrapperButton: Story = {
382383
render: (args) => <DialGhostButton {...args} />,
383384
args: {
384385
label: 'Ghost Button',
385-
iconBefore: <IconArrowLeft size={20} />,
386+
iconBefore: <IconArrowLeft size={DIAL_ICON_SIZE.MD} />,
386387
},
387388
parameters: {
388389
docs: {
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1+
import { DIAL_ICON_SIZE } from '@/constants/icon';
12
import { IconChevronDown, IconChevronUp } from '@tabler/icons-react';
23

3-
export const buttonChevronDown = <IconChevronDown size={16} />;
4-
export const buttonChevronUp = <IconChevronUp size={16} />;
4+
export const buttonChevronDown = <IconChevronDown size={DIAL_ICON_SIZE.SM} />;
5+
export const buttonChevronUp = <IconChevronUp size={DIAL_ICON_SIZE.SM} />;

src/components/CollapsibleSidebar/CollapsibleSidebar.stories.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
type DialCollapsibleSidebarProps,
88
} from './CollapsibleSidebar';
99
import { DialButton } from '@/components/Button/Button';
10+
import { BASE_ICON_SIZE } from '@/constants/icon';
1011

1112
const BarContent = (
1213
<div className="flex flex-col gap-4">
@@ -94,7 +95,7 @@ export const WithAdditionalButtons: Story = {
9495
children: BarContent,
9596
additionalButtons: (
9697
<DialButton
97-
iconBefore={<IconSettings size={18} />}
98+
iconBefore={<IconSettings size={BASE_ICON_SIZE} />}
9899
onClick={() => alert('Settings clicked!')}
99100
className="hover:text-accent-primary"
100101
/>
@@ -126,7 +127,7 @@ export const AllVariants: Story = {
126127
children: BarContent,
127128
additionalButtons: (
128129
<DialButton
129-
iconBefore={<IconSettings size={18} />}
130+
iconBefore={<IconSettings size={BASE_ICON_SIZE} />}
130131
onClick={() => alert('Settings clicked!')}
131132
/>
132133
),

src/components/Dropdown/Dropdown.stories.tsx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,64 @@ import {
2222
DialPrimaryButton,
2323
} from '@/components/Button/ButtonWrappers';
2424
import { type DropdownItem } from '@/models/dropdown';
25+
import { DIAL_ICON_SIZE } from '@/constants/icon';
2526

2627
const items: DropdownItem[] = [
27-
{ key: 'profile', label: 'Profile', icon: <IconUser size={16} /> },
28-
{ key: 'settings', label: 'Settings', icon: <IconSettings size={16} /> },
28+
{
29+
key: 'profile',
30+
label: 'Profile',
31+
icon: <IconUser size={DIAL_ICON_SIZE.SM} />,
32+
},
33+
{
34+
key: 'settings',
35+
label: 'Settings',
36+
icon: <IconSettings size={DIAL_ICON_SIZE.SM} />,
37+
},
2938
{
3039
key: 'disabled',
3140
label: 'Disabled',
32-
icon: <IconStack size={16} />,
41+
icon: <IconStack size={DIAL_ICON_SIZE.SM} />,
3342
disabled: true,
3443
},
3544
{
3645
key: 'danger',
3746
label: 'Danger',
38-
icon: <IconRowRemove size={16} />,
47+
icon: <IconRowRemove size={DIAL_ICON_SIZE.SM} />,
3948
danger: true,
4049
},
4150
{ key: 'd1', type: DropdownItemType.Divider },
4251
{
4352
key: 'logout',
4453
label: 'Logout',
45-
icon: <IconLogout size={16} />,
54+
icon: <IconLogout size={DIAL_ICON_SIZE.SM} />,
4655
},
4756
];
4857

4958
const specItems: DropdownItem[] = [
5059
{
5160
key: 'open',
5261
label: 'Open in a new tab',
53-
icon: <IconExternalLink size={16} />,
62+
icon: <IconExternalLink size={DIAL_ICON_SIZE.SM} />,
5463
},
5564
{
5665
key: 'dup',
5766
label: 'Duplicate as a new version',
58-
icon: <IconCopy size={16} />,
67+
icon: <IconCopy size={DIAL_ICON_SIZE.SM} />,
5968
},
6069
{ key: 'd2', type: DropdownItemType.Divider },
61-
{ key: 'del', label: 'Delete', icon: <IconTrash size={16} />, danger: true },
70+
{
71+
key: 'del',
72+
label: 'Delete',
73+
icon: <IconTrash size={DIAL_ICON_SIZE.SM} />,
74+
danger: true,
75+
},
6276
];
6377

6478
const TriggerBtn = ({ label = 'Open' }: { label?: ReactNode }) => (
65-
<DialPrimaryButton iconAfter={<IconChevronDown size={16} />} label={label} />
79+
<DialPrimaryButton
80+
iconAfter={<IconChevronDown size={DIAL_ICON_SIZE.SM} />}
81+
label={label}
82+
/>
6683
);
6784

6885
const PLACEMENTS: Placement[] = [
@@ -193,7 +210,7 @@ export const SecondaryEllipsisTrigger: Story = {
193210
children: (
194211
<DialNeutralButton
195212
aria-label="More actions"
196-
iconBefore={<IconDots size={16} />}
213+
iconBefore={<IconDots size={DIAL_ICON_SIZE.SM} />}
197214
/>
198215
),
199216
menu: { items: specItems },

src/components/FileManager/components/ConflictResolutionPopup/ConflictResolutionPopup.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
DialFileManagerConflictActions,
2525
DialFileManagerConflictStrategies,
2626
} from '@/types/file-manager';
27+
import { DIAL_ICON_SIZE } from '@/constants/icon';
2728

2829
export interface FileConflictDecision {
2930
file: DialFile;
@@ -321,7 +322,7 @@ export const ConflictResolutionPopup: FC<ConflictResolutionPopupProps> = ({
321322
{activeItem?.label ?? replaceLabel}
322323
</span>
323324
<IconChevronDown
324-
size={16}
325+
size={DIAL_ICON_SIZE.SM}
325326
className={classNames(
326327
'text-secondary transition-transform',
327328
isOpen && 'rotate-180',

src/components/FileManager/hooks/use-tree-additional-buttons.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { mergeClasses } from '@/utils/merge-classes';
33
import { IconCopyMinus } from '@tabler/icons-react';
44
import { useMemo, type ReactNode } from 'react';
55
import { ElementSize } from '@/types/size';
6+
import { DIAL_ICON_SIZE } from '@/constants/icon';
67

78
interface useTreeAdditionalButtonsOptions {
89
additionalButtons?: ReactNode;
@@ -44,7 +45,7 @@ export const useTreeAdditionalButtons = ({
4445
className={buttonClass}
4546
size={ElementSize.Small}
4647
onClick={collapseAll}
47-
icon={<IconCopyMinus size={24} stroke={1.5} />}
48+
icon={<IconCopyMinus size={DIAL_ICON_SIZE.LG} stroke={1.5} />}
4849
aria-label="collapse-all"
4950
/>
5051
</>

0 commit comments

Comments
 (0)