mirror of
https://github.com/khairul169/vaulterm.git
synced 2025-04-28 16:49:39 +07:00
30 lines
615 B
TypeScript
30 lines
615 B
TypeScript
import React from "react";
|
|
import { Button, GetProps } from "tamagui";
|
|
import Icons from "../ui/icons";
|
|
import useThemeStore from "@/stores/theme";
|
|
|
|
type Props = GetProps<typeof Button> & {
|
|
iconSize?: number;
|
|
};
|
|
|
|
const ThemeSwitcher = ({ iconSize = 24, ...props }: Props) => {
|
|
const { theme, toggle } = useThemeStore();
|
|
|
|
return (
|
|
<Button
|
|
icon={
|
|
<Icons
|
|
name={
|
|
theme === "light" ? "white-balance-sunny" : "moon-waning-crescent"
|
|
}
|
|
size={iconSize}
|
|
/>
|
|
}
|
|
onPress={toggle}
|
|
{...props}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export default ThemeSwitcher;
|