Skip to content

Commit 681333f

Browse files
authored
Remove next-themes dependency (#226)
* refactor: remove next-themes dependency, use internal ThemeProvider for Sonner * Format
1 parent a81319e commit 681333f

5 files changed

Lines changed: 15 additions & 20 deletions

File tree

.changeset/remove-next-themes.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tailor-platform/app-shell": patch
3+
---
4+
5+
Remove `next-themes` dependency by using the internal `ThemeProvider` context for the Sonner toast theming.

examples/nextjs-app/src/modules/pages/action-panel-demo.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defineResource, ActionPanel, useNavigate } from "@tailor-platform/app-shell";
1+
import { defineResource, ActionPanel, useNavigate, useToast } from "@tailor-platform/app-shell";
22
import type { SVGProps } from "react";
33

44
export const ReceiptIcon = (props: SVGProps<SVGSVGElement>) => (
@@ -62,6 +62,7 @@ export const ExternalLinkIcon = (props: SVGProps<SVGSVGElement>) => (
6262

6363
const ActionPanelDemoPage = () => {
6464
const navigate = useNavigate();
65+
const toast = useToast();
6566
return (
6667
<div
6768
style={{
@@ -85,13 +86,17 @@ const ActionPanelDemoPage = () => {
8586
key: "create-invoice",
8687
label: "Create new sales invoice",
8788
icon: <ReceiptIcon />,
88-
onClick: () => alert("Create invoice clicked"),
89+
onClick: () => {
90+
toast("Create invoice clicked");
91+
},
8992
},
9093
{
9194
key: "delivery-note",
9295
label: "Create new delivery note",
9396
icon: <FileTextIcon />,
94-
onClick: () => alert("Create delivery note clicked"),
97+
onClick: () => {
98+
toast("Create delivery note clicked");
99+
},
95100
},
96101
{
97102
key: "view-po-demo",

packages/core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@
5959
"es-toolkit": "^1.45.1",
6060
"graphql": "^16.13.2",
6161
"lucide-react": "^1.8.0",
62-
"next-themes": "^0.4.6",
6362
"papaparse": "^5.5.3",
6463
"react": "^19.2.5",
6564
"react-dom": "^19.2.5",

packages/core/src/components/sonner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { useTheme } from "next-themes";
1+
import { useTheme } from "@/contexts/theme-context";
22
import { Toaster as Sonner, ToasterProps } from "sonner";
33

44
const Toaster = ({ ...props }: ToasterProps) => {
5-
const { theme = "system" } = useTheme();
5+
const { theme } = useTheme();
66

77
return (
88
<Sonner

pnpm-lock.yaml

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)