@@ -5,6 +5,8 @@ import Icon from './Icon.astro'
5
5
import { Icons } from ' ../../libs/icons'
6
6
7
7
const asideVariants = [' important' , ' info' , ' note' , ' tip' , ' warning' , ' caution' ] as const
8
+ const asideStyles = [' solid' , ' card' ] as const ;
9
+
8
10
9
11
type IconName = keyof typeof Icons ;
10
12
@@ -22,9 +24,10 @@ interface Props {
22
24
title? : string
23
25
icon? : string
24
26
open? : string ;
27
+ style? : (typeof asideStyles )[number ];
25
28
}
26
29
27
- const { type = ' note' , icon, open : openProp } = Astro .props ;
30
+ const { type = ' note' , icon, open : openProp, style = ' solid ' } = Astro .props ;
28
31
let { title } = Astro .props ;
29
32
30
33
const isCollapsible = openProp !== undefined ;
@@ -40,6 +43,14 @@ if (!asideVariants.includes(type)) {
40
43
)
41
44
}
42
45
46
+ if (style && ! asideStyles .includes (style )) {
47
+ throw new AstroError (
48
+ ' Invalid `style` prop passed to the `<Aside>` component.\n ' ,
49
+ ` Received: ${JSON .stringify (style )}
50
+ ` + ` Expected one of ${asideStyles .map ((i ) => JSON .stringify (i )).join (' , ' )} `
51
+ );
52
+ }
53
+
43
54
if (! title ) {
44
55
title = type .toUpperCase ();
45
56
}
@@ -70,6 +81,7 @@ if (icon) {
70
81
aria-label ={ title }
71
82
class:list ={ [
72
83
` aside aside-${type } ` ,
84
+ ` aside-style-${style } ` ,
73
85
{ ' is-collapsible' : isCollapsible , ' is-collapsed' : isCollapsible && ! open },
74
86
]}
75
87
>
0 commit comments