Skip to content

Commit ce1dafe

Browse files
committed
remove button size=lg and tag size=lg
1 parent b3245b8 commit ce1dafe

File tree

5 files changed

+37
-31
lines changed

5 files changed

+37
-31
lines changed

src/components/Button.astro

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { cva } from 'class-variance-authority';
44
import type { HTMLAttributes } from 'astro/types';
55
import type { VariantProps } from 'class-variance-authority';
66
7-
const linkVariants = cva('button-default', {
7+
const buttonVariants = cva('button', {
88
variants: {
99
variant: {
1010
outline: 'button-outline',
@@ -14,7 +14,7 @@ const linkVariants = cva('button-default', {
1414
primary: 'button-primary',
1515
default: 'button-default',
1616
},
17-
size: { sm: 'button-sm', md: 'button-md', lg: 'button-lg' },
17+
size: { sm: 'button-sm', md: 'button-md' },
1818
disabled: { true: 'button-disabled' },
1919
},
2020
compoundVariants: [
@@ -25,7 +25,7 @@ const linkVariants = cva('button-default', {
2525
],
2626
});
2727
28-
export interface Props extends HTMLAttributes<'a'>, VariantProps<typeof linkVariants> {}
28+
export interface Props extends HTMLAttributes<'a'>, VariantProps<typeof buttonVariants> {}
2929
3030
const {
3131
class: className,
@@ -39,7 +39,7 @@ const {
3939
const Element = disabled ? 'span' : 'a';
4040
---
4141

42-
<Element {...props} class={linkVariants({ variant, colors, size, disabled, className })}>
42+
<Element {...props} class={buttonVariants({ variant, colors, size, disabled, className })}>
4343
<slot name="before-icon" />
4444
<span class="inline-block">
4545
<slot />

src/components/Tag.astro

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@ const tagVariants = cva('tag', {
1414
default: '',
1515
primary: 'tag-primary',
1616
},
17-
size: { sm: 'tag-sm', md: 'tag-md', lg: 'tag-lg' },
17+
size: { sm: 'tag-sm', md: 'tag-md' },
1818
},
1919
compoundVariants: [
2020
{ variant: 'solid', size: 'sm', class: 'tag-solid-sm' },
2121
{ variant: 'solid', size: 'md', class: 'tag-solid-md' },
22-
{ variant: 'solid', size: 'lg', class: 'tag-solid-lg' },
2322
{ variant: 'solid', colors: 'primary', class: 'tag-solid-primary' },
2423
],
2524
});

src/pages/design/buttons.mdx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
layout: '../../layouts/Page.astro'
33
title: Buttons, Links, Tags
44
---
5+
import { Icon } from 'astro-icon/components';
56

67
import Button from '../../components/Button.astro';
78
import Link from '../../components/Link.astro';
@@ -17,7 +18,7 @@ export const buttons = {
1718
{ variant: 'solid', colors: 'default' },
1819
],
1920
colors: [{ colors: 'primary' }, { colors: 'default' }],
20-
size: [{ size: 'lg' }, { size: 'md' }, { size: 'sm' }],
21+
size: [{ size: 'md' }, { size: 'sm' }],
2122
disabled: [{ disabled: true }, { disabled: false }],
2223
};
2324

@@ -32,11 +33,28 @@ export const buttons = {
3233

3334
return <Button {...props}>{text}</Button>;
3435
})}
35-
3636
</div>
3737
</>
3838
))}
3939

40+
#### slot="before-icon"
41+
42+
<div class="not-prose">
43+
<Button colors="primary" size="sm">
44+
<Icon name="mdi:fish" slot="before-icon" />
45+
My Button
46+
</Button>
47+
</div>
48+
49+
#### slot="after-icon"
50+
51+
<div class="not-prose">
52+
<Button colors="primary">
53+
<Icon name="mdi:fish" slot="after-icon" />
54+
My Button
55+
</Button>
56+
</div>
57+
4058
export const links = {
4159
variant: [
4260
{ variant: 'link' },
@@ -74,7 +92,12 @@ export const tags = {
7492
{ variant: 'text', colors: 'primary' },
7593
{ variant: 'text', colors: 'default' },
7694
],
77-
size: [{ size: 'lg' }, { size: 'md' }, { size: 'sm' }],
95+
size: [
96+
{ size: 'md', variant: 'solid' },
97+
{ size: 'md', variant: 'text' },
98+
{ size: 'sm', variant: 'solid' },
99+
{ size: 'sm', variant: 'text' },
100+
],
78101
};
79102

80103
## Tags

src/styles/components/button.css

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@layer components {
2-
.button-default {
2+
.button {
33
@apply inline-flex items-center gap-2 no-underline;
4-
@apply rounded-button;
4+
@apply rounded-button text-base;
55
}
66

77
.button-outline {
@@ -33,26 +33,18 @@
3333
}
3434

3535
.button-sm {
36-
@apply px-4 py-1;
36+
@apply px-3 py-0.5;
3737

3838
[data-icon] {
3939
@apply w-6 h-6;
4040
}
4141
}
4242

4343
.button-md {
44-
@apply text-lg px-5 py-2;
44+
@apply text-lg px-5 py-1.5;
4545

4646
[data-icon] {
4747
@apply w-8 h-8;
4848
}
4949
}
50-
51-
.button-lg {
52-
@apply text-lg px-6 py-3;
53-
54-
[data-icon] {
55-
@apply w-10 h-10;
56-
}
57-
}
5850
}

src/styles/components/tag.css

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,15 @@
2121
}
2222

2323
.tag-solid-sm {
24-
@apply px-2 pb-0.5;
24+
@apply px-2 py-0.5;
2525
}
2626

2727
.tag-md {
2828
@apply text-base;
2929
}
3030

3131
.tag-solid-md {
32-
@apply px-3 pt-0.5 pb-1;
33-
}
34-
35-
.tag-lg {
36-
@apply text-lg;
37-
}
38-
39-
.tag-solid-lg {
40-
@apply px-4 pt-1.5 pb-2;
32+
@apply px-3 py-1;
4133
}
4234

4335
.tag-solid-primary {

0 commit comments

Comments
 (0)