mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-29 01:28:59 -05:00
Add dark mode toggle
This commit is contained in:
parent
c15cb062a8
commit
a5f450d80f
4 changed files with 18 additions and 21 deletions
|
@ -5,7 +5,7 @@ export default [
|
||||||
$write: [],
|
$write: [],
|
||||||
name: "Shares",
|
name: "Shares",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
permission: "collection",
|
permission: "document",
|
||||||
attributes: [
|
attributes: [
|
||||||
{
|
{
|
||||||
key: "securityID",
|
key: "securityID",
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { ActionIcon, Avatar, Menu } from "@mantine/core";
|
import { ActionIcon, Avatar, Menu, Switch } from "@mantine/core";
|
||||||
import { NextLink } from "@mantine/next";
|
import { NextLink } from "@mantine/next";
|
||||||
import { DoorExit, Link } from "tabler-icons-react";
|
import { DoorExit, Link, Moon } from "tabler-icons-react";
|
||||||
import aw from "../../utils/appwrite.util";
|
import aw from "../../utils/appwrite.util";
|
||||||
|
import ToggleThemeButton from "./ToggleThemeButton";
|
||||||
|
|
||||||
const ActionAvatar = () => {
|
const ActionAvatar = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -36,6 +37,10 @@ const ActionAvatar = () => {
|
||||||
>
|
>
|
||||||
Sign out
|
Sign out
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
<Menu.Label>Settings</Menu.Label>
|
||||||
|
<Menu.Item icon={<Moon size={14} />}>
|
||||||
|
<ToggleThemeButton />
|
||||||
|
</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,25 +1,18 @@
|
||||||
import { ActionIcon, useMantineColorScheme } from "@mantine/core";
|
import { Switch, useMantineColorScheme } from "@mantine/core";
|
||||||
import { Sun, MoonStars } from "tabler-icons-react";
|
|
||||||
|
|
||||||
const ToggleThemeButton = () => {
|
const ToggleThemeButton = () => {
|
||||||
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
|
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionIcon
|
<Switch
|
||||||
onClick={() => toggleColorScheme()}
|
size="sm"
|
||||||
sx={(theme) => ({
|
checked={colorScheme == "dark"}
|
||||||
backgroundColor:
|
onClick={(v) =>
|
||||||
theme.colorScheme === "dark"
|
toggleColorScheme(v.currentTarget.checked ? "dark" : "light")
|
||||||
? theme.colors.dark[6]
|
}
|
||||||
: theme.colors.gray[0],
|
onLabel="ON"
|
||||||
color:
|
offLabel="OFF"
|
||||||
theme.colorScheme === "dark"
|
/>
|
||||||
? theme.colors.yellow[4]
|
|
||||||
: theme.colors.violet,
|
|
||||||
})}
|
|
||||||
>
|
|
||||||
{colorScheme === "dark" ? <Sun size={18} /> : <MoonStars size={18} />}
|
|
||||||
</ActionIcon>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import {
|
import {
|
||||||
ColorScheme,
|
ColorScheme,
|
||||||
Container,
|
Container,
|
||||||
Group,
|
|
||||||
LoadingOverlay,
|
LoadingOverlay,
|
||||||
MantineProvider,
|
MantineProvider,
|
||||||
Stack,
|
Stack,
|
||||||
|
|
Loading…
Add table
Reference in a new issue