Skip to content

Commit db7fa99

Browse files
committed
docs(Note): update with alert utility class
1 parent e6c25ff commit db7fa99

File tree

1 file changed

+15
-13
lines changed
  • apps/website/src/components/note

1 file changed

+15
-13
lines changed

apps/website/src/components/note/note.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import { component$, PropsOf, Slot } from '@builder.io/qwik';
2+
import { cn } from '@qwik-ui/utils';
23

34
export enum NoteStatus {
45
Info = 'info',
56
Warning = 'warning',
6-
Caution = 'caution',
7+
Alert = 'alert',
78
}
89

9-
export interface NoteProps {
10+
export type NoteProps = {
1011
status?: NoteStatus;
11-
}
12+
};
1213

1314
function getIconByStatus(status?: NoteStatus) {
1415
switch (status) {
1516
case NoteStatus.Info:
1617
return <InfoIcon class="text-primary" />;
1718
case NoteStatus.Warning:
1819
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" />;
2122

2223
default:
2324
return <InfoIcon class="text-primary" />;
@@ -30,26 +31,27 @@ function getBackgroundByStatus(status?: NoteStatus) {
3031
return 'bg-primary/30 border-primary border-l-2 mb-4 rounded-base block';
3132
case NoteStatus.Warning:
3233
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';
3536
default:
3637
return 'bg-primary/30 border-primary border-l-2 mb-4 rounded-base block';
3738
}
3839
}
3940

40-
export const Note = component$<NoteProps>(({ status, ...props }) => {
41+
export const Note = component$<NoteProps>(({ status }) => {
4142
return (
4243
<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+
)}
4648
>
4749
<div class="absolute left-[-17.5px] top-[-17.5px] hidden h-8 w-8 rounded-full bg-white dark:bg-slate-900 lg:block">
4850
<div class="flex h-8 w-8 items-center justify-center ">
4951
{getIconByStatus(status ?? NoteStatus.Info)}
5052
</div>
5153
</div>
52-
<blockquote {...props}>
54+
<blockquote>
5355
<Slot />
5456
</blockquote>
5557
</aside>
@@ -92,7 +94,7 @@ export function WarningIcon(props: PropsOf<'svg'>, key: string) {
9294
);
9395
}
9496

95-
export function CautionIcon(props: PropsOf<'svg'>, key: string) {
97+
export function AlertIcon(props: PropsOf<'svg'>, key: string) {
9698
return (
9799
<svg
98100
xmlns="http://www.w3.org/2000/svg"

0 commit comments

Comments
 (0)