Skip to content

Commit deec603

Browse files
committed
docs: docs now have demo + better design (w/ vike).
1 parent 2d296e4 commit deec603

27 files changed

+1309
-124
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ const result = compiledTemplate({ name: "World" });
9494

9595
> I think each of these need examples.
9696
97-
```sh
97+
```
9898
{{ }} - evaluation
9999
{{= }} - interpolation
100-
{{! }} - interpolation with encoding
100+
{{! }} - interpolation with encoding # Does not work it seems.
101101
{{# }} - compile-time evaluation/includes and partials
102102
{{## #}} - compile-time defines
103103
{{? }} - conditionals

bun.lockb

-8.47 KB
Binary file not shown.

dev/assets/icons/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export { default as IconCopy } from "./lets-icons_copy-light.svg";
2+
export { default as IconMoon } from "./line-md_moon-rising-twotone-alt-loop.svg";
3+
export { default as IconSun } from "./line-md_sun-rising-twotone-loop.svg";
4+
export { default as IconCheck } from "./material-symbols_check.svg";
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

dev/components/theme-switcher.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { IconMoon, IconSun } from "@/assets/icons";
2+
import { useThemeContext } from "@/contexts/theme.context";
3+
import { Show } from "solid-js";
4+
import { Button } from "./ui/button";
5+
6+
export function ThemeSwitcher() {
7+
const { theme, toggleTheme } = useThemeContext();
8+
9+
return (
10+
<div class="flex items-center gap-x-2">
11+
<Button variant="ghost" class="h-7 w-7 border border-neutral-300 p-0" onClick={toggleTheme}>
12+
<Show when={theme() === "light"} fallback={<IconMoon class="h-4 w-4" />}>
13+
<IconSun class="h-4 w-4" />
14+
</Show>
15+
</Button>
16+
</div>
17+
);
18+
}

dev/components/ui/button.tsx

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import type { JSX, ValidComponent } from "solid-js";
2+
import { splitProps } from "solid-js";
3+
4+
import * as ButtonPrimitive from "@kobalte/core/button";
5+
import type { PolymorphicProps } from "@kobalte/core/polymorphic";
6+
import type { VariantProps } from "class-variance-authority";
7+
import { cva } from "class-variance-authority";
8+
9+
import { cn } from "@/utils/cn";
10+
11+
const buttonVariants = cva(
12+
"active:scale-95 transition inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
13+
{
14+
variants: {
15+
variant: {
16+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
17+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
18+
outline: "border border-input hover:bg-muted text-foreground",
19+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
20+
ghost: "hover:bg-accent hover:text-accent-foreground",
21+
link: "text-primary underline-offset-4 hover:underline",
22+
},
23+
size: {
24+
default: "h-10 px-4 py-2",
25+
sm: "h-9 px-3 text-xs",
26+
lg: "h-11 px-8",
27+
icon: "size-10",
28+
},
29+
},
30+
defaultVariants: {
31+
variant: "default",
32+
size: "default",
33+
},
34+
}
35+
);
36+
37+
type ButtonProps<T extends ValidComponent = "button"> = ButtonPrimitive.ButtonRootProps<T> &
38+
VariantProps<typeof buttonVariants> & { class?: string | undefined; children?: JSX.Element };
39+
40+
const Button = <T extends ValidComponent = "button">(
41+
props: PolymorphicProps<T, ButtonProps<T>>
42+
) => {
43+
const [local, others] = splitProps(props as ButtonProps, ["variant", "size", "class"]);
44+
return (
45+
<ButtonPrimitive.Root
46+
class={cn(buttonVariants({ variant: local.variant, size: local.size }), local.class)}
47+
{...others}
48+
/>
49+
);
50+
};
51+
52+
export { Button, buttonVariants };
53+
export type { ButtonProps };

dev/components/ui/card.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { Component, ComponentProps } from "solid-js";
2+
import { splitProps } from "solid-js";
3+
4+
import { cn } from "@/utils/cn";
5+
6+
const Card: Component<ComponentProps<"div">> = (props) => {
7+
const [local, others] = splitProps(props, ["class"]);
8+
return (
9+
<div
10+
class={cn("bg-card text-card-foreground rounded-lg border shadow-sm", local.class)}
11+
{...others}
12+
/>
13+
);
14+
};
15+
16+
const CardHeader: Component<ComponentProps<"div">> = (props) => {
17+
const [local, others] = splitProps(props, ["class"]);
18+
return <div class={cn("flex flex-col space-y-1.5 p-6", local.class)} {...others} />;
19+
};
20+
21+
const CardTitle: Component<ComponentProps<"h3">> = (props) => {
22+
const [local, others] = splitProps(props, ["class"]);
23+
return (
24+
<h3 class={cn("text-lg font-semibold leading-none tracking-tight", local.class)} {...others} />
25+
);
26+
};
27+
28+
const CardDescription: Component<ComponentProps<"p">> = (props) => {
29+
const [local, others] = splitProps(props, ["class"]);
30+
return <p class={cn("text-muted-foreground text-sm", local.class)} {...others} />;
31+
};
32+
33+
const CardContent: Component<ComponentProps<"div">> = (props) => {
34+
const [local, others] = splitProps(props, ["class"]);
35+
return <div class={cn("p-6 pt-0", local.class)} {...others} />;
36+
};
37+
38+
const CardFooter: Component<ComponentProps<"div">> = (props) => {
39+
const [local, others] = splitProps(props, ["class"]);
40+
return <div class={cn("flex items-center p-6 pt-0", local.class)} {...others} />;
41+
};
42+
43+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };

0 commit comments

Comments
 (0)