Skip to content

Commit

Permalink
feat: update toast style
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <tukon479@gmail.com>
  • Loading branch information
Innei committed Dec 9, 2024
1 parent 12bd659 commit cf5eeb6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions apps/renderer/src/styles/additional.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,51 @@
rgba(255, 255, 255, 0) 100%
);
}

/* Sonner customize */

@media (max-width: 600px) {
#root [data-sonner-toaster][data-y-position="bottom"] {
bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
}

#root [data-sonner-toaster][data-y-position="top"] {
top: calc(env(safe-area-inset-top, 0px) + 20px);
}

#root [data-sonner-toast] {
--border-radius: 16px;
}

#root [data-button="true"][data-action="true"] {
@apply bg-transparent font-bold font-sans text-foreground relative -mr-[16px] px-4 before:absolute before:inset-y-0 before:left-0 before:w-px before:bg-foreground/30;
}
}

#root [data-sonner-toast] {
&[data-type="success"]::before,
&[data-type="error"]::before,
&[data-type="info"]::before,
&[data-type="warning"]::before {
content: "";
border-radius: var(--border-radius);

@apply absolute inset-0 pointer-events-none z-[-1] opacity-20 !transform-none;
}

&[data-type="success"]::before {
background: linear-gradient(to left, #56b4d3, #348f50);
}

&[data-type="error"]::before {
background: linear-gradient(to right, #ee9ca7, #ffdde1);
}

&[data-type="info"]::before {
background: linear-gradient(to right, #64a7d5, #6dd5fa, #c5eef4);
}

&[data-type="warning"]::before {
background: linear-gradient(to right, #f2994a, #f2c94c);
}
}
1 change: 1 addition & 0 deletions packages/components/src/ui/toast/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const Toaster = ({ ...props }: ToasterProps) => (
classNames: {
content: "min-w-0",
icon: tw`self-start translate-y-[2px]`,
actionButton: tw`font-sans font-medium`,
closeButton: tw`!border-border !bg-background transition-opacity will-change-opacity duration-200 opacity-0 group-hover:opacity-100`,
},
}}
Expand Down

0 comments on commit cf5eeb6

Please sign in to comment.