File tree Expand file tree Collapse file tree 5 files changed +55
-32
lines changed Expand file tree Collapse file tree 5 files changed +55
-32
lines changed Original file line number Diff line number Diff line change 1
1
---
2
- export interface Props {
2
+ import { cn } from ' @/utils/styles' ;
3
+
4
+ import type { HTMLAttributes } from ' astro/types' ;
5
+
6
+ export interface Props extends HTMLAttributes <' details' > {
3
7
title: string ;
4
8
}
5
9
6
- const { title } = Astro .props as Props ;
10
+ const { title, class : className, ... props } = Astro .props as Props ;
7
11
---
8
12
9
- <details class =" group mx-2 rounded-lg bg-slate-200 p-8 px-4 py-1 dark:bg-slate-800 sm:mx-4" >
10
- <summary
11
- class =" cursor-pointer text-purple-600 no-underline outline-none hover:underline hover:decoration-4 hover:underline-offset-2 focus:underline focus:decoration-4 focus:underline-offset-4 dark:text-purple-400"
12
- >
13
- <span
14
- class =" bg-gradient-to-br from-blue-700 to-purple-600 bg-clip-text font-bold text-transparent dark:from-blue-400 dark:to-purple-400"
15
- >{ title } </span
16
- >
13
+ <details {... props } class ={ cn (' rounded-button bg-base-200 px-4 py-1' , className )} >
14
+ <summary class =" cursor-pointer" >
15
+ <span class =" font-semibold" >{ title } </span >
17
16
</summary >
18
17
<slot />
19
18
</details >
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ ---
2
+ layout : ' ../../layouts/Page.astro'
3
+ title : Other components
4
+ ---
5
+
6
+
7
+ import Details from ' ../../components/Details.astro' ;
8
+ import Alert from ' ../../components/Alert.astro' ;
9
+
10
+ back to [ Index] ( /design )
11
+
12
+ ## Details
13
+
14
+ <Details title = " This is the title" >
15
+ These are the details.
16
+ </Details >
17
+
18
+ export const alerts = {
19
+ variant: [
20
+ { variant: ' note' },
21
+ { variant: ' info' },
22
+ { variant: ' tip' },
23
+ { variant: ' warning' },
24
+ { variant: ' danger' },
25
+ ],
26
+ };
27
+
28
+ ## Alerts
29
+
30
+ { Object .entries (alerts ).map (([key , values ]) => (
31
+ <>
32
+ <h4 >{ key } </h4 >
33
+ <div >
34
+ { values .map ((props ) => {
35
+ const item = ` ${Object .values (props )[0 ]} ` ;
36
+ const text = ` This is some ${item } text. ` ;
37
+
38
+ return <Alert { ... props } >{ text } </Alert >;
39
+ })}
40
+ </div >
41
+ </>
42
+ ))}
Original file line number Diff line number Diff line change @@ -10,4 +10,5 @@ title: Design system
10
10
- [ Colors] ( /design/colors )
11
11
- [ Images] ( /design/images )
12
12
- [ Embeds] ( /design/embeds )
13
+ - [ Components] ( /design/components )
13
14
- [ Typography] ( /design/typography )
Original file line number Diff line number Diff line change 1
1
@layer components {
2
2
.alert {
3
- @apply mb-4 mx-8 md:mx-auto px-4 py-1 rounded-button;
3
+ @apply px-4 py-1 rounded-button;
4
4
5
5
& p {
6
6
@apply my-0;
7
7
}
8
8
}
9
+
10
+ /* extract into semantic colors maybe in future */
9
11
.alert--note {
10
12
/* use base-200-300 here */
11
13
@apply bg-slate-100 border border-slate-200 dark:border-slate-800 dark:bg-slate-900;
You can’t perform that action at this time.
0 commit comments