Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(desktop): add shared settings layout components

Richie McIlroy0e6f8e471737
diff --git a/apps/desktop/src/routes/(window-chrome)/settings/Setting.tsx b/apps/desktop/src/routes/(window-chrome)/settings/Setting.tsx
index 7087903a6..3978348cd 100644
--- a/apps/desktop/src/routes/(window-chrome)/settings/Setting.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/settings/Setting.tsx
@@ -1,7 +1,75 @@
-import type { JSX } from "solid-js";
+import { cx } from "cva";
+import type { JSX, ParentProps } from "solid-js";
import { Show } from "solid-js";
import { Toggle } from "~/components/Toggle";
+export function SettingsPageContent(props: ParentProps<{ class?: string }>) {
+ return (
+ <div class={cx("px-6 py-6 space-y-7 max-w-[42rem]", props.class)}>
+ {props.children}
+ </div>
+ );
+}
+
+export function Section(
+ props: ParentProps<{
+ title: string;
+ description?: string | JSX.Element;
+ right?: JSX.Element;
+ pro?: boolean;
+ }>,
+) {
+ return (
+ <section class="space-y-2.5">
+ <header class="flex justify-between items-end gap-3 px-1">
+ <div class="flex flex-col gap-0.5 min-w-0">
+ <div class="flex gap-2 items-center">
+ <h3 class="text-sm font-semibold tracking-tight text-gray-12">
+ {props.title}
+ </h3>
+ <Show when={props.pro}>
+ <span class="text-[10px] font-medium uppercase tracking-wide px-1.5 py-0.5 rounded-md bg-blue-9 text-white">
+ Pro
+ </span>
+ </Show>
+ </div>
+ <Show when={props.description}>
+ <div class="text-xs leading-relaxed text-gray-10">
+ {props.description}
+ </div>
+ </Show>
+ </div>
+ <Show when={props.right}>
+ <div class="flex shrink-0 gap-2 items-center">{props.right}</div>
+ </Show>
+ </header>
+ {props.children}
+ </section>
+ );
+}
+
+export function SectionCard(
+ props: ParentProps<{ class?: string; padded?: boolean }>,
+) {
+ return (
+ <div
+ class={cx(
+ "cap-settings-card overflow-hidden rounded-xl border border-gray-3 bg-gray-2",
+ props.padded && "px-4 py-4",
+ props.class,
+ )}
+ >
+ {props.children}
+ </div>
+ );
+}
+
+export function SectionRows(props: ParentProps) {
+ return (
+ <SectionCard class="divide-y divide-gray-3">{props.children}</SectionCard>
+ );
+}
+
export function SettingItem(props: {
pro?: boolean;
label: string;