Skip to content

Commit de535d2

Browse files
committed
svg fix
1 parent a0a8776 commit de535d2

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

Chapter5/Section5-Using-SVGs/app/src/Alert.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
import { useState } from 'react';
2+
import { ReactComponent as CrossIcon } from './cross.svg';
3+
import { ReactComponent as InfoIcon } from './info.svg';
4+
import { ReactComponent as WarningIcon } from './warning.svg';
25

36
type Props = {
47
type?: string;
@@ -32,7 +35,11 @@ export function Alert({ type = 'information', heading, children, closable, onClo
3235
aria-label={type === 'warning' ? 'Warning' : 'Information'}
3336
className="w-7"
3437
>
35-
{type === 'warning' ? '⚠' : 'ℹ️'}
38+
{type === 'warning ' ? (
39+
<WarningIcon className="fill-amber-900 w-5 h-5" />
40+
) : (
41+
<InfoIcon className="fill-teal-900 w-5 h-5" />
42+
)}
3643
</span>
3744
<span className="font-bold">{heading}</span>
3845
{closable && (
@@ -41,9 +48,7 @@ export function Alert({ type = 'information', heading, children, closable, onClo
4148
onClick={handleCloseClick}
4249
className="border-none bg-transparent ml-auto cursor-pointer"
4350
>
44-
<span role="img" aria-label="Close">
45-
46-
</span>
51+
<CrossIcon />
4752
</button>
4853
)}
4954
</div>
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)