diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4771846f..64db0b2e 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,7 +1,6 @@ { "recommendations": [ "Vue.volar", - "Vue.vscode-typescript-vue-plugin", "dbaeumer.vscode-eslint" ] } diff --git a/apps/www/.vitepress/config.mts b/apps/www/.vitepress/config.mts index b6cf67bd..69ffd5f9 100644 --- a/apps/www/.vitepress/config.mts +++ b/apps/www/.vitepress/config.mts @@ -74,7 +74,7 @@ export default defineConfig({ css: { postcss: { plugins: [ - tailwind(), + tailwind() as any, autoprefixer(), ], }, diff --git a/apps/www/.vitepress/theme/components/CustomizerCode.vue b/apps/www/.vitepress/theme/components/CustomizerCode.vue index a66dad1b..27aa6608 100644 --- a/apps/www/.vitepress/theme/components/CustomizerCode.vue +++ b/apps/www/.vitepress/theme/components/CustomizerCode.vue @@ -15,7 +15,7 @@ const { copy, copied } = useClipboard() const codeRef = ref() async function copyCode() { - await copy(codeRef.value?.innerText.replace(/\u00A0/g, ' ') ?? '') + await copy(codeRef.value?.textContent?.replace(/\u00A0/g, ' ') ?? '') } diff --git a/apps/www/.vitepress/theme/components/ExamplesNav.vue b/apps/www/.vitepress/theme/components/ExamplesNav.vue index d1b930b6..7176d942 100644 --- a/apps/www/.vitepress/theme/components/ExamplesNav.vue +++ b/apps/www/.vitepress/theme/components/ExamplesNav.vue @@ -8,6 +8,11 @@ import ArrowRightIcon from '~icons/radix-icons/arrow-right' const { path } = toRefs(useRoute()) const examples = [ + { + name: 'Mail', + href: '/examples/mail', + code: 'https://github.com/radix-vue/shadcn-vue/tree/dev/apps/www/src/examples/mail', + }, { name: 'Dashboard', href: '/examples/dashboard', @@ -58,7 +63,7 @@ const currentExample = computed(() => examples.find(ex => path.value.startsWith( :href="example.href" :class="cn( 'flex items-center px-4', - path?.startsWith(example.href) || (path === '/' && example.name === 'Dashboard') + path?.startsWith(example.href) || (path === '/' && example.name === 'Mail') ? 'font-bold text-primary' : 'font-medium text-muted-foreground', )" diff --git a/apps/www/.vitepress/theme/components/InlineThemePicker.vue b/apps/www/.vitepress/theme/components/InlineThemePicker.vue new file mode 100644 index 00000000..5a3cd7b7 --- /dev/null +++ b/apps/www/.vitepress/theme/components/InlineThemePicker.vue @@ -0,0 +1,54 @@ + + + diff --git a/apps/www/.vitepress/theme/components/LandingPage.vue b/apps/www/.vitepress/theme/components/LandingPage.vue index 9dcff16c..a5b88a17 100644 --- a/apps/www/.vitepress/theme/components/LandingPage.vue +++ b/apps/www/.vitepress/theme/components/LandingPage.vue @@ -11,7 +11,7 @@ import { buttonVariants } from '@/lib/registry/new-york/ui/button' import { Separator } from '@/lib/registry/new-york/ui/separator' import { cn } from '@/lib/utils' -import DashboardExample from '@/examples/dashboard/Example.vue' +import MailExample from '@/examples/mail/Example.vue' diff --git a/apps/www/.vitepress/theme/components/Logo.vue b/apps/www/.vitepress/theme/components/Logo.vue index 6434db52..3d0b8252 100644 --- a/apps/www/.vitepress/theme/components/Logo.vue +++ b/apps/www/.vitepress/theme/components/Logo.vue @@ -2,7 +2,7 @@ -``` \ No newline at end of file +``` + +## Examples + +### Form + + diff --git a/apps/www/src/content/docs/dark-mode.md b/apps/www/src/content/docs/dark-mode.md new file mode 100644 index 00000000..41d2d34d --- /dev/null +++ b/apps/www/src/content/docs/dark-mode.md @@ -0,0 +1,39 @@ +--- +title: Dark Mode +description: Adding dark mode to your site. +--- + + + +
+ + +

Vite

+
+ + + +

Nuxt

+
+ + + + + + + + +

Vitepress

+
+ + + +

Astro

+
+
diff --git a/apps/www/src/content/docs/dark-mode/astro.md b/apps/www/src/content/docs/dark-mode/astro.md new file mode 100644 index 00000000..9c50a798 --- /dev/null +++ b/apps/www/src/content/docs/dark-mode/astro.md @@ -0,0 +1,116 @@ +--- +title: Astro +description: Adding dark mode to your astro app. +--- + +## Dark mode + + + +### Create an inline theme script + +```astro title="src/pages/index.astro" +--- +import '../styles/globals.css' +--- + + + + + +

Astro

+ + + +``` + +### Install Dependencies + +```bash +npm install @vueuse/core +``` + +Optional, to include icons for theme button. +```bash +npm install -D @iconify/vue @iconify-json/radix-icons +``` + +### Add a mode toggle + +Place a mode toggle on your site to toggle between light and dark mode. + +We're using [`useColorMode`](https://vueuse.org/core/usecolormode/) from [`@vueuse/core`](https://vueuse.org/core/). +> Reactive color mode (dark / light / customs) with auto data persistence. + +```vue + + + +``` + +### Display the mode toggle + +Place a mode toggle on your site to toggle between light and dark mode. + +```astro title="src/pages/index.astro" +--- +import '../styles/globals.css' +import { ModeToggle } from '@/components/ModeToggle.vue'; +--- + + + + + +

Astro

+ + + +``` + +
diff --git a/apps/www/src/content/docs/dark-mode/nuxt.md b/apps/www/src/content/docs/dark-mode/nuxt.md new file mode 100644 index 00000000..4bf1150c --- /dev/null +++ b/apps/www/src/content/docs/dark-mode/nuxt.md @@ -0,0 +1,74 @@ +--- +title: Nuxt +description: Adding dark mode to your nuxt app. +--- + +## Dark mode + + + +### Install Dependencies + +```bash +npm install -D @nuxtjs/color-mode +``` + +Then, add `@nuxtjs/color-mode` to the modules section of your `nuxt.config.ts` + +```ts +export default defineNuxtConfig({ + modules: [ + '@nuxtjs/tailwindcss', + '@nuxtjs/color-mode' + ], + colorMode: { + classSuffix: '' + } +}) +``` + +Optional, to include icons for theme button. +```bash +npm install -D @iconify/vue @iconify-json/radix-icons +``` + +### Add a mode toggle + +Place a mode toggle on your site to toggle between light and dark mode. + +We're using [`useColorMode`](https://color-mode.nuxtjs.org/#usage) from [`Nuxt Color Mode`](https://color-mode.nuxtjs.org/). + +```vue + + + +``` + + diff --git a/apps/www/src/content/docs/dark-mode/vite.md b/apps/www/src/content/docs/dark-mode/vite.md new file mode 100644 index 00000000..921af076 --- /dev/null +++ b/apps/www/src/content/docs/dark-mode/vite.md @@ -0,0 +1,62 @@ +--- +title: Vite +description: Adding dark mode to your vite app. +--- + +## Dark mode + + + +### Install Dependencies + +```bash +npm install @vueuse/core +``` + +Optional, to include icons for theme button. +```bash +npm install -D @iconify/vue @iconify-json/radix-icons +``` + +### Add a mode toggle + +Place a mode toggle on your site to toggle between light and dark mode. + +We're using [`useColorMode`](https://vueuse.org/core/usecolormode/) from [`@vueuse/core`](https://vueuse.org/core/). +> Reactive color mode (dark / light / customs) with auto data persistence. + +```vue + + + +``` + + diff --git a/apps/www/src/content/docs/dark-mode/vitepress.md b/apps/www/src/content/docs/dark-mode/vitepress.md new file mode 100644 index 00000000..1006bcc6 --- /dev/null +++ b/apps/www/src/content/docs/dark-mode/vitepress.md @@ -0,0 +1,47 @@ +--- +title: Vitepress +description: Adding dark mode to your vitepress app. +--- + +## Dark mode + + + +### Install Dependencies + +```bash +npm install @vueuse/core +``` + +Optional, to include icons for theme button. +```bash +npm install -D @iconify/vue @iconify-json/radix-icons +``` + +### Add a mode toggle + +Place a mode toggle on your site to toggle between light and dark mode. + +We're using [`useToggle`](https://vueuse.org/shared/useToggle/) from [`@vueuse/core`](https://vueuse.org/core/). +> A boolean switcher with utility functions. + +```vue + + + +``` + + diff --git a/apps/www/src/content/docs/installation/vite.md b/apps/www/src/content/docs/installation/vite.md index 65fc6d67..e4f1747b 100644 --- a/apps/www/src/content/docs/installation/vite.md +++ b/apps/www/src/content/docs/installation/vite.md @@ -21,8 +21,6 @@ npm create vite@latest my-vue-app -- --template vue-ts Install `tailwindcss` and its peer dependencies, then generate your `tailwind.config.js` and configure `postcss` plugins - - @@ -59,7 +57,6 @@ Install `tailwindcss` and its peer dependencies, then generate your `tailwind.co - ```bash @@ -80,7 +77,6 @@ Install `tailwindcss` and its peer dependencies, then generate your `tailwind.co - ### Edit tsconfig.json Add the code below to the compilerOptions of your tsconfig.json so your app can resolve paths without error @@ -107,11 +103,14 @@ Add the code below to the vite.config.ts so your app can resolve paths without e npm i -D @types/node ``` -```typescript {12-16} +```typescript {15-19} import path from "path" import vue from "@vitejs/plugin-vue" import { defineConfig } from "vite" +import tailwind from "tailwindcss" +import autoprefixer from "autoprefixer" + export default defineConfig({ css: { postcss: { @@ -148,7 +147,7 @@ Where is your global CSS file? › › src/index.css Do you want to use CSS variables for colors? › no / yes Where is your tailwind.config.js located? › tailwind.config.js Configure the import alias for components: › @/components -Configure the import alias for utils: › @/lib/utils +Configure the import alias for utils: › @/lib/utils ``` ### That's it diff --git a/apps/www/src/content/examples/mail.md b/apps/www/src/content/examples/mail.md new file mode 100644 index 00000000..d5a4e872 --- /dev/null +++ b/apps/www/src/content/examples/mail.md @@ -0,0 +1,5 @@ + + + diff --git a/apps/www/src/examples/forms/components/AppearanceForm.vue b/apps/www/src/examples/forms/components/AppearanceForm.vue index 9a37f15c..f1fafc2e 100644 --- a/apps/www/src/examples/forms/components/AppearanceForm.vue +++ b/apps/www/src/examples/forms/components/AppearanceForm.vue @@ -72,7 +72,7 @@ const onSubmit = handleSubmit((values) => { - + Set the font you want to use in the dashboard. diff --git a/apps/www/src/examples/mail/Example.vue b/apps/www/src/examples/mail/Example.vue new file mode 100644 index 00000000..f883c3ab --- /dev/null +++ b/apps/www/src/examples/mail/Example.vue @@ -0,0 +1,30 @@ + + + diff --git a/apps/www/src/examples/mail/components/AccountSwitcher.vue b/apps/www/src/examples/mail/components/AccountSwitcher.vue new file mode 100644 index 00000000..7f37a978 --- /dev/null +++ b/apps/www/src/examples/mail/components/AccountSwitcher.vue @@ -0,0 +1,49 @@ + + + diff --git a/apps/www/src/examples/mail/components/Mail.vue b/apps/www/src/examples/mail/components/Mail.vue new file mode 100644 index 00000000..3209ee8d --- /dev/null +++ b/apps/www/src/examples/mail/components/Mail.vue @@ -0,0 +1,223 @@ + + + diff --git a/apps/www/src/examples/mail/components/MailDisplay.vue b/apps/www/src/examples/mail/components/MailDisplay.vue new file mode 100644 index 00000000..c783b363 --- /dev/null +++ b/apps/www/src/examples/mail/components/MailDisplay.vue @@ -0,0 +1,236 @@ + + +