Skip to content

Commit b048048

Browse files
committed
✨Add transparent badges
1 parent d3dfeef commit b048048

File tree

7 files changed

+91
-0
lines changed

7 files changed

+91
-0
lines changed

src/components/Badge/Badge.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
hover,
1111
small,
1212
rounded,
13+
transparent,
1314
className,
1415
...rest
1516
} = Astro.props
@@ -20,6 +21,7 @@ const classes = [
2021
hover && styles.hover,
2122
small && styles.small,
2223
rounded && styles.round,
24+
transparent && styles.transparent,
2325
className
2426
]
2527
---

src/components/Badge/Badge.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
hover,
1111
small,
1212
rounded,
13+
transparent,
1314
className,
1415
onClick,
1516
children,
@@ -22,6 +23,7 @@
2223
(onClick || hover) && styles.hover,
2324
small && styles.small,
2425
rounded && styles.round,
26+
transparent && styles.transparent,
2527
className
2628
])
2729
</script>

src/components/Badge/Badge.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const Badge = ({
1111
hover,
1212
small,
1313
rounded,
14+
transparent,
1415
className,
1516
children,
1617
...rest
@@ -21,6 +22,7 @@ const Badge = ({
2122
(onClick || hover) && styles.hover,
2223
small && styles.small,
2324
rounded && styles.round,
25+
transparent && styles.transparent,
2426
className
2527
])
2628

src/components/Badge/badge.module.scss

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,30 @@
9191
&.round {
9292
@include border-radius(lg);
9393
}
94+
95+
&.transparent {
96+
@include background(transparent);
97+
@include typography(primary);
98+
@include spacing(p0);
99+
100+
&.secondary {
101+
@include typography(primary-20);
102+
}
103+
104+
&.info {
105+
@include typography(info);
106+
}
107+
108+
&.success {
109+
@include typography(success);
110+
}
111+
112+
&.warning {
113+
@include typography(warning);
114+
}
115+
116+
&.alert {
117+
@include typography(alert);
118+
}
119+
}
94120
}

src/components/Badge/badge.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export type BadgeProps = {
1212
hover?: boolean
1313
small?: boolean
1414
rounded?: boolean
15+
transparent?: boolean
1516
className?: string
1617
[key: string]: any
1718
}

src/pages/components/badge.astro

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,64 @@ const sections = getSections({
133133
</section.component>
134134
</ComponentWrapper>
135135

136+
<ComponentWrapper title="Rounded + small success">
137+
<section.component theme="success" rounded={true} small={true}>
138+
Success
139+
</section.component>
140+
</ComponentWrapper>
141+
142+
<ComponentWrapper title="Rounded + small warning">
143+
<section.component theme="warning" rounded={true} small={true}>
144+
Warning
145+
</section.component>
146+
</ComponentWrapper>
147+
148+
<ComponentWrapper title="Rounded + small alert">
149+
<section.component theme="alert" rounded={true} small={true}>
150+
Alert
151+
</section.component>
152+
</ComponentWrapper>
153+
154+
<ComponentWrapper title="Transparent">
155+
<section.component transparent={true}>
156+
Transparent
157+
</section.component>
158+
</ComponentWrapper>
159+
160+
<ComponentWrapper title="Transparent secondary">
161+
<section.component theme="secondary" transparent={true}>
162+
Secondary
163+
</section.component>
164+
</ComponentWrapper>
165+
166+
<ComponentWrapper title="Transparent info">
167+
<section.component theme="info" transparent={true}>
168+
<Icon type="info" size={14} />
169+
Info
170+
</section.component>
171+
</ComponentWrapper>
172+
173+
<ComponentWrapper title="Transparent success">
174+
<section.component theme="success" transparent={true}>
175+
<Icon type="circle-check" size={14} />
176+
Success
177+
</section.component>
178+
</ComponentWrapper>
179+
180+
<ComponentWrapper title="Transparent warning">
181+
<section.component theme="warning" transparent={true}>
182+
<Icon type="warning" size={14} />
183+
Warning
184+
</section.component>
185+
</ComponentWrapper>
186+
187+
<ComponentWrapper title="Transparent alert">
188+
<section.component theme="alert" transparent={true}>
189+
<Icon type="alert" size={14} />
190+
Alert
191+
</section.component>
192+
</ComponentWrapper>
193+
136194
<ComponentWrapper title="Chips (removable badge)">
137195
<section.component
138196
theme="outline"
73.3 KB
Loading

0 commit comments

Comments
 (0)