From 5564c3a44946d8a07278b9735ce538f68fab8884 Mon Sep 17 00:00:00 2001 From: Ilya Artamonov Date: Mon, 25 Sep 2023 16:53:19 +0300 Subject: [PATCH] feat: Sidebar component (#205) --- docs/.vitepress/config.mts | 2 +- docs/components/sidebar.md | 763 +++++++++++++++++- .../sidebar/examples/SidebarCtaExample.vue | 139 ++++ .../examples/SidebarDropdownExample.vue | 63 ++ .../sidebar/examples/SidebarExample.vue | 126 ++- .../sidebar/examples/SidebarGroupExample.vue | 191 +++++ .../sidebar/examples/SidebarLogoExample.vue | 129 +++ docs/pages/getting-started.md | 2 +- src/components/Sidebar/Sidebar.vue | 141 +--- src/components/Sidebar/SidebarCta.vue | 38 + .../Sidebar/SidebarDropdownItem.vue | 56 ++ src/components/Sidebar/SidebarItem.vue | 26 + src/components/Sidebar/SidebarItemGroup.vue | 17 + src/components/Sidebar/SidebarLogo.vue | 29 + src/index.ts | 5 + 15 files changed, 1586 insertions(+), 141 deletions(-) create mode 100644 docs/components/sidebar/examples/SidebarCtaExample.vue create mode 100644 docs/components/sidebar/examples/SidebarDropdownExample.vue create mode 100644 docs/components/sidebar/examples/SidebarGroupExample.vue create mode 100644 docs/components/sidebar/examples/SidebarLogoExample.vue create mode 100644 src/components/Sidebar/SidebarCta.vue create mode 100644 src/components/Sidebar/SidebarDropdownItem.vue create mode 100644 src/components/Sidebar/SidebarItem.vue create mode 100644 src/components/Sidebar/SidebarItemGroup.vue create mode 100644 src/components/Sidebar/SidebarLogo.vue diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 6279049..6a2b2db 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -58,7 +58,7 @@ function getComponents() { { text: 'Modal', link: '/components/modal' }, { text: 'Navbar', link: '/components/navbar' }, { text: 'Footer', link: '/components/footer' }, - { text: '- Sidebar', link: '/components/sidebar' }, + { text: 'Sidebar', link: '/components/sidebar' }, ] } diff --git a/docs/components/sidebar.md b/docs/components/sidebar.md index ec818ee..3b51ffd 100644 --- a/docs/components/sidebar.md +++ b/docs/components/sidebar.md @@ -1,15 +1,762 @@ # Vue Sidebar - Flowbite +#### Use the sidebar component to show a list of menu items and multi-level menu items on either side of the page to navigate on your website +The sidebar component can be used as a complementary element relative to the navbar shown on either the left or right side of the page used for the navigation on your web application, including menu items, multi-level menu items, call to actions elements, and more. -```vue - - -``` +## Default sidebar +Use this example to show a responsive list of menu items inside the sidebar with icons and labels. + +```vue + + + +``` + +## Multi-level menu +Use this sidebar example to create multi-level menu items by using the SidebarDropdownItem component. + + + +```vue + + +``` + +## Content separator + + + +```vue + + +``` + +## CTA button + + + +```vue + + +``` + +## Logo branding + + + +```vue + + +``` + + +## API + +### Sidebar component + +#### Slots +| Name | Description | +|---------|-----------------| +| default | Sidebar content | + + +### SidebarCta component + +#### Slots +| Name | Description | +|---------|-----------------| +| default | Sidebar content | + +#### Props +| Name | type | +|-------|----------| +| label | `string` | + +#### Events +| Name | Description | +|-------|----------------------| +| close | close button clicked | + +### SidebarDropdownItem component + +#### Slots +| Name | Description | +|------------|--------------------------| +| default | Dropdown content | +| icon | Dropdown item icon | +| trigger | Dropdown text | +| arrow-icon | Dropdown item arrow icon | + + +### SidebarItem + +#### Slots +| Name | Description | +|---------|-----------------| +| default | Sidebar content | +| icon | Item icon | +| suffix | suffix content | + +#### Props +| Name | type | default | +|------|----------|-------------| +| link | `string` | / | +| tag | `string` | router-link | + + +### SidebarItemGroup + +#### Slots +| Name | Description | +|---------|---------------| +| default | Group content | + + +#### Props +| Name | type | default | +|--------|-----------|---------| +| border | `boolean` | `false` | + + +### SidebarLogo + +#### Props +| Name | type | default | +|------|----------|---------------| +| name | `string` | | +| link | `string` | `/` | +| logo | `string` | | +| tag | `string` | `router-link` | + diff --git a/docs/components/sidebar/examples/SidebarCtaExample.vue b/docs/components/sidebar/examples/SidebarCtaExample.vue new file mode 100644 index 0000000..767c3ed --- /dev/null +++ b/docs/components/sidebar/examples/SidebarCtaExample.vue @@ -0,0 +1,139 @@ + + diff --git a/docs/components/sidebar/examples/SidebarDropdownExample.vue b/docs/components/sidebar/examples/SidebarDropdownExample.vue new file mode 100644 index 0000000..0993e0b --- /dev/null +++ b/docs/components/sidebar/examples/SidebarDropdownExample.vue @@ -0,0 +1,63 @@ + + diff --git a/docs/components/sidebar/examples/SidebarExample.vue b/docs/components/sidebar/examples/SidebarExample.vue index b966b77..d518a17 100644 --- a/docs/components/sidebar/examples/SidebarExample.vue +++ b/docs/components/sidebar/examples/SidebarExample.vue @@ -1,8 +1,128 @@ diff --git a/docs/components/sidebar/examples/SidebarGroupExample.vue b/docs/components/sidebar/examples/SidebarGroupExample.vue new file mode 100644 index 0000000..7d088a1 --- /dev/null +++ b/docs/components/sidebar/examples/SidebarGroupExample.vue @@ -0,0 +1,191 @@ + + diff --git a/docs/components/sidebar/examples/SidebarLogoExample.vue b/docs/components/sidebar/examples/SidebarLogoExample.vue new file mode 100644 index 0000000..95a2015 --- /dev/null +++ b/docs/components/sidebar/examples/SidebarLogoExample.vue @@ -0,0 +1,129 @@ + + diff --git a/docs/pages/getting-started.md b/docs/pages/getting-started.md index d572122..9ede73b 100644 --- a/docs/pages/getting-started.md +++ b/docs/pages/getting-started.md @@ -10,7 +10,7 @@ Make sure that you have [Node.js](https://nodejs.org/en/) and [Tailwind CSS](htt 1. Install `flowbite` and `flowbite-vue` as a dependency using NPM by running the following command: -```text +```bash npm i flowbite flowbite-vue ``` diff --git a/src/components/Sidebar/Sidebar.vue b/src/components/Sidebar/Sidebar.vue index 9a780dc..ed5d9f8 100644 --- a/src/components/Sidebar/Sidebar.vue +++ b/src/components/Sidebar/Sidebar.vue @@ -1,135 +1,20 @@ + diff --git a/src/components/Sidebar/SidebarCta.vue b/src/components/Sidebar/SidebarCta.vue new file mode 100644 index 0000000..df267be --- /dev/null +++ b/src/components/Sidebar/SidebarCta.vue @@ -0,0 +1,38 @@ + + + diff --git a/src/components/Sidebar/SidebarDropdownItem.vue b/src/components/Sidebar/SidebarDropdownItem.vue new file mode 100644 index 0000000..d918dee --- /dev/null +++ b/src/components/Sidebar/SidebarDropdownItem.vue @@ -0,0 +1,56 @@ + + + diff --git a/src/components/Sidebar/SidebarItem.vue b/src/components/Sidebar/SidebarItem.vue new file mode 100644 index 0000000..0ff20ea --- /dev/null +++ b/src/components/Sidebar/SidebarItem.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/components/Sidebar/SidebarItemGroup.vue b/src/components/Sidebar/SidebarItemGroup.vue new file mode 100644 index 0000000..86dbb9c --- /dev/null +++ b/src/components/Sidebar/SidebarItemGroup.vue @@ -0,0 +1,17 @@ + + + diff --git a/src/components/Sidebar/SidebarLogo.vue b/src/components/Sidebar/SidebarLogo.vue new file mode 100644 index 0000000..fcd0c89 --- /dev/null +++ b/src/components/Sidebar/SidebarLogo.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/index.ts b/src/index.ts index 828df07..ae68cd1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,6 +36,11 @@ export { default as Pagination } from './components/Pagination/Pagination.vue' export { default as Progress } from './components/Progress/Progress.vue' export { default as Rating } from './components/Rating/Rating.vue' export { default as Sidebar } from './components/Sidebar/Sidebar.vue' +export { default as SidebarCta } from './components/Sidebar/SidebarCta.vue' +export { default as SidebarDropdownItem } from './components/Sidebar/SidebarDropdownItem.vue' +export { default as SidebarItem } from './components/Sidebar/SidebarItem.vue' +export { default as SidebarItemGroup } from './components/Sidebar/SidebarItemGroup.vue' +export { default as SidebarLogo } from './components/Sidebar/SidebarLogo.vue' export { default as Table } from './components/Table/Table.vue' export { default as TableHead } from './components/Table/TableHead.vue' export { default as TableBody } from './components/Table/TableBody.vue'