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