Commit 99b46bee by 李伟康

style(toast): 优化 toast 组件样式和布局

- 移除固定最大宽度,调整为 70vw 的响应式设计
- 添加 flex 布局支持,改进组件对齐方式
- 调整内边距为水平垂直分离的 px-py 格式
- 简化消息区域布局,移除不必要的包装元素
- 优化图标容器,添加 flex-shrink-0 防止压缩
- 移除全局样式中的多余行高定义
1 parent 90285dca
......@@ -34,31 +34,27 @@ const Toast = ({ type = 'info', size = 'md', message, children, className, custo
<div
className={classNames(
className,
'fixed top-4 left-1/2 z-[9999] overflow-hidden',
'fixed top-4 left-1/2 z-[9999] overflow-hidden flex items-center',
'flex flex-col items-center',
size === 'md' ? 'p-3' : 'p-2'
size === 'md' ? 'px-3 py-2' : 'px-2 py-1'
)}
style={{
transform: 'translateX(-50%)',
maxWidth: '91vw',
maxWidth: '70vw',
borderRadius: '54px',
width: 'fit-content',
}}
>
<div className="absolute inset-0 -z-10" style={{ backgroundColor: 'rgba(0, 0, 0, 0.5)' }} />
<div className={`flex ${size === 'md' ? 'gap-1' : 'gap-0.5'} w-full`}>
<div className={`flex items-center justify-center ${size === 'md' ? 'p-0.5' : 'p-1'}`}>
<div className={`flex ${size === 'md' ? 'gap-1' : 'gap-0.5'} items-center`}>
<div className={`flex items-center justify-center flex-shrink-0 ${size === 'md' ? 'p-0.5' : 'p-1'}`}>
{type === 'success' && <RiCheckboxCircleFill className={`${size === 'md' ? 'h-5 w-5' : 'h-4 w-4'} text-white`} aria-hidden="true" />}
{type === 'error' && <RiErrorWarningFill className={`${size === 'md' ? 'h-5 w-5' : 'h-4 w-4'} text-white`} aria-hidden="true" />}
{type === 'warning' && <RiAlertFill className={`${size === 'md' ? 'h-5 w-5' : 'h-4 w-4'} text-white`} aria-hidden="true" />}
{type === 'info' && <RiInformation2Fill className={`${size === 'md' ? 'h-5 w-5' : 'h-4 w-4'} text-white`} aria-hidden="true" />}
</div>
<div className={`flex py-1 ${size === 'md' ? 'px-1' : 'px-0.5'} grow flex-col items-start gap-1`}>
<div className="flex items-center gap-1">
<div className="system-sm-semibold" style={{ color: 'white', fontSize: '14px' }}>{message}</div>
{customComponent}
</div>
{children && <div className="system-xs-regular" style={{ color: 'white', fontSize: '14px' }}>{children}</div>}
<div className={`flex items-center text-white flex-1 min-w-[45vw]`}>
{message}
</div>
{/* {close && (
<ActionButton className="z-[1000]" onClick={close}>
......
......@@ -239,7 +239,6 @@ button:focus-within {
.system-sm-semibold {
font-size: 13px;
font-weight: 600;
line-height: 16px;
}
.system-sm-semibold-uppercase {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!