File tree Expand file tree Collapse file tree 13 files changed +66
-18
lines changed Expand file tree Collapse file tree 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 >
You can’t perform that action at this time.
0 commit comments