update type errors
This commit is contained in:
@@ -4,7 +4,17 @@ import {CircleInfo_Stroke2_Corner0_Rounded as CircleInfo} from '#/components/ico
|
||||
import {CircleInfo_Stroke2_Corner0_Rounded as ErrorIcon} from '#/components/icons/CircleInfo'
|
||||
import {Warning_Stroke2_Corner0_Rounded as WarningIcon} from '#/components/icons/Warning'
|
||||
|
||||
export type ToastType = 'default' | 'success' | 'error' | 'warning' | 'info'
|
||||
export type ToastType =
|
||||
| 'default'
|
||||
| 'success'
|
||||
| 'error'
|
||||
| 'warning'
|
||||
| 'info'
|
||||
| 'xmark'
|
||||
| 'exclamation-circle'
|
||||
| 'check'
|
||||
| 'clipboard-check'
|
||||
| 'circle-exclamation'
|
||||
|
||||
export const TOAST_ANIMATION_CONFIG = {
|
||||
duration: 300,
|
||||
|
||||
@@ -57,8 +57,9 @@ function Toast({
|
||||
const [cardHeight, setCardHeight] = useState(0)
|
||||
|
||||
const toastStyles = getToastTypeStyles(t)
|
||||
const colors = toastStyles[type]
|
||||
const IconComponent = TOAST_TYPE_TO_ICON[type]
|
||||
const colors = toastStyles[type as keyof typeof toastStyles]
|
||||
const IconComponent =
|
||||
TOAST_TYPE_TO_ICON[type as keyof typeof TOAST_TYPE_TO_ICON]
|
||||
|
||||
// for the exit animation to work on iOS the animated component
|
||||
// must not be the root component
|
||||
|
||||
@@ -63,11 +63,11 @@ export const ToastContainer: React.FC<ToastContainerProps> = ({}) => {
|
||||
|
||||
const toastTypeStyles = getToastTypeStyles(t)
|
||||
const toastStyles = activeToast
|
||||
? toastTypeStyles[activeToast.type]
|
||||
? toastTypeStyles[activeToast.type as keyof typeof toastTypeStyles]
|
||||
: toastTypeStyles.default
|
||||
|
||||
const IconComponent = activeToast
|
||||
? TOAST_TYPE_TO_ICON[activeToast.type]
|
||||
? TOAST_TYPE_TO_ICON[activeToast.type as keyof typeof TOAST_TYPE_TO_ICON]
|
||||
: TOAST_TYPE_TO_ICON.default
|
||||
|
||||
const animationStyles = getToastWebAnimationStyles()
|
||||
|
||||
@@ -12,8 +12,9 @@ import {H1, Text} from '#/components/Typography'
|
||||
function ToastPreview({message, type}: {message: string; type: ToastType}) {
|
||||
const t = useTheme()
|
||||
const toastStyles = getToastTypeStyles(t)
|
||||
const colors = toastStyles[type]
|
||||
const IconComponent = TOAST_TYPE_TO_ICON[type]
|
||||
const colors = toastStyles[type as keyof typeof toastStyles]
|
||||
const IconComponent =
|
||||
TOAST_TYPE_TO_ICON[type as keyof typeof TOAST_TYPE_TO_ICON]
|
||||
|
||||
return (
|
||||
<Pressable
|
||||
|
||||
Reference in New Issue
Block a user