Skip to content

Commit

Permalink
💄 优化UI
Browse files Browse the repository at this point in the history
  • Loading branch information
zty012 committed Dec 7, 2024
1 parent 73cc3e6 commit 3c5af7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/components/ui/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ import { cn } from "../../utils/cn";
export default function Switch({
value = false,
onChange = () => {},
disabled = false,
}: {
value?: boolean;
onChange?: (value: boolean) => void;
disabled?: boolean;
}) {
return (
<div
className={cn("relative h-8 w-14 rounded-full bg-neutral-800", {
"bg-blue-500": value,
"cursor-not-allowed bg-neutral-600": disabled,
})}
onClick={() => onChange(!value)}
>
Expand All @@ -24,6 +27,7 @@ export default function Switch({
"absolute left-1 top-1 h-6 w-6 translate-x-0 transform rounded-full bg-white",
{
"translate-x-6": value,
"bg-neutral-300": disabled,
},
)}
></div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/settings/plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export default function PluginsPage() {
"Provides the core functionality of the app\nAuthor: Project Graph Developers"
}
>
<Button>
<Button disabled>
<X />
{t("uninstall")}
</Button>
<Switch value={true} onChange={() => {}} />
<Switch value={true} onChange={() => {}} disabled />
</Field>
</>
);
Expand Down

0 comments on commit 3c5af7d

Please sign in to comment.