feat: 卡片等组件

This commit is contained in:
2023-07-10 19:26:19 +08:00
parent ec2f619775
commit d1e7778644
28 changed files with 1108 additions and 12 deletions

35
stories/Card.stories.ts Normal file
View File

@ -0,0 +1,35 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import ThCard from '../packages/card/index.vue'
import ThCardTitle from '../packages/card-title/index.vue'
const meta = {
title: '卡片/Card',
component: ThCard,
tags: ['autodocs'],
render: (args: any) => ({
components: { ThCard },
setup() {
return { args }
},
template: '<div w-full><th-card /></div>',
}),
} satisfies Meta<typeof ThCard>
export default meta
type Story = StoryObj<typeof meta>
export const Title: Story = {
render: (args: any) => ({
components: { ThCard, ThCardTitle },
setup() {
return { args }
},
template: `
<th-card>
<th-card-title>
Title
</th-card-title>
</th-card>
`,
}),
}

View File

@ -0,0 +1,47 @@
/*
* @Author: peerless_hero peerless_hero@outlook.com
* @Date: 2023-07-08 01:44:59
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-07-10 19:09:37
* @FilePath: \uni\stories\CardActions.stories.ts
* @Description:
*
*/
import type { Meta, StoryObj } from '@storybook/vue3'
import ThCard from '../packages/card/index.vue'
import ThCardText from '../packages/card-text/index.vue'
import ThCardActions from '../packages/card-actions/index.vue'
const meta = {
title: '卡片/CardActions',
component: ThCardActions,
tags: ['autodocs'],
} satisfies Meta<typeof ThCardActions>
export default meta
type Story = StoryObj<typeof meta>
export const Actions: Story = {
args: {
actions: [
{
text: '编辑',
}, {
text: '审核',
},
],
},
render: args => ({
components: { ThCard, ThCardText, ThCardActions },
setup() {
return { args }
},
template: `<th-card>
<th-card-text label="label" text="一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字" />
<th-card-text label="label" text="一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字" />
<th-card-text label="label" text="一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字一长段文字" />
<th-card-actions :actions="args.actions" />
</th-card>
`,
}),
}

View File

@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import CardItem from '../packages/card-item/index.vue'
const meta = {
title: '卡片/CardItem',
component: CardItem,
tags: ['autodocs'],
} satisfies Meta<typeof CardItem>
export default meta
type Story = StoryObj<typeof meta>
export const Base: Story = {}

View File

@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import CardSubtitle from '../packages/card-subtitle/index.vue'
const meta = {
title: '卡片/CardSubtitle',
component: CardSubtitle,
tags: ['autodocs'],
} satisfies Meta<typeof CardSubtitle>
export default meta
type Story = StoryObj<typeof meta>
export const Base: Story = {}

View File

@ -0,0 +1,38 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import ThCard from '../packages/card/index.vue'
import ThCardText from '../packages/card-text/index.vue'
const meta = {
title: '卡片/CardText',
component: ThCardText,
tags: ['autodocs'],
} satisfies Meta<typeof ThCardText>
export default meta
type Story = StoryObj<typeof meta>
export const Text: Story = {
args: {
label: '卡片的标签',
text: '卡片的文字',
},
name: '卡片的标签加文字',
render: args => ({
components: { ThCard, ThCardText },
setup() {
return { args }
},
template: `
<th-card>
<th-card-text :label="args.label" :text="args.text" />
<th-card-text :label="args.label" :text="args.text" />
<th-card-text :label="args.label" :text="args.text" />
<th-card-text :label="args.label" :text="args.text" />
<th-card-text :label="args.label" :text="args.text" />
<th-card-text :label="args.label" :text="args.text" />
<th-card-text :label="args.label" :text="args.text" />
<th-card-text :label="args.label" :text="args.text" />
</th-card>
`,
}),
}

View File

@ -0,0 +1,59 @@
/*
* @Author: peerless_hero peerless_hero@outlook.com
* @Date: 2023-07-08 01:44:23
* @LastEditors: peerless_hero peerless_hero@outlook.com
* @LastEditTime: 2023-07-10 02:58:09
* @FilePath: \uni\stories\CardTitle.stories.ts
* @Description:
*
*/
import type { Meta, StoryObj } from '@storybook/vue3'
import ThCard from '../packages/card/index.vue'
import ThCardTitle from '../packages/card-title/index.vue'
import ThCardText from '../packages/card-text/index.vue'
const meta = {
title: '卡片/CardTitle',
component: ThCardTitle,
tags: ['autodocs'],
} satisfies Meta<typeof ThCardTitle>
export default meta
type Story = StoryObj<typeof meta>
export const Title: Story = {
args: {
title: '卡片的标题',
},
render: args => ({
components: { ThCard, ThCardTitle },
setup() {
return { args }
},
template: `
<th-card>
<th-card-title :title="args.title" />
</th-card>
`,
}),
}
export const TitleText: Story = {
args: {
title: '卡片标题配合文字',
},
render: args => ({
components: { ThCard, ThCardTitle, ThCardText },
setup() {
return { args }
},
template: `
<th-card>
<th-card-title :title="args.title" />
<th-card-text text="一段文字一段文字" />
<th-card-text text="一段文字一段文字" />
<th-card-text text="一段文字一段文字" />
</th-card>
`,
}),
}

View File

@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import DefaultLayout from '../packages/default-layout/index.vue'
const meta = {
title: '某个大类/DefaultLayout',
component: DefaultLayout,
tags: ['autodocs'],
} satisfies Meta<typeof DefaultLayout>
export default meta
type Story = StoryObj<typeof meta>
export const Base: Story = {}

View File

@ -18,7 +18,7 @@ const meta = {
*/
title: 'Example/Header',
component: MyHeader,
render: (args: any) => ({
render: args => ({
components: { MyHeader },
setup() {
return { args }

26
stories/Prompt.stories.ts Normal file
View File

@ -0,0 +1,26 @@
/*
* @Author: zhaojinfeng 121016171@qq.com
* @Date: 2023-06-25 15:55:08
* @LastEditors: zhaojinfeng 121016171@qq.com
* @LastEditTime: 2023-06-25 19:11:17
* @FilePath: \uni\stories\Prompt.stories.ts
* @Description:
*
*/
import type { Meta, StoryObj } from '@storybook/vue3'
import Prompt from '../packages/prompt/index.vue'
const meta = {
title: '反馈组件/Prompt',
component: Prompt,
tags: ['autodocs'],
} satisfies Meta<typeof Prompt>
export default meta
type Story = StoryObj<typeof meta>
export const Base: Story = {
args: {
title: '意见',
},
}

View File

@ -0,0 +1,13 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import SearchPicker from '../packages/search-picker/index.vue'
const meta = {
title: '某个大类/SearchPicker',
component: SearchPicker,
tags: ['autodocs'],
} satisfies Meta<typeof SearchPicker>
export default meta
type Story = StoryObj<typeof meta>
export const Base: Story = {}