From 8298ec98fc00cdafb6717cec988019a4d0dfc358 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Thu, 11 Apr 2024 15:54:46 +0800 Subject: [PATCH 1/4] [Components] Add card --- src/data/Navigation.ts | 9 ++++- src/i18n/langs/en/Common.ts | 1 + src/i18n/langs/zhCn/Common.ts | 1 + src/router/default.ts | 16 ++++++++ src/ui/button/button.vue | 28 +++++++++++++ src/ui/card/card.vue | 48 +++++++++++++++++++++++ src/ui/enum/Size.ts | 4 ++ src/views/pages/components/ButtonHome.vue | 11 ++++++ 8 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 src/ui/button/button.vue create mode 100644 src/ui/card/card.vue create mode 100644 src/ui/enum/Size.ts create mode 100644 src/views/pages/components/ButtonHome.vue diff --git a/src/data/Navigation.ts b/src/data/Navigation.ts index aec557e8..74b350bf 100644 --- a/src/data/Navigation.ts +++ b/src/data/Navigation.ts @@ -1,6 +1,6 @@ import { NavigationModel, NavigationPosition } from '@/model/Navigation' import NavigationService from '@/services/Navigation' -import { AudioWaveform, Ban, CircleOff, CreditCard, FormInput, Gauge, Link, LogIn, LogOut, StickyNote, MessageCircle } from 'lucide-vue-next' +import { AudioWaveform, Ban, CircleOff, Command, CreditCard, FormInput, Gauge, Link, LogIn, LogOut, MessageCircle, StickyNote } from 'lucide-vue-next' const createNavigation = (): void => { NavigationService.addNavigation(createNavigationItem('common.common.dashboard', undefined, '/dashboard', Gauge, NavigationPosition.LEFT_TOP)) @@ -63,7 +63,12 @@ const createNavigation = (): void => { NavigationPosition.LEFT_TOP, pageArray, undefined, 'common.common.page') NavigationService.addNavigation(pages) - const external = createNavigationItem('common.common.externalLink', undefined, 'https://datacap.edurt.io', Link, NavigationPosition.LEFT_TOP) + const button = createNavigationItem('common.common.button', undefined, '/components/button', undefined, NavigationPosition.LEFT_TOP) + const componentArray = [button] + const components = createNavigationItem('common.common.component', componentArray.length.toString(), '/components', Command, NavigationPosition.LEFT_TOP, componentArray) + NavigationService.addNavigation(components) + + const external = createNavigationItem('common.common.externalLink', undefined, 'https://datacap.devlive.org', Link, NavigationPosition.LEFT_TOP) external.external = true NavigationService.addNavigation(external) } diff --git a/src/i18n/langs/en/Common.ts b/src/i18n/langs/en/Common.ts index c1717cad..99182346 100644 --- a/src/i18n/langs/en/Common.ts +++ b/src/i18n/langs/en/Common.ts @@ -31,6 +31,7 @@ export default { replyMessage: 'This is a reply message', notFoundItem: 'Not Found Item', search: 'Search', + component: 'Component', }, tip: { signInInfo: 'Enter your information to sign in to your account.', diff --git a/src/i18n/langs/zhCn/Common.ts b/src/i18n/langs/zhCn/Common.ts index 593b7a30..1a5f129b 100644 --- a/src/i18n/langs/zhCn/Common.ts +++ b/src/i18n/langs/zhCn/Common.ts @@ -31,6 +31,7 @@ export default { replyMessage: '这是一条回复的消息', notFoundItem: '未找到该项', search: '搜索', + component: '组件', }, tip: { signInInfo: '输入您的信息以登录您的帐户。', diff --git a/src/router/default.ts b/src/router/default.ts index 77299e48..37639bec 100644 --- a/src/router/default.ts +++ b/src/router/default.ts @@ -44,6 +44,7 @@ const createDefaultRouter = (router: Router): void => { createHttpRouter(router) createUserRouter(router) createFormRouter(router) + createComponentRouter(router) } /** @@ -137,6 +138,21 @@ const createFormRouter = (router: Router): void => { }) } +const createComponentRouter = (router: Router): void => { + router.addRoute({ + path: '/components', + name: 'components', + component: LayoutContainer, + children: [ + { + name: 'button', + path: 'button', + component: () => import('@/views/pages/components/ButtonHome.vue') + } + ] + }) +} + export { createDefaultRouter } diff --git a/src/ui/button/button.vue b/src/ui/button/button.vue new file mode 100644 index 00000000..020eec4a --- /dev/null +++ b/src/ui/button/button.vue @@ -0,0 +1,28 @@ + + + diff --git a/src/ui/card/card.vue b/src/ui/card/card.vue new file mode 100644 index 00000000..76d4bc15 --- /dev/null +++ b/src/ui/card/card.vue @@ -0,0 +1,48 @@ + + + \ No newline at end of file diff --git a/src/ui/enum/Size.ts b/src/ui/enum/Size.ts new file mode 100644 index 00000000..f9d98262 --- /dev/null +++ b/src/ui/enum/Size.ts @@ -0,0 +1,4 @@ +export enum Size +{ + default = 'w-8 h-8', +} \ No newline at end of file diff --git a/src/views/pages/components/ButtonHome.vue b/src/views/pages/components/ButtonHome.vue new file mode 100644 index 00000000..4fa9ce1e --- /dev/null +++ b/src/views/pages/components/ButtonHome.vue @@ -0,0 +1,11 @@ + + + From 7666902264fb9d9458de9147535003d2f9e25c22 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Thu, 11 Apr 2024 17:12:16 +0800 Subject: [PATCH 2/4] [Components] Add button --- src/i18n/langs/en/Common.ts | 3 + src/i18n/langs/zhCn/Common.ts | 3 + src/ui/button/button.vue | 67 ++++++++++-- src/ui/card/card.vue | 2 +- src/ui/enum/Size.ts | 6 +- src/ui/enum/Type.ts | 9 ++ src/views/pages/components/ButtonHome.vue | 123 +++++++++++++++++++++- 7 files changed, 202 insertions(+), 11 deletions(-) create mode 100644 src/ui/enum/Type.ts diff --git a/src/i18n/langs/en/Common.ts b/src/i18n/langs/en/Common.ts index 99182346..b2b84e40 100644 --- a/src/i18n/langs/en/Common.ts +++ b/src/i18n/langs/en/Common.ts @@ -32,6 +32,9 @@ export default { notFoundItem: 'Not Found Item', search: 'Search', component: 'Component', + size: 'Size', + type: 'Type', + icon: 'Icon', }, tip: { signInInfo: 'Enter your information to sign in to your account.', diff --git a/src/i18n/langs/zhCn/Common.ts b/src/i18n/langs/zhCn/Common.ts index 1a5f129b..f631b28b 100644 --- a/src/i18n/langs/zhCn/Common.ts +++ b/src/i18n/langs/zhCn/Common.ts @@ -32,6 +32,9 @@ export default { notFoundItem: '未找到该项', search: '搜索', component: '组件', + size: '尺寸', + type: '类型', + icon: '图标', }, tip: { signInInfo: '输入您的信息以登录您的帐户。', diff --git a/src/ui/button/button.vue b/src/ui/button/button.vue index 020eec4a..7ba45a77 100644 --- a/src/ui/button/button.vue +++ b/src/ui/button/button.vue @@ -1,19 +1,39 @@ From 0457f803cc0085c3d99a30a613c466e95569e7a0 Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Thu, 11 Apr 2024 17:45:44 +0800 Subject: [PATCH 3/4] [Components] Add card --- src/data/Navigation.ts | 3 +- src/i18n/langs/en/Common.ts | 1 + src/i18n/langs/zhCn/Common.ts | 1 + src/router/default.ts | 5 +++ src/ui/card/card.vue | 29 ++++++++++++----- src/ui/enum/Shadow.ts | 6 ++++ src/views/pages/components/CardHome.vue | 41 +++++++++++++++++++++++++ 7 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 src/ui/enum/Shadow.ts create mode 100644 src/views/pages/components/CardHome.vue diff --git a/src/data/Navigation.ts b/src/data/Navigation.ts index 74b350bf..cf188c6d 100644 --- a/src/data/Navigation.ts +++ b/src/data/Navigation.ts @@ -64,7 +64,8 @@ const createNavigation = (): void => { NavigationService.addNavigation(pages) const button = createNavigationItem('common.common.button', undefined, '/components/button', undefined, NavigationPosition.LEFT_TOP) - const componentArray = [button] + const card = createNavigationItem('common.common.card', undefined, '/components/card', undefined, NavigationPosition.LEFT_TOP) + const componentArray = [button, card] const components = createNavigationItem('common.common.component', componentArray.length.toString(), '/components', Command, NavigationPosition.LEFT_TOP, componentArray) NavigationService.addNavigation(components) diff --git a/src/i18n/langs/en/Common.ts b/src/i18n/langs/en/Common.ts index b2b84e40..11dabad6 100644 --- a/src/i18n/langs/en/Common.ts +++ b/src/i18n/langs/en/Common.ts @@ -35,6 +35,7 @@ export default { size: 'Size', type: 'Type', icon: 'Icon', + card: 'Card', }, tip: { signInInfo: 'Enter your information to sign in to your account.', diff --git a/src/i18n/langs/zhCn/Common.ts b/src/i18n/langs/zhCn/Common.ts index f631b28b..b077567e 100644 --- a/src/i18n/langs/zhCn/Common.ts +++ b/src/i18n/langs/zhCn/Common.ts @@ -35,6 +35,7 @@ export default { size: '尺寸', type: '类型', icon: '图标', + card: '卡片', }, tip: { signInInfo: '输入您的信息以登录您的帐户。', diff --git a/src/router/default.ts b/src/router/default.ts index 37639bec..32a28524 100644 --- a/src/router/default.ts +++ b/src/router/default.ts @@ -148,6 +148,11 @@ const createComponentRouter = (router: Router): void => { name: 'button', path: 'button', component: () => import('@/views/pages/components/ButtonHome.vue') + }, + { + name: 'card', + path: 'card', + component: () => import('@/views/pages/components/CardHome.vue') } ] }) diff --git a/src/ui/card/card.vue b/src/ui/card/card.vue index 01fadc18..e8c8c3ef 100644 --- a/src/ui/card/card.vue +++ b/src/ui/card/card.vue @@ -1,6 +1,6 @@ From 7d0d9ef39037cab379e8174337f96abf4beb066b Mon Sep 17 00:00:00 2001 From: qianmoQ Date: Thu, 11 Apr 2024 17:59:01 +0800 Subject: [PATCH 4/4] [Components] [Button] Support calculation of hover color --- src/ui/button/button.vue | 4 +++- src/utils/Color.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/utils/Color.ts diff --git a/src/ui/button/button.vue b/src/ui/button/button.vue index 7ba45a77..055b6958 100644 --- a/src/ui/button/button.vue +++ b/src/ui/button/button.vue @@ -1,6 +1,6 @@