Skip to content

Commit

Permalink
Merge pull request #12 from qianmoQ/feature-dev
Browse files Browse the repository at this point in the history
[Page] [Form] Add some form function
  • Loading branch information
devlivecommunity authored Mar 25, 2024
2 parents 1b7286c + be20067 commit 7f69348
Show file tree
Hide file tree
Showing 10 changed files with 359 additions and 14 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build Vue
name: Publish core via GitHub Actions

on:
push:
branches:
- dev
release:
types: [ published ]

jobs:
build_vue:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "shadcn-ui-vue-admin",
"description": "Admin Dashboard UI crafted with Shadcn ui and Vite and Vue. Built with responsiveness and accessibility in mind.",
"private": true,
"version": "2024.0.1",
"version": "2024.0.2",
"scripts": {
"dev": "vite",
"build": "vue-tsc && vite build && cp CNAME dist/",
Expand Down
18 changes: 11 additions & 7 deletions src/data/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,23 @@ const createNavigation = (): void => {
'common.common.openProject')
NavigationService.addNavigation(openProject)

const form = createNavigationItem('form.common.formBasic', undefined, '/forms/basic', AudioWaveform, NavigationPosition.LEFT_TOP)
const formWithAction = createNavigationItem('form.common.formWithAction', undefined, '/forms/withAction', AudioWaveform, NavigationPosition.LEFT_TOP)
const formWithSplitField = createNavigationItem('form.common.formWithSplitField', undefined, '/forms/withSplitField', AudioWaveform, NavigationPosition.LEFT_TOP)
const formWithImage = createNavigationItem('form.common.formWithImage', undefined, '/forms/withImage', AudioWaveform, NavigationPosition.LEFT_TOP)
const formWithThird = createNavigationItem('form.common.formWithThird', undefined, '/forms/withThird', AudioWaveform, NavigationPosition.LEFT_TOP)
const formWithValidate = createNavigationItem('form.common.formWithValidate', undefined, '/forms/withValidate', AudioWaveform, NavigationPosition.LEFT_TOP)
const formArray = [form, formWithAction, formWithSplitField, formWithImage, formWithThird, formWithValidate]
const froms = createNavigationItem('form.common.form', formArray.length.toString(), '/forms', FormInput, NavigationPosition.LEFT_TOP,
formArray, undefined, 'common.common.form')
NavigationService.addNavigation(froms)

const page404 = createNavigationItem('common.common.page404', undefined, '/common/404', Ban, NavigationPosition.LEFT_TOP)
const page403 = createNavigationItem('common.common.page403', undefined, '/common/403', CircleOff, NavigationPosition.LEFT_TOP)
const pageArray = [page404, page403]
const pages = createNavigationItem('common.common.page', pageArray.length.toString(), '/pages', StickyNote,
NavigationPosition.LEFT_TOP, pageArray, undefined, 'common.common.page')
NavigationService.addNavigation(pages)

const form = createNavigationItem('form.common.formBasic', undefined, '/forms/basic', AudioWaveform, NavigationPosition.LEFT_TOP)
const formWithAction = createNavigationItem('form.common.formWithAction', undefined, '/forms/withAction', AudioWaveform, NavigationPosition.LEFT_TOP)
const formArray = [form, formWithAction]
const froms = createNavigationItem('form.common.form', formArray.length.toString(), '/forms', FormInput, NavigationPosition.LEFT_TOP,
formArray, undefined, 'common.common.form')
NavigationService.addNavigation(froms)
}

const createNavigationItem = (title?: string, label?: string, href?: string, icon?: any, position?: NavigationPosition, children?: NavigationModel[], group?: string, description?: string, blank?: boolean): NavigationModel => {
Expand Down
15 changes: 14 additions & 1 deletion src/i18n/langs/en/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ export default {
formBasic: 'Basic Form',
formWithAction: 'Form with Action',
signInWithGoogle: 'Sign in with Google',
formWithSplitField: 'Form with Split Field',
signInWithGithub: 'Sign in with Github',
firstName: 'First Name',
lastName: 'Last Name',
formWithImage: 'Form with Image',
formWithThird: 'Forms with third-party logins',
formWithValidate: 'Form with validation'
},
tip: {
formBasic: 'This is a basic form example',
formWithAction: 'Here\'s an example of a form with an action function'
formWithAction: 'Here\'s an example of a form with an action function',
formWithSplitField: 'Here\'s an example of a form with a split field',
firstNameHolder: 'Please enter first name',
lastNameHolder: 'Please enter last name',
formWithImage: 'Here\'s an example of a form with an image',
formWithThird: 'Here\'s an example of a form with a third-party login',
formWithValidate: 'Here\'s an example of a form with validation'
}
}
15 changes: 14 additions & 1 deletion src/i18n/langs/zhCn/Form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,22 @@ export default {
formBasic: '基础表单',
formWithAction: '带操作功能表单',
signInWithGoogle: '使用 Google 登录',
formWithSplitField: '带分割字段的表单',
signInWithGithub: '使用 Github 登录',
firstName: '名',
lastName: '姓',
formWithImage: '带图片的表单',
formWithThird: '带第三方登录的表单',
formWithValidate: '带校验的表单'
},
tip: {
formBasic: '这是一个表单的基础示例',
formWithAction: '这是一个带有操作功能的表单示例'
formWithAction: '这是一个带有操作功能的表单示例',
formWithSplitField: '这是一个带有分割字段的表单示例',
firstNameHolder: '请输入名',
lastNameHolder: '请输入姓',
formWithImage: '这是一个带有图片的表单示例',
formWithThird: '这是一个带有第三方登录的表单示例',
formWithValidate: '这是一个带有校验的表单示例'
}
}
20 changes: 20 additions & 0 deletions src/router/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,26 @@ const createFormRouter = (router: Router): void => {
name: 'withAction',
path: 'withAction',
component: () => import('@/views/pages/form/FormWithAction.vue')
},
{
name: 'withSplitField',
path: 'withSplitField',
component: () => import('@/views/pages/form/FormWithSplitField.vue')
},
{
name: 'withImage',
path: 'withImage',
component: () => import('@/views/pages/form/FormWithImage.vue')
},
{
name: 'withThird',
path: 'withThird',
component: () => import('@/views/pages/form/FormWithThird.vue')
},
{
name: 'withValidate',
path: 'withValidate',
component: () => import('@/views/pages/form/FormWithValidate.vue')
}
]
})
Expand Down
56 changes: 56 additions & 0 deletions src/views/pages/form/FormWithImage.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<template>
<div class="container grid h-svh flex-col items-center justify-center bg-primary-foreground lg:max-w-none lg:px-0">
<div class="w-full lg:grid lg:min-h-[600px] lg:grid-cols-2 xl:min-h-[800px]">
<div class="flex items-center justify-center py-12">
<div class="mx-auto grid w-[350px] gap-6">
<div class="grid gap-2 text-center">
<h1 class="text-3xl font-bold">{{ $t('form.common.formWithImage') }}</h1>
<p class="text-balance text-muted-foreground">{{ $t('form.tip.formWithImage') }}</p>
</div>
<div class="grid gap-4">
<div class="grid gap-2">
<Label for="email">{{ $t('user.common.email') }}</Label>
<Input id="email" type="email" :placeholder="$t('user.tip.emailHolder')" required/>
</div>
<div class="grid gap-2">
<div class="flex items-center">
<Label for="password">{{ $t('user.common.password') }}</Label>
<a href="#" class="ml-auto inline-block text-sm underline">{{ $t('common.common.forgotPassword') }}?</a>
</div>
<Input id="password" type="password" required :placeholder="$t('user.tip.passwordHolder')"/>
</div>
<Button type="submit" class="w-full">{{ $t('common.common.signIn') }}</Button>
<Button variant="outline" class="w-full">{{ $t('form.common.signInWithGoogle') }}</Button>
</div>
<div class="mt-4 text-center text-sm">
{{ $t('common.tip.signInNoAccount') }}
<RouterLink to="#" class="underline">{{ $t('common.common.signUp') }}</RouterLink>
</div>
</div>
</div>
<div class="hidden bg-muted lg:block">
<Image class="h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"/>
</div>
</div>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Image } from 'lucide-vue-next'
export default defineComponent({
name: 'FormWithImage',
components: {
Button,
Input,
Label,
Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle,
Image
}
})
</script>
58 changes: 58 additions & 0 deletions src/views/pages/form/FormWithSplitField.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<div class="container grid h-svh flex-col items-center justify-center bg-primary-foreground lg:max-w-none lg:px-0">
<div class="mx-auto flex w-full flex-col justify-center space-y-2 sm:w-[480px] lg:p-8">
<Card class="mx-auto max-w-sm">
<CardHeader>
<CardTitle class="text-xl">{{ $t('form.common.formWithSplitField') }}</CardTitle>
<CardDescription>{{ $t('form.tip.formWithSplitField') }}</CardDescription>
</CardHeader>
<CardContent>
<div class="grid gap-4">
<div class="grid grid-cols-2 gap-4">
<div class="space-y-2">
<Label for="first-name">{{ $t('form.common.firstName') }}</Label>
<Input id="first-name" :placeholder="$t('form.tip.firstNameHolder')" required/>
</div>
<div class="grid gap-2 mt-2">
<Label for="last-name">{{ $t('form.common.lastName') }}</Label>
<Input id="last-name" :placeholder="$t('form.tip.lastNameHolder')" required/>
</div>
</div>
<div class="grid gap-2">
<Label for="email">{{ $t('user.common.email') }}</Label>
<Input id="email" type="email" :placeholder="$t('user.tip.emailHolder')" required/>
</div>
<div class="grid gap-2">
<Label for="password">{{ $t('user.common.password') }}</Label>
<Input id="password" type="password" :placeholder="$t('user.tip.passwordHolder')"/>
</div>
<Button type="submit" class="w-full">{{ $t('common.common.signUp') }}</Button>
<Button variant="outline" class="w-full">{{ $t('form.common.signInWithGoogle') }}</Button>
</div>
<div class="mt-4 text-center text-sm">
{{ $t('common.tip.signUpHasAccount') }}
<a href="#" class="underline">{{ $t('common.common.signIn') }}</a>
</div>
</CardContent>
</Card>
</div>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
export default defineComponent({
name: 'FormWithSplitField',
components: {
Button,
Input,
Label,
Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle
}
})
</script>
71 changes: 71 additions & 0 deletions src/views/pages/form/FormWithThird.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<template>
<div class="container grid h-svh flex-col items-center justify-center bg-primary-foreground lg:max-w-none lg:px-0">
<div class="mx-auto flex w-full flex-col justify-center space-y-2 sm:w-[480px] lg:p-8">
<Card>
<CardHeader>
<CardTitle class="text-2xl">{{ $t('form.common.formWithThird') }}</CardTitle>
<CardDescription>{{ $t('form.tip.formWithThird') }}</CardDescription>
</CardHeader>
<CardContent>
<div class="grid gap-4">
<div class="grid gap-2">
<Label for="email">{{ $t('user.common.email') }}</Label>
<Input id="email" type="email" :placeholder="$t('user.tip.emailHolder')" required/>
</div>
<div class="grid gap-2">
<div class="flex items-center">
<Label for="password">{{ $t('user.common.password') }}</Label>
<a href="#" class="ml-auto inline-block text-sm underline">{{ $t('common.common.forgotPassword') }}?</a>
</div>
<Input id="password" type="password" required :placeholder="$t('user.tip.passwordHolder')"/>
</div>
<Button type="submit" class="w-full">{{ $t('common.common.signIn') }}</Button>
<Button variant="outline" class="w-full">{{ $t('form.common.signInWithGoogle') }}</Button>
</div>
<div class="relative my-4">
<div class="absolute inset-0 flex items-center">
<span class="w-full border-t"/>
</div>
<div class="relative flex justify-center text-xs uppercase">
<span class="bg-background px-2 text-muted-foreground">{{ $t('user.common.continueWith') }}</span>
</div>
</div>
<div class="flex items-center gap-2">
<Button variant='outline' class="w-full">
<Github class="mr-2 h-4 w-4"/>
GitHub
</Button>
<Button variant='outline' class="w-full">
<Facebook class="mr-2 h-4 w-4"/>
Facebook
</Button>
</div>
<div class="mt-4 text-center text-sm">
{{ $t('common.tip.signInNoAccount') }}
<RouterLink to="#" class="underline">{{ $t('common.common.signUp') }}</RouterLink>
</div>
</CardContent>
</Card>
</div>
</div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { Button } from '@/components/ui/button'
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Facebook, Github } from 'lucide-vue-next'
export default defineComponent({
name: 'FormWithThird',
components: {
Facebook, Github,
Button,
Input,
Label,
Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle
}
})
</script>
Loading

0 comments on commit 7f69348

Please sign in to comment.