Skip to content

Commit

Permalink
fix icon sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitayutanov committed Jan 17, 2025
1 parent e0317a0 commit d08132e
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 35 deletions.
7 changes: 0 additions & 7 deletions utils/vara-ui/src/components/alert/alert.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,7 @@
}

.button {
@include lightDark(color, #000, #fff);

margin-left: auto;

svg {
width: 20px;
height: 20px;
}
}

.body {
Expand Down
4 changes: 3 additions & 1 deletion utils/vara-ui/src/components/alert/alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function Alert({ alert, close }: Props) {
<SVG className={styles.icon} />
<h2 className={styles.title}>{title || type}</h2>

{isClosed && <Button icon={CrossSVG} color="transparent" className={styles.button} onClick={close} />}
{isClosed && (
<Button icon={CrossSVG} color="transparent" size="medium" className={styles.button} onClick={close} />
)}
</header>

<div className={styles.body}>{content}</div>
Expand Down
33 changes: 19 additions & 14 deletions utils/vara-ui/src/components/button/button.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
gap: 8px;
}

.button {
Expand All @@ -26,7 +26,7 @@

font-size: var(--font-size, 16px);
font-weight: 600;
line-height: 1;
line-height: var(--icon-size);
color: var(--color, #000);

background-color: var(--background-color, transparent);
Expand Down Expand Up @@ -67,8 +67,8 @@
}

.icon {
width: 1em;
height: 1em;
width: var(--icon-size);
height: var(--icon-size);

&,
* {
Expand Down Expand Up @@ -191,7 +191,7 @@
}

.transparent {
--spinner-size: 16px;
--padding: 0 !important; // overriding size classes

@include darkMode() {
--color: #fff;
Expand All @@ -203,52 +203,57 @@
}

&:not(.loading):disabled {
--background-color: transparent;
@include lightDark(--background-color, transparent, transparent);
}
}

.x-small {
--padding: 8px 16px;
--spinner-size: 20px;
--icon-size: 16px;

&.noText {
--padding: 8px;
}
}

.small {
--padding: 12px 24px;
--padding: 10px 24px;
--spinner-size: 20px;
--icon-size: 20px;

&.noText {
--padding: 12px;
--padding: 10px;
}
}

.medium {
--padding: 14px 24px;
--padding: 12px 24px;
--spinner-size: 24px;
--icon-size: 20px;

&.noText {
--padding: 14px;
--padding: 12px;
}
}

.default {
--padding: 16px 24px;
--padding: 12px 24px;
--spinner-size: 24px;
--icon-size: 24px;

&.noText {
--padding: 16px;
--padding: 12px;
}
}

.x-large {
--padding: 17px 28px;
--padding: 14px 28px;
--spinner-size: 24px;
--font-size: 18px;
--icon-size: 24px;

&.noText {
--padding: 17px;
--padding: 14px;
}
}
15 changes: 9 additions & 6 deletions utils/vara-ui/src/components/button/button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const meta: Meta<Type> = {
title: 'Button',
component: Button,
args: {
children: 'Click me!',
text: 'Click me!',
color: 'primary',
size: 'default',
disabled: false,
Expand All @@ -25,11 +25,11 @@ const meta: Meta<Type> = {
noWrap: { control: 'boolean' },
size: {
options: ['x-small', 'small', 'medium', 'default', 'x-large'],
control: { type: 'select' },
control: { type: 'radio' },
},
color: {
options: ['primary', 'plain', 'contrast', 'grey', 'border', 'transparent', 'danger'],
control: { type: 'select' },
control: { type: 'radio' },
},
},
};
Expand All @@ -41,10 +41,13 @@ const Transparent: Story = { args: { color: 'transparent' } };
const Contrast: Story = { args: { color: 'contrast' } };
const Blend: Story = { args: { color: 'plain' } };
const Danger: Story = { args: { color: 'danger' } };
const NoText: Story = { args: { color: 'primary', children: undefined, icon: CrossSVG } };
const WithChildrenAndIcons: Story = {
const Icon: Story = { args: { color: 'primary', text: undefined, icon: CrossSVG } };
const IconAndText: Story = { args: { color: 'primary', icon: CrossSVG } };

const Children: Story = {
args: {
color: 'primary',
text: undefined,
children: (
<>
<CrossSVG />
Expand All @@ -56,4 +59,4 @@ const WithChildrenAndIcons: Story = {
};

export default meta;
export { Default, Border, Grey, Transparent, Contrast, Blend, Danger, NoText, WithChildrenAndIcons };
export { Default, Border, Grey, Transparent, Contrast, Blend, Danger, Icon, IconAndText, Children };
2 changes: 1 addition & 1 deletion utils/vara-ui/src/components/button/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const Button = forwardRef<HTMLButtonElement, Props>((props, ref) => {
className={cx(
styles.button,
styles[color],
color !== 'transparent' && styles[size],
styles[size],
isLoading && styles.loading,
!text && !children && styles.noText,
block && styles.block,
Expand Down
5 changes: 0 additions & 5 deletions utils/vara-ui/src/components/modal/modal.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@
}
}

.button svg {
width: 20px;
height: 20px;
}

.body,
.footer {
@include lightDark(color, #000, rgba(246, 246, 246, 0.8));
Expand Down
2 changes: 1 addition & 1 deletion utils/vara-ui/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const Modal = ({ heading, close, children, className, headerAddon, footer, maxWi
{headerAddon}
</div>

<Button icon={CrossSVG} color="transparent" onClick={close} className={styles.button} />
<Button icon={CrossSVG} color="transparent" size="medium" onClick={close} />
</header>

{children && (
Expand Down

0 comments on commit d08132e

Please sign in to comment.