Refined base toast styles
This commit is contained in:
parent
5c2c61eeda
commit
dca5a541a3
2 changed files with 49 additions and 6 deletions
|
|
@ -0,0 +1,35 @@
|
||||||
|
.Toast {
|
||||||
|
background: var(--dialog-bg);
|
||||||
|
border-radius: $card-corner;
|
||||||
|
box-shadow: 0 1px 12px rgba(0, 0, 0, 0.18);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: $unit-2x;
|
||||||
|
padding: $unit-3x;
|
||||||
|
|
||||||
|
.Header {
|
||||||
|
align-items: center;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: $font-regular;
|
||||||
|
font-weight: $medium;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
font-size: $font-regular;
|
||||||
|
font-weight: $bold;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@ import classNames from 'classnames'
|
||||||
import * as ToastPrimitive from '@radix-ui/react-toast'
|
import * as ToastPrimitive from '@radix-ui/react-toast'
|
||||||
import './index.scss'
|
import './index.scss'
|
||||||
|
|
||||||
interface Props {
|
interface Props extends ToastPrimitive.ToastProps {
|
||||||
className?: string
|
className?: string
|
||||||
title?: string
|
title?: string
|
||||||
content: string
|
content: string
|
||||||
|
|
@ -22,16 +22,24 @@ const Toast = ({
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ToastPrimitive.Root {...props} className={classes}>
|
<ToastPrimitive.Root {...props} className={classes}>
|
||||||
{title && <ToastPrimitive.Title>{title}</ToastPrimitive.Title>}
|
<div className="Header">
|
||||||
<ToastPrimitive.Description>{content}</ToastPrimitive.Description>
|
{title && (
|
||||||
|
<ToastPrimitive.Title asChild>
|
||||||
|
<h3>{title}</h3>
|
||||||
|
</ToastPrimitive.Title>
|
||||||
|
)}
|
||||||
|
<ToastPrimitive.Close aria-label="Close">
|
||||||
|
<span aria-hidden>×</span>
|
||||||
|
</ToastPrimitive.Close>
|
||||||
|
</div>
|
||||||
|
<ToastPrimitive.Description asChild>
|
||||||
|
<p>{content}</p>
|
||||||
|
</ToastPrimitive.Description>
|
||||||
{children && (
|
{children && (
|
||||||
<ToastPrimitive.Action asChild altText={content}>
|
<ToastPrimitive.Action asChild altText={content}>
|
||||||
{children}
|
{children}
|
||||||
</ToastPrimitive.Action>
|
</ToastPrimitive.Action>
|
||||||
)}
|
)}
|
||||||
<ToastPrimitive.Close aria-label="Close">
|
|
||||||
<span aria-hidden>×</span>
|
|
||||||
</ToastPrimitive.Close>
|
|
||||||
</ToastPrimitive.Root>
|
</ToastPrimitive.Root>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue