diff --git a/src/components/Badge/Badge.astro b/src/components/Badge/Badge.astro index d9e049e..a4128b5 100644 --- a/src/components/Badge/Badge.astro +++ b/src/components/Badge/Badge.astro @@ -8,6 +8,7 @@ interface Props extends BadgeProps {} const { theme, hover, + small, className, ...rest } = Astro.props @@ -16,6 +17,7 @@ const classes = [ styles.badge, theme && styles[theme], hover && styles.hover, + small && styles.small, className ] --- diff --git a/src/components/Badge/Badge.svelte b/src/components/Badge/Badge.svelte index 2f9d994..1a2279e 100644 --- a/src/components/Badge/Badge.svelte +++ b/src/components/Badge/Badge.svelte @@ -8,12 +8,14 @@ export let theme: SvelteBadgeProps['theme'] = null export let onClick: SvelteBadgeProps['onClick'] = null export let hover: SvelteBadgeProps['hover'] = false + export let small: SvelteBadgeProps['small'] = false export let className: SvelteBadgeProps['className'] = '' const classes = classNames([ styles.badge, theme && styles[theme], (onClick || hover) && styles.hover, + small && styles.small, className ]) diff --git a/src/components/Badge/Badge.tsx b/src/components/Badge/Badge.tsx index ffc835c..13986a9 100644 --- a/src/components/Badge/Badge.tsx +++ b/src/components/Badge/Badge.tsx @@ -9,6 +9,7 @@ const Badge = ({ theme, onClick, hover, + small, className, children, ...rest @@ -17,6 +18,7 @@ const Badge = ({ styles.badge, theme && styles[theme], (onClick || hover) && styles.hover, + small && styles.small, className ]) diff --git a/src/components/Badge/badge.module.scss b/src/components/Badge/badge.module.scss index 8f9358f..3f9a704 100644 --- a/src/components/Badge/badge.module.scss +++ b/src/components/Badge/badge.module.scss @@ -83,4 +83,8 @@ @include typography(alert-fg); @include background(alert); } + + &.small { + @include spacing(py-xxs, px-xs); + } } diff --git a/src/components/Badge/badge.ts b/src/components/Badge/badge.ts index 77bea9e..69c18ea 100644 --- a/src/components/Badge/badge.ts +++ b/src/components/Badge/badge.ts @@ -8,15 +8,16 @@ export type BadgeProps = { | 'alert' | null hover?: boolean + small?: boolean className?: string [key: string]: any } export type SvelteBadgeProps = { - onClick?: (() => any) | null + onClick?: ((event: MouseEvent) => void) | null } & BadgeProps export type ReactBadgeProps = { - onClick?: (() => any) | null + onClick?: (event: React.MouseEvent) => void children: React.ReactNode } & BadgeProps diff --git a/src/pages/badge.astro b/src/pages/badge.astro index 1537853..8391050 100644 --- a/src/pages/badge.astro +++ b/src/pages/badge.astro @@ -12,9 +12,7 @@ import { getSections } from '@helpers' const sections = getSections({ title: 'badges', components: [AstroBadge, SvelteBadge, ReactBadge], - props: { - onClick: () => {} - } + showSubTitle: true }) --- @@ -40,58 +38,79 @@ const sections = getSections({ {sections.map((section: any) => (

{section.title}

+ + {section.subTitle &&

} +
- + Primary - + Secondary - + Outline - + Flat - + With Icon - + Info - + Success - + Warning - + + Alert + + + + + + Success + + + + + + Warning + + + + + Alert