Skip to content

Commit

Permalink
chore: rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Jun 12, 2024
1 parent 18ddc6c commit 92cb960
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
7 changes: 6 additions & 1 deletion src/components/toast/toast.less
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
.@{class-prefix-toast}-main-text {
padding: 12px;
min-width: 0px;
min-width: 0;
}
.@{class-prefix-toast}-main-icon {
padding: 35px 12px;
Expand All @@ -43,3 +43,8 @@
}
}
}

.@{class-prefix-toast}-loading {
--size: 48px;
margin: 0 auto 8px;
}
26 changes: 14 additions & 12 deletions src/components/toast/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ const defaultProps = {
stopPropagation: ['click'],
}

export const InternalToast: FC<ToastProps> = props => {
const mergedProps = mergeProps(defaultProps, props)
const { maskClickable, content, icon, position } = mergedProps
export const InternalToast: FC<ToastProps> = p => {
const props = mergeProps(defaultProps, p)
const { maskClickable, content, icon, position } = props

const iconElement = useMemo(() => {
if (icon === null || icon === undefined) return null
switch (icon) {
case 'success':
return <CheckOutline />
return <CheckOutline className={`${classPrefix}-icon-success`} />
case 'fail':
return <CloseOutline />
return <CloseOutline className={`${classPrefix}-icon-fail`} />
case 'loading':
return <SpinLoading color='white' style={{ '--size': '48px' }} />
return (
<SpinLoading color='white' className={`${classPrefix}-loading`} />
)
default:
return icon
}
Expand All @@ -62,18 +64,18 @@ export const InternalToast: FC<ToastProps> = props => {

return (
<Mask
visible={mergedProps.visible}
visible={props.visible}
destroyOnClose
opacity={0}
disableBodyScroll={!maskClickable}
getContainer={mergedProps.getContainer}
afterClose={mergedProps.afterClose}
getContainer={props.getContainer}
afterClose={props.afterClose}
style={{
pointerEvents: maskClickable ? 'none' : 'auto',
...mergedProps.maskStyle,
...props.maskStyle,
}}
className={classNames(`${classPrefix}-mask`, mergedProps.maskClassName)}
stopPropagation={mergedProps.stopPropagation}
className={classNames(`${classPrefix}-mask`, props.maskClassName)}
stopPropagation={props.stopPropagation}
>
<div className={classNames(`${classPrefix}-wrap`)}>
<div
Expand Down

0 comments on commit 92cb960

Please sign in to comment.