mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-08-24 15:22:20 +10:00
chore(ui): drop the sonner dependency
Every call site now uses the Base UI toast, so the sonner wrapper and its test go with it.
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
"react-dom": "^19.2.8",
|
"react-dom": "^19.2.8",
|
||||||
"react-resizable-panels": "^4.12.2",
|
"react-resizable-panels": "^4.12.2",
|
||||||
"shadcn": "^4.16.2",
|
"shadcn": "^4.16.2",
|
||||||
"sonner": "^2.0.8",
|
|
||||||
"tw-animate-css": "^1.4.0"
|
"tw-animate-css": "^1.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
import { render } from "@testing-library/react";
|
|
||||||
import { describe, expect, it } from "vitest";
|
|
||||||
import { ThemeProvider } from "next-themes";
|
|
||||||
import { Toaster } from "./sonner";
|
|
||||||
|
|
||||||
describe("Toaster", () => {
|
|
||||||
it("renders without errors when wrapped in ThemeProvider", () => {
|
|
||||||
const { container } = render(
|
|
||||||
<ThemeProvider>
|
|
||||||
<Toaster />
|
|
||||||
</ThemeProvider>,
|
|
||||||
);
|
|
||||||
// Sonner renders into document.body, but we just verify no crash
|
|
||||||
expect(container).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("forwards arbitrary props to underlying Sonner", () => {
|
|
||||||
const { container } = render(
|
|
||||||
<ThemeProvider>
|
|
||||||
<Toaster position="top-right" />
|
|
||||||
</ThemeProvider>,
|
|
||||||
);
|
|
||||||
expect(container).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("does not throw when rendered without theme context", () => {
|
|
||||||
// Toaster falls back to "system" theme when next-themes context is absent.
|
|
||||||
expect(() => render(<Toaster />)).not.toThrow();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
import type { ToasterProps } from "sonner";
|
|
||||||
import { CheckCircleIcon, CircleNotchIcon, InfoIcon, WarningIcon, XCircleIcon } from "@phosphor-icons/react";
|
|
||||||
import { useTheme } from "next-themes";
|
|
||||||
import { Toaster as Sonner } from "sonner";
|
|
||||||
|
|
||||||
const Toaster = ({ ...props }: ToasterProps) => {
|
|
||||||
const { theme = "system" } = useTheme();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Sonner
|
|
||||||
theme={theme as NonNullable<ToasterProps["theme"]>}
|
|
||||||
className="toaster group"
|
|
||||||
icons={{
|
|
||||||
success: <CheckCircleIcon className="size-4" />,
|
|
||||||
info: <InfoIcon className="size-4" />,
|
|
||||||
warning: <WarningIcon className="size-4" />,
|
|
||||||
error: <XCircleIcon className="size-4" />,
|
|
||||||
loading: <CircleNotchIcon className="size-4 animate-spin" />,
|
|
||||||
}}
|
|
||||||
style={
|
|
||||||
{
|
|
||||||
"--normal-bg": "var(--popover)",
|
|
||||||
"--normal-text": "var(--popover-foreground)",
|
|
||||||
"--normal-border": "var(--border)",
|
|
||||||
"--border-radius": "var(--radius)",
|
|
||||||
} as React.CSSProperties
|
|
||||||
}
|
|
||||||
toastOptions={{
|
|
||||||
classNames: {
|
|
||||||
toast: "cn-toast",
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export { Toaster };
|
|
||||||
Reference in New Issue
Block a user