Skip to content

Commit d9149b5

Browse files
docs revamp 1/2 (#899)
* remove starlight, start our own thing * k * k * fmt * fix dark mode flickering on navigation * fmt --------- Co-authored-by: valls <valls@deco.cx>
1 parent 510492c commit d9149b5

58 files changed

Lines changed: 3806 additions & 147 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
"engines": {
2121
"node": ">=18.0.0",
2222
"npm": ">=8.0.0"
23+
},
24+
"dependencies": {
25+
"zod": "^3.24.3"
2326
}
2427
}

docs/server/deco.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// deno-lint-ignore-file no-empty-interface
1+
// deno-lint-ignore-file
22

33
/* eslint-disable */
44
/**

docs/view/astro.config.mjs

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
11
// @ts-check
22
import { defineConfig } from "astro/config";
3-
import starlight from "@astrojs/starlight";
43
import tailwindcss from "@tailwindcss/vite";
54

5+
import mdx from "@astrojs/mdx";
6+
7+
import react from "@astrojs/react";
8+
69
// https://astro.build/config
710
export default defineConfig({
811
server: {
912
port: 4000,
1013
},
1114
outDir: "../server/view-build/",
15+
i18n: {
16+
locales: ["en", "pt-br"],
17+
defaultLocale: "en",
18+
routing: {
19+
prefixDefaultLocale: true,
20+
},
21+
},
1222
integrations: [
13-
starlight({
14-
title: "Deco",
15-
social: [{
16-
icon: "github",
17-
label: "GitHub",
18-
href: "https://github.com/deco-cx/chat",
19-
}],
20-
sidebar: [
21-
{
22-
label: "Guides",
23-
items: [
24-
// Each item here is one entry in the navigation menu.
25-
{ label: "Example Guide", slug: "guides/example" },
26-
],
27-
},
28-
{
29-
label: "Reference",
30-
autogenerate: { directory: "reference" },
31-
},
23+
mdx({
24+
rehypePlugins: [
25+
// rehype-mdx-code-props must run last according to docs
3226
],
33-
customCss: ["./src/styles/global.css"],
3427
}),
28+
react(),
3529
],
3630
vite: {
37-
plugins: [tailwindcss()],
31+
plugins: [
32+
// @ts-ignore: tailwindcss plugin type issue
33+
tailwindcss(),
34+
],
3835
},
3936
});

docs/view/package.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,23 @@
1010
"astro": "astro"
1111
},
1212
"dependencies": {
13-
"@astrojs/starlight": "^0.35.1",
14-
"@astrojs/starlight-tailwind": "^4.0.1",
13+
"@astrojs/check": "^0.9.4",
14+
"@astrojs/mdx": "^4.3.1",
15+
"@astrojs/react": "^4.3.0",
1516
"@tailwindcss/vite": "^4.0.7",
17+
"@types/react": "^19.1.8",
18+
"@types/react-dom": "^19.1.6",
1619
"astro": "^5.6.1",
20+
"lucide-react": "^0.525.0",
21+
"react": "^19.1.0",
22+
"react-dom": "^19.1.0",
23+
"rehype-mdx-code-props": "^3.0.1",
1724
"sharp": "^0.34.2",
18-
"tailwindcss": "^4.0.7"
25+
"shiki": "^3.8.1",
26+
"tailwindcss": "^4.0.7",
27+
"typescript": "^5.8.3"
28+
},
29+
"devDependencies": {
30+
"@tailwindcss/typography": "^0.5.16"
1931
}
2032
}

docs/view/src/assets/deco-dark.svg

Lines changed: 16 additions & 0 deletions
Loading
Lines changed: 16 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
const { title } = Astro.props;
3+
---
4+
5+
<title>{title}</title>
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import type { HTMLAttributes, ReactNode } from "react";
2+
3+
type ButtonVariant =
4+
| "default"
5+
| "destructive"
6+
| "outline"
7+
| "secondary"
8+
| "ghost"
9+
| "link";
10+
11+
type ButtonSize = "default" | "sm" | "lg" | "icon";
12+
13+
interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {
14+
variant?: ButtonVariant;
15+
size?: ButtonSize;
16+
asChild?: boolean;
17+
children?: ReactNode;
18+
disabled?: boolean;
19+
type?: "button" | "submit" | "reset";
20+
}
21+
22+
function getButtonClasses(
23+
variant: ButtonVariant = "default",
24+
size: ButtonSize = "default",
25+
): string {
26+
// Base classes
27+
const baseClasses =
28+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-xl text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] cursor-pointer";
29+
30+
// Variant classes
31+
const variantClasses = {
32+
default: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
33+
destructive:
34+
"bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20",
35+
outline:
36+
"border text-foreground bg-background shadow-xs hover:bg-accent hover:text-accent-foreground border-border",
37+
secondary:
38+
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
39+
ghost: "hover:bg-accent hover:text-accent-foreground",
40+
link: "text-primary underline-offset-4 hover:underline",
41+
};
42+
43+
// Size classes
44+
const sizeClasses = {
45+
default: "h-10 px-4 py-2",
46+
sm: "h-8 gap-1.5 px-3",
47+
lg: "h-10 px-6",
48+
icon: "size-10",
49+
};
50+
51+
return `${baseClasses} ${variantClasses[variant]} ${sizeClasses[size]}`;
52+
}
53+
54+
export function Button({
55+
className = "",
56+
variant = "default",
57+
size = "default",
58+
children,
59+
disabled = false,
60+
type = "button",
61+
...props
62+
}: ButtonProps) {
63+
const buttonClasses = getButtonClasses(variant, size);
64+
65+
return (
66+
<button
67+
type={type}
68+
disabled={disabled}
69+
className={`${buttonClasses} ${className}`}
70+
{...props}
71+
>
72+
{children}
73+
</button>
74+
);
75+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
---
3+
4+
<footer class="p-4 bg-gray-100 border-t">
5+
<p>Footer</p>
6+
</footer>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
import LanguagePicker from "./LanguagePicker.astro";
3+
import { ui } from '../i18n/ui';
4+
import { useTranslations } from "../i18n/utils";
5+
6+
const locale = Astro.params.locale;
7+
const t = useTranslations(locale as keyof typeof ui);
8+
---
9+
10+
<nav class="flex justify-between items-center gap-4 p-4 bg-gray-100 border-b">
11+
<div class="flex gap-4">
12+
<a href={`/${locale}`}>{t("head.title")}</a>
13+
<a href="#">Posts</a>
14+
<a href="#">Contact</a>
15+
</div>
16+
<LanguagePicker />
17+
</nav>

0 commit comments

Comments
 (0)