File tree 13 files changed +66
-18
lines changed 13 files changed +66
-18
lines changed Original file line number Diff line number Diff line change 9
9
theme,
10
10
hover,
11
11
small,
12
+ rounded,
12
13
className,
13
14
... rest
14
15
} = Astro .props
@@ -18,6 +19,7 @@ const classes = [
18
19
theme && styles [theme ],
19
20
hover && styles .hover ,
20
21
small && styles .small ,
22
+ rounded && styles .round ,
21
23
className
22
24
]
23
25
---
Original file line number Diff line number Diff line change 8
8
export let theme: SvelteBadgeProps [' theme' ] = null
9
9
export let hover: SvelteBadgeProps [' hover' ] = false
10
10
export let small: SvelteBadgeProps [' small' ] = false
11
+ export let rounded: SvelteBadgeProps [' rounded' ] = false
11
12
export let className: SvelteBadgeProps [' className' ] = ' '
12
13
export let onClick: SvelteBadgeProps [' onClick' ] = () => {}
13
14
16
17
theme && styles [theme ],
17
18
(onClick || hover ) && styles .hover ,
18
19
small && styles .small ,
20
+ rounded && styles .round ,
19
21
className
20
22
])
21
23
</script >
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ const Badge = ({
10
10
onClick,
11
11
hover,
12
12
small,
13
+ rounded,
13
14
className,
14
15
children,
15
16
...rest
@@ -19,6 +20,7 @@ const Badge = ({
19
20
theme && styles [ theme ] ,
20
21
( onClick || hover ) && styles . hover ,
21
22
small && styles . small ,
23
+ rounded && styles . round ,
22
24
className
23
25
] )
24
26
Original file line number Diff line number Diff line change 87
87
& .small {
88
88
@include spacing (py- xxs, px- xs);
89
89
}
90
+
91
+ & .round {
92
+ @include border-radius (lg);
93
+ }
90
94
}
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export type BadgeProps = {
11
11
| null
12
12
hover ?: boolean
13
13
small ?: boolean
14
+ rounded ?: boolean
14
15
className ?: string
15
16
[ key : string ] : any
16
17
}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ export type IconProps = {
5
5
| 'arrow-right'
6
6
| 'check'
7
7
| 'circle-check'
8
+ | 'circle-close'
8
9
| 'close'
9
10
| 'components'
10
11
| 'file'
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import ArrowLeft from '../../icons/arrow-left.svg?raw'
4
4
import ArrowRight from '../../icons/arrow-right.svg?raw'
5
5
import Check from '../../icons/check.svg?raw'
6
6
import CircleCheck from '../../icons/circle-check.svg?raw'
7
+ import CircleClose from '../../icons/circle-close.svg?raw'
7
8
import Close from '../../icons/close.svg?raw'
8
9
import Components from '../../icons/components.svg?raw'
9
10
import File from '../../icons/file.svg?raw'
@@ -23,6 +24,7 @@ const iconMap = {
23
24
'arrow-right' : ArrowRight ,
24
25
'check' : Check ,
25
26
'circle-check' : CircleCheck ,
27
+ 'circle-close' : CircleClose ,
26
28
'close' : Close ,
27
29
'components' : Components ,
28
30
'file' : File ,
Original file line number Diff line number Diff line change @@ -31,3 +31,10 @@ export const getSections = ({
31
31
} ] : [ ] )
32
32
]
33
33
}
34
+
35
+ export const on = ( element , callback ) => {
36
+ // eslint-disable-next-line no-undef
37
+ document
38
+ . querySelector ( element )
39
+ ?. addEventListener ( 'click' , callback )
40
+ }
Original file line number Diff line number Diff line change @@ -114,6 +114,42 @@ const sections = getSections({
114
114
Alert
115
115
</section.component >
116
116
</ComponentWrapper >
117
+
118
+ <ComponentWrapper title = " Rounded success" >
119
+ <section.component theme = " success" rounded = { true } >
120
+ Success
121
+ </section.component >
122
+ </ComponentWrapper >
123
+
124
+ <ComponentWrapper title = " Rounded warning" >
125
+ <section.component theme = " warning" rounded = { true } >
126
+ Warning
127
+ </section.component >
128
+ </ComponentWrapper >
129
+
130
+ <ComponentWrapper title = " Rounded alert" >
131
+ <section.component theme = " alert" rounded = { true } >
132
+ Alert
133
+ </section.component >
134
+ </ComponentWrapper >
135
+
136
+ <ComponentWrapper title = " Chips (removable badge)" >
137
+ <section.component
138
+ theme = " outline"
139
+ hover = { true }
140
+ rounded = { true }
141
+ className = " remove"
142
+ >
143
+ <Icon type = " circle-close" size = { 14 } />
144
+ Click to remove
145
+ </section.component >
146
+ </ComponentWrapper >
117
147
</div >
118
148
))}
119
149
</Layout >
150
+
151
+ <script >
152
+ import { on } from '@helpers'
153
+
154
+ on('.remove', (event: any) => event.currentTarget.remove())
155
+ </script >
Original file line number Diff line number Diff line change @@ -188,7 +188,7 @@ const sections = getSections({
188
188
</section.component >
189
189
</ComponentWrapper >
190
190
191
- <ComponentWrapper title = " Info modal" >
191
+ <ComponentWrapper title = " Warning modal" >
192
192
<Button theme = " warning" id = { ` modal-btn-8${index } ` } >
193
193
Trigger
194
194
</Button >
@@ -202,7 +202,7 @@ const sections = getSections({
202
202
</section.component >
203
203
</ComponentWrapper >
204
204
205
- <ComponentWrapper title = " Info modal" >
205
+ <ComponentWrapper title = " Alert modal" >
206
206
<Button theme = " alert" id = { ` modal-btn-9${index } ` } >
207
207
Trigger
208
208
</Button >
@@ -222,11 +222,7 @@ const sections = getSections({
222
222
<script >
223
223
import { closeModal, modal } from '@utils/modal'
224
224
225
- const on = (element: string, callback: () => any) => {
226
- document
227
- .querySelector(element)
228
- ?.addEventListener('click', callback)
229
- }
225
+ import { on } from '@helpers'
230
226
231
227
const selectors = [
232
228
'astro',
Original file line number Diff line number Diff line change @@ -206,11 +206,7 @@ const sections = getSections({
206
206
<script >
207
207
import { closeModal, modal } from '@utils/modal'
208
208
209
- const on = (element: string, callback: () => any) => {
210
- document
211
- .querySelector(element)
212
- ?.addEventListener('click', callback)
213
- }
209
+ import { on } from '@helpers'
214
210
215
211
const selectors = [
216
212
'astro',
Original file line number Diff line number Diff line change @@ -157,13 +157,9 @@ const sections = getSections({
157
157
toast
158
158
} from '@utils/toast'
159
159
160
- setDefaultTimeout(3000)
160
+ import { on } from '@helpers'
161
161
162
- const on = (element: string, callback: () => any) => {
163
- document
164
- .querySelector(element)
165
- ?.addEventListener('click', callback)
166
- }
162
+ setDefaultTimeout(3000)
167
163
168
164
const ids = Array(13).fill(10).map((x, index) => x * (index + 1))
169
165
const buttons = [
You can’t perform that action at this time.
0 commit comments