Skip to content

Commit

Permalink
feat: add options page (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
parnavh authored Oct 24, 2024
1 parent cc06d10 commit 5007515
Show file tree
Hide file tree
Showing 29 changed files with 755 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-needles-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"gregmat-buddy": minor
---

added options page
14 changes: 14 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://shadcn-svelte.com/schema.json",
"style": "default",
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/entrypoints/options/app.css",
"baseColor": "slate"
},
"aliases": {
"components": "@/components",
"utils": "@/utils"
},
"typescript": true
}
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,20 @@
"@types/vimeo__player": "^2.18.3",
"@wxt-dev/module-svelte": "^1.0.1",
"autoprefixer": "^10.4.20",
"bits-ui": "^0.21.16",
"clsx": "^2.1.1",
"svelte": "^4.2.19",
"svelte-check": "^3.8.6",
"tailwind-merge": "^2.5.4",
"tailwind-variants": "^0.2.1",
"tailwindcss": "^3.4.14",
"tslib": "^2.8.0",
"typescript": "^5.6.3",
"wxt": "^0.19.13"
},
"dependencies": {
"@vimeo/player": "^2.24.0",
"fast-glob": "^3.3.2"
"fast-glob": "^3.3.2",
"lucide-svelte": "^0.453.0"
}
}
126 changes: 126 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/components/option/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Root from "./option.svelte";

export {
Root,
//
Root as Option,
};
36 changes: 36 additions & 0 deletions src/components/option/option.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<script lang="ts">
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import * as Tooltip from "@/components/ui/tooltip";
import { CircleHelp } from "lucide-svelte";
export let id: string;
export let handler: (id: string, checked: boolean) => void;
export let checked: boolean = false;
export let tooltip: string = "";
let isInitialLoad = true;
$: if (!isInitialLoad) {
handler(id, checked);
} else {
isInitialLoad = false;
}
</script>

<div class="px-2 flex justify-between">
<Label for={id} class="my-auto"><slot /></Label>
<div class="flex gap-2 items-center">
{#if tooltip !== ""}
<Tooltip.Root>
<Tooltip.Trigger>
<CircleHelp size={20} class="stroke-gray-400 dark:stroke-zinc-400" />
</Tooltip.Trigger>
<Tooltip.Content>
<p>{tooltip}</p>
</Tooltip.Content>
</Tooltip.Root>
{/if}
<Switch {id} bind:checked />
</div>
</div>
7 changes: 7 additions & 0 deletions src/components/ui/label/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Root from "./label.svelte";

export {
Root,
//
Root as Label,
};
21 changes: 21 additions & 0 deletions src/components/ui/label/label.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script lang="ts">
import { Label as LabelPrimitive } from "bits-ui";
import { cn } from "@/utils";
type $$Props = LabelPrimitive.Props;
type $$Events = LabelPrimitive.Events;
let className: $$Props["class"] = undefined;
export { className as class };
</script>

<LabelPrimitive.Root
class={cn(
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
className,
)}
{...$$restProps}
on:mousedown
>
<slot />
</LabelPrimitive.Root>
7 changes: 7 additions & 0 deletions src/components/ui/switch/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Root from "./switch.svelte";

export {
Root,
//
Root as Switch,
};
Loading

0 comments on commit 5007515

Please sign in to comment.