@@ -10,19 +10,14 @@ import cn from 'classnames'
1010import { useEffect , type ReactElement , type ReactNode } from 'react'
1111import { Link , type To } from 'react-router'
1212
13- import {
14- Close12Icon ,
15- Error12Icon ,
16- Success12Icon ,
17- Warning12Icon ,
18- } from '@oxide/design-system/icons/react'
13+ import { Close12Icon , Error12Icon , Success12Icon } from '@oxide/design-system/icons/react'
1914
2015import { extractText } from '~/util/str'
2116
2217import { TimeoutIndicator } from './TimeoutIndicator'
2318import { Truncate } from './Truncate'
2419
25- type Variant = 'success' | 'error' | 'info'
20+ type Variant = 'success' | 'error'
2621
2722export interface ToastProps {
2823 title ?: string
@@ -39,31 +34,16 @@ export interface ToastProps {
3934const icon : Record < Variant , ReactElement > = {
4035 success : < Success12Icon /> ,
4136 error : < Error12Icon /> ,
42- info : < Warning12Icon /> ,
4337}
4438
4539const defaultTitle : Record < Variant , string > = {
4640 success : 'Success' ,
4741 error : 'Error' ,
48- info : 'Note' ,
4942}
5043
51- const color : Record < Variant , string > = {
52- success : 'bg-accent' ,
53- error : 'bg-error-secondary' ,
54- info : 'bg-notice-secondary' ,
55- }
56-
57- const textColor : Record < Variant , string > = {
58- success : 'text-accent *:text-accent' ,
59- error : 'text-error *:text-error' ,
60- info : 'text-notice *:text-notice' ,
61- }
62-
63- const secondaryTextColor : Record < Variant , string > = {
64- success : 'text-accent-secondary' ,
65- error : 'text-error-secondary' ,
66- info : 'text-notice-secondary' ,
44+ const themeClass : Record < Variant , string > = {
45+ success : '' ,
46+ error : 'red-theme' ,
6747}
6848
6949export const Toast = ( {
@@ -85,8 +65,8 @@ export const Toast = ({
8565 < div
8666 className = { cn (
8767 'shadow-toast relative flex w-96 items-start overflow-hidden rounded-lg border border-current/10 p-4' ,
88- color [ variant ] ,
89- textColor [ variant ]
68+ 'bg-accent text-accent *:text-accent' ,
69+ themeClass [ variant ]
9070 ) }
9171 >
9272 < div className = "mt-[2px] flex [&>svg]:h-3 [&>svg]:w-3" > { icon [ variant ] } </ div >
@@ -95,9 +75,7 @@ export const Toast = ({
9575 < div className = "text-sans-semi-md" > { title || defaultTitle [ variant ] } </ div >
9676 ) }
9777 { /* 'group' is necessary for HL color trick to work. see HL.tsx */ }
98- < div className = { cn ( 'text-sans-md group' , secondaryTextColor [ variant ] ) } >
99- { content }
100- </ div >
78+ < div className = "text-sans-md group text-accent-secondary" > { content } </ div >
10179
10280 { cta && (
10381 < Link
@@ -112,10 +90,7 @@ export const Toast = ({
11290 < button
11391 type = "button"
11492 aria-label = "Dismiss notification"
115- className = { cn (
116- 'hover:bg-accent-hover -m-2 flex items-center rounded-md border-transparent! p-2' ,
117- textColor [ variant ]
118- ) }
93+ className = "hover:bg-accent-hover text-accent *:text-accent -m-2 flex items-center rounded-md border-transparent! p-2"
11994 onClick = { onClose }
12095 >
12196 < Close12Icon />
0 commit comments