Skip to content

Commit 4ccc94b

Browse files
author
Brijesh Bittu
committed
Update icons in Alert component
1 parent 66ede39 commit 4ccc94b

File tree

5 files changed

+14
-52
lines changed

5 files changed

+14
-52
lines changed

docs/src/components/Alert.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
import * as React from 'react';
22

3-
import { InfoIcon } from 'docs/icons/InfoIcon';
4-
import { LightBulbIcon } from 'docs/icons/LightBulbIcon';
3+
import { InfoIcon, LightbulbIcon, TriangleAlertIcon, NotebookTextIcon } from 'lucide-react';
4+
55
import { AlertRoot, AlertTitle } from './Alert.pigment';
66

77
type AlertProps = {
88
type: 'important' | 'info' | 'tip' | 'note';
99
children?: React.ReactNode;
1010
};
1111

12-
const Icon: Partial<Record<AlertProps['type'], React.ReactNode>> = {
13-
important: <InfoIcon />,
14-
tip: <LightBulbIcon />,
12+
const IconMap: Partial<Record<AlertProps['type'], typeof InfoIcon>> = {
13+
important: TriangleAlertIcon,
14+
info: InfoIcon,
15+
tip: LightbulbIcon,
16+
note: NotebookTextIcon,
1517
};
1618

1719
export function Alert({ type = 'info', children }: AlertProps) {
18-
const icon = Icon[type];
20+
const Icon = IconMap[type];
1921
return (
2022
<AlertRoot variant={type}>
2123
<AlertTitle>
22-
{icon}
24+
{!!Icon && <Icon width={16} height={16} />}
2325
<strong>{type}</strong>
2426
</AlertTitle>
2527
{children}

docs/src/icons/InfoIcon.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/src/icons/LightBulbIcon.tsx

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/src/nav.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export const nav: NavItem[] = [
3737
label: 'Styling',
3838
href: '/features/styling',
3939
},
40+
{
41+
label: 'Composition',
42+
href: '/features/composition',
43+
},
4044
{
4145
label: 'Theming',
4246
href: '/features/theming',

docs/src/utils/rehype/rehypeGithubAlert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const rehypeGithubAlert: Pluggable = () => {
2121
const regex = new RegExp(`^\\[!(?<type>${ALERT_TYPES.join('|')})\\]`, 'gi');
2222
const match = regex.exec(firstText.value as string);
2323
if (match) {
24-
firstText.value = (firstText.value as string).replace(regex, '').trim();
24+
firstText.value = (firstText.value as string).replace(regex, '');
2525
}
2626
node.type = 'mdxJsxFlowElement';
2727
node.name = 'Alert';

0 commit comments

Comments
 (0)