diff --git a/package-lock.json b/package-lock.json index 2f90d16..6d48238 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@headlessui/tailwindcss": "^0.2.0", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-switch": "^1.0.3", "@remixicon/react": "^4.2.0", "@tremor/react": "^3.17.2", "axios": "^1.7.2", @@ -879,6 +880,35 @@ } } }, + "node_modules/@radix-ui/react-switch": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@radix-ui/react-switch/-/react-switch-1.0.3.tgz", + "integrity": "sha512-mxm87F88HyHztsI7N+ZUmEoARGkC22YVW5CaC+Byc+HRpuvCrOBPTAnXgf+tZ/7i0Sg/eOePGdMhUKhPaQEqow==", + "dependencies": { + "@babel/runtime": "^7.13.10", + "@radix-ui/primitive": "1.0.1", + "@radix-ui/react-compose-refs": "1.0.1", + "@radix-ui/react-context": "1.0.1", + "@radix-ui/react-primitive": "1.0.3", + "@radix-ui/react-use-controllable-state": "1.0.1", + "@radix-ui/react-use-previous": "1.0.1", + "@radix-ui/react-use-size": "1.0.1" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0", + "react-dom": "^16.8 || ^17.0 || ^18.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, "node_modules/@radix-ui/react-use-callback-ref": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.0.1.tgz", diff --git a/package.json b/package.json index c4462bc..6bc3401 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@headlessui/tailwindcss": "^0.2.0", "@radix-ui/react-select": "^2.0.0", "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-switch": "^1.0.3", "@remixicon/react": "^4.2.0", "@tremor/react": "^3.17.2", "axios": "^1.7.2", diff --git a/src/app/page.tsx b/src/app/page.tsx index 230edd7..6a71106 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -17,6 +17,8 @@ export default function Home() { const [padding, setPadding] = useState(64); const [theme, setTheme] = useState(() => allThemes["sunset"] as Theme); + const [background, setBackground] = useState(true); + const chartRef = useRef(null); const handleExport = async () => { @@ -29,12 +31,13 @@ export default function Home() { logging: true, onclone: (document: Document) => { Array.from( - document - .querySelector(".cc") - ?.querySelectorAll("*") || [] + document.querySelector(".cc")?.querySelectorAll("*") || [] ).forEach((e) => { let existingStyle = e.getAttribute("style") || ""; - e.setAttribute("style", existingStyle + "; font-family: Inter, sans-serif !important"); + e.setAttribute( + "style", + existingStyle + "; font-family: Inter, sans-serif !important" + ); }); }, }); @@ -55,7 +58,7 @@ export default function Home() { }} >
- +
Made by{" "} diff --git a/src/components/graph.tsx b/src/components/graph.tsx index 2cf7e13..8c6c512 100644 --- a/src/components/graph.tsx +++ b/src/components/graph.tsx @@ -5,7 +5,7 @@ import { AreaChart, Color } from "@tremor/react"; import { useState, useRef } from "react"; import html2canvas from "html2canvas"; -export default function Graph({ padding, theme, chartRef }: { padding: number, theme: Theme, chartRef: React.RefObject }) { +export default function Graph({ padding, theme, background, chartRef }: { padding: number, theme: Theme, background: boolean, chartRef: React.RefObject }) { const mockchartdata = [ { date: "Apr 15", @@ -79,10 +79,11 @@ export default function Graph({ padding, theme, chartRef }: { padding: number, t return ( +
@@ -125,5 +126,6 @@ export default function Graph({ padding, theme, chartRef }: { padding: number, t priority /> */}
+
); } diff --git a/src/components/menu.tsx b/src/components/menu.tsx index a8342fc..4b5a196 100644 --- a/src/components/menu.tsx +++ b/src/components/menu.tsx @@ -8,27 +8,34 @@ import { } from "./ui/select"; import { Theme, allThemes } from "@/lib/theme"; import { Button } from "./ui/button"; +import { Switch } from "./ui/switch"; export default function Menu({ padding, setPadding, theme, setTheme, + background, + setBackground, handleExport, }: { padding: number; setPadding: (padding: number) => void; theme: Theme; setTheme: (theme: Theme) => void; + background: boolean; + setBackground: (background: boolean) => void; handleExport: () => void; }) { return ( -
+
Theme
+
+ Background + setBackground(checked)} + /> +
Padding