1
1
import { component$ , PropsOf , Slot } from '@builder.io/qwik' ;
2
+ import { cn } from '@qwik-ui/utils' ;
2
3
3
4
export enum NoteStatus {
4
5
Info = 'info' ,
5
6
Warning = 'warning' ,
6
- Caution = 'caution ' ,
7
+ Alert = 'alert ' ,
7
8
}
8
9
9
- export interface NoteProps {
10
+ export type NoteProps = {
10
11
status ?: NoteStatus ;
11
- }
12
+ } ;
12
13
13
14
function getIconByStatus ( status ?: NoteStatus ) {
14
15
switch ( status ) {
15
16
case NoteStatus . Info :
16
17
return < InfoIcon class = "text-primary" /> ;
17
18
case NoteStatus . Warning :
18
19
return < WarningIcon class = "text-yellow-400" /> ;
19
- case NoteStatus . Caution :
20
- return < CautionIcon class = "text-destructive " /> ;
20
+ case NoteStatus . Alert :
21
+ return < AlertIcon class = "text-alert " /> ;
21
22
22
23
default :
23
24
return < InfoIcon class = "text-primary" /> ;
@@ -30,26 +31,27 @@ function getBackgroundByStatus(status?: NoteStatus) {
30
31
return 'bg-primary/30 border-primary border-l-2 mb-4 rounded-base block' ;
31
32
case NoteStatus . Warning :
32
33
return 'bg-yellow-400/30 border-yellow-400 border-l-2 mb-4 rounded-base block' ;
33
- case NoteStatus . Caution :
34
- return 'bg-destructive /30 border-destructive border-l-2 mb-4 rounded-base block' ;
34
+ case NoteStatus . Alert :
35
+ return 'bg-alert /30 border-alert border-l-2 mb-4 rounded-base block' ;
35
36
default :
36
37
return 'bg-primary/30 border-primary border-l-2 mb-4 rounded-base block' ;
37
38
}
38
39
}
39
40
40
- export const Note = component$ < NoteProps > ( ( { status, ... props } ) => {
41
+ export const Note = component$ < NoteProps > ( ( { status } ) => {
41
42
return (
42
43
< aside
43
- class = { `${ getBackgroundByStatus (
44
- status ?? NoteStatus . Info ,
45
- ) } note-link relative px-5 py-4 lg:px-8 lg:py-6 `}
44
+ class = { cn (
45
+ getBackgroundByStatus ( status ?? NoteStatus . Info ) ,
46
+ 'note-link relative mx-2 my-12 px-5 py-4 lg:px-8 lg:py-6' ,
47
+ ) }
46
48
>
47
49
< div class = "absolute left-[-17.5px] top-[-17.5px] hidden h-8 w-8 rounded-full bg-white dark:bg-slate-900 lg:block" >
48
50
< div class = "flex h-8 w-8 items-center justify-center " >
49
51
{ getIconByStatus ( status ?? NoteStatus . Info ) }
50
52
</ div >
51
53
</ div >
52
- < blockquote { ... props } >
54
+ < blockquote >
53
55
< Slot />
54
56
</ blockquote >
55
57
</ aside >
@@ -92,7 +94,7 @@ export function WarningIcon(props: PropsOf<'svg'>, key: string) {
92
94
) ;
93
95
}
94
96
95
- export function CautionIcon ( props : PropsOf < 'svg' > , key : string ) {
97
+ export function AlertIcon ( props : PropsOf < 'svg' > , key : string ) {
96
98
return (
97
99
< svg
98
100
xmlns = "http://www.w3.org/2000/svg"
0 commit comments