From 56f473ccc1e07a7577c18097a4a5e47756299b9d Mon Sep 17 00:00:00 2001 From: zernonia Date: Mon, 4 Sep 2023 11:30:01 +0800 Subject: [PATCH] feat: add scrollarea, nav menu --- apps/www/.vitepress/theme/config/docs.ts | 24 ++-- apps/www/.vitepress/theme/styles/vp-doc.css | 14 +-- .../docs/components/navigation-menu.md | 61 ++++++++++ .../default/examples/NavigationMenuDemo.vue | 110 ++++++++++++++++++ .../examples/NavigationMenuDemoItem.vue | 27 +++++ .../ui/navigation-menu/NavigationMenu.vue | 15 +-- .../navigation-menu/NavigationMenuContent.vue | 6 +- .../NavigationMenuIndicator.vue | 15 +++ .../ui/navigation-menu/NavigationMenuLink.vue | 4 +- .../NavigationMenuListItem.vue | 27 ----- .../navigation-menu/NavigationMenuTrigger.vue | 12 +- .../NavigationMenuViewport.vue | 23 ++++ .../default/ui/navigation-menu/index.ts | 7 +- .../lib/registry/default/ui/select/Select.vue | 7 +- 14 files changed, 275 insertions(+), 77 deletions(-) create mode 100644 apps/www/src/content/docs/components/navigation-menu.md create mode 100644 apps/www/src/lib/registry/default/examples/NavigationMenuDemo.vue create mode 100644 apps/www/src/lib/registry/default/examples/NavigationMenuDemoItem.vue create mode 100644 apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenuIndicator.vue delete mode 100644 apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenuListItem.vue create mode 100644 apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenuViewport.vue diff --git a/apps/www/.vitepress/theme/config/docs.ts b/apps/www/.vitepress/theme/config/docs.ts index d3e1e941..1e976337 100644 --- a/apps/www/.vitepress/theme/config/docs.ts +++ b/apps/www/.vitepress/theme/config/docs.ts @@ -219,13 +219,11 @@ export const docsConfig: DocsConfig = { href: '/docs/components/menubar', items: [], }, - // { - // title: "Navigation Menu", - // href: "#", - // label: "Soon", - // disabled: true, - // items: [] - // }, + { + title: 'Navigation Menu', + href: '/docs/components/navigation-menu', + items: [], + }, { title: 'Popover', href: '/docs/components/popover', @@ -241,13 +239,11 @@ export const docsConfig: DocsConfig = { href: '/docs/components/radio-group', items: [], }, - // { - // title: "Scroll Area", - // href: "#", - // label: "Soon", - // disabled: true, - // items: [] - // }, + { + title: 'Scroll Area', + href: '/docs/components/scroll-area', + items: [], + }, { title: 'Select', href: '/docs/components/select', diff --git a/apps/www/.vitepress/theme/styles/vp-doc.css b/apps/www/.vitepress/theme/styles/vp-doc.css index fe34f209..168f70c6 100644 --- a/apps/www/.vitepress/theme/styles/vp-doc.css +++ b/apps/www/.vitepress/theme/styles/vp-doc.css @@ -138,26 +138,26 @@ * Lists * -------------------------------------------------------------------------- */ -.vp-doc ul, -.vp-doc ol { +.vp-doc ul:not(:where(.preview *)), +.vp-doc ol:not(:where(.preview *)) { padding-left: 1.25rem; margin: 16px 0; } -.vp-doc ul { +.vp-doc ul:not(:where(.preview *)) { list-style: disc; } -.vp-doc ol { +.vp-doc ol:not(:where(.preview *)) { list-style: decimal; } -.vp-doc li + li { +.vp-doc li + li:not(:where(.preview *)) { margin-top: 8px; } -.vp-doc li > ol, -.vp-doc li > ul { +.vp-doc li > ol:not(:where(.preview *)), +.vp-doc li > ul:not(:where(.preview *)) { margin: 8px 0 0; } diff --git a/apps/www/src/content/docs/components/navigation-menu.md b/apps/www/src/content/docs/components/navigation-menu.md new file mode 100644 index 00000000..3e103b96 --- /dev/null +++ b/apps/www/src/content/docs/components/navigation-menu.md @@ -0,0 +1,61 @@ +--- +title: Navigation Menu +description: A collection of links for navigating websites. +source: https://github.com/radix-vue/shadcn-vue/tree/main/apps/www/src/lib/registry/default/ui/navigation-menu +primitive: https://www.radix-vue.com/components/navigation-menu.html +--- + + + +<<< ../../../lib/registry/default/examples/NavigationMenuDemo.vue + + + + + +## Installation + +```bash +npx shadcn-vue@latest add navigation-menu +``` + + + +1. Install `radix-vue`: + +```bash +npm install radix-vue +``` + +2. Copy and paste the component source files linked at the top of this page into your project. + + +## Usage + +```vue + + + +``` \ No newline at end of file diff --git a/apps/www/src/lib/registry/default/examples/NavigationMenuDemo.vue b/apps/www/src/lib/registry/default/examples/NavigationMenuDemo.vue new file mode 100644 index 00000000..de8b0a22 --- /dev/null +++ b/apps/www/src/lib/registry/default/examples/NavigationMenuDemo.vue @@ -0,0 +1,110 @@ + + + diff --git a/apps/www/src/lib/registry/default/examples/NavigationMenuDemoItem.vue b/apps/www/src/lib/registry/default/examples/NavigationMenuDemoItem.vue new file mode 100644 index 00000000..deeb0f25 --- /dev/null +++ b/apps/www/src/lib/registry/default/examples/NavigationMenuDemoItem.vue @@ -0,0 +1,27 @@ + + + diff --git a/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenu.vue b/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenu.vue index 74a65c7a..39d79fb2 100644 --- a/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenu.vue +++ b/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenu.vue @@ -3,8 +3,8 @@ import { NavigationMenuRoot, type NavigationMenuRootEmits, type NavigationMenuRootProps, - NavigationMenuViewport, } from 'radix-vue' +import NavigationMenuViewport from './NavigationMenuViewport.vue' import { cn } from '@/lib/utils' const props = defineProps() @@ -15,19 +15,10 @@ const emits = defineEmits() diff --git a/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenuContent.vue b/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenuContent.vue index e2a48c49..6e981811 100644 --- a/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenuContent.vue +++ b/apps/www/src/lib/registry/default/ui/navigation-menu/NavigationMenuContent.vue @@ -4,7 +4,7 @@ import { type NavigationMenuContentEmits, type NavigationMenuContentProps, } from 'radix-vue' -import { cn } from '@/lib/utils' +import { cn, useEmitAsProps } from '@/lib/utils' const props = defineProps() @@ -13,10 +13,10 @@ const emits = defineEmits()