Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YSHOP2-1294: Update storybook #249

Merged
merged 5 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions packages/vue3/.storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@ module.exports = {
"options": {}
},
"docs": {
"docsPage": true
"docsPage": false
},
viteFinal(config, { configType }) {
console.log(`${path.resolve(__dirname, '..', 'src')}/`);

config.resolve.alias['~/'] = `${path.resolve(__dirname, '..', 'src')}/`;
config.plugins.push(Unocss());

async viteFinal(config, { configType }) {
config.resolve.alias['~'] = `${path.resolve(__dirname, 'src')}/`;
config.plugins.push(Unocss);
return config;
},
}
}
20 changes: 11 additions & 9 deletions packages/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
"dev": "pnpm story:dev & pnpm components:dev",
"build": "pnpm components:build & pnpm story:build",
"release": "pnpm publish --access public",
"lint": "eslint ."
"lint": "eslint .",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"peerDependencies": {
"vue": "^3.2.45"
Expand Down Expand Up @@ -72,13 +74,13 @@
"devDependencies": {
"@iconify-json/line-md": "^1.1.20",
"@iconify-json/tabler": "^1.1.53",
"@storybook/addon-essentials": "7.0.0-beta.14",
"@storybook/addon-interactions": "7.0.0-beta.14",
"@storybook/addon-links": "7.0.0-beta.14",
"@storybook/blocks": "7.0.0-beta.14",
"@storybook/testing-library": "^0.0.13",
"@storybook/vue3": "7.0.0-beta.14",
"@storybook/vue3-vite": "7.0.0-beta.14",
"@storybook/addon-essentials": "^7.6.10",
"@storybook/addon-interactions": "^7.6.10",
"@storybook/addon-links": "^7.6.10",
"@storybook/blocks": "^7.6.10",
"@storybook/test": "^7.6.10",
"@storybook/vue3": "^7.6.10",
"@storybook/vue3-vite": "^7.6.10",
"@types/node": "18.7.15",
"@vitejs/plugin-vue": "^4.0.0",
"@vueuse/core": "^9.9.0",
Expand All @@ -88,7 +90,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"sass": "1.54.8",
"storybook": "7.0.0-beta.14",
"storybook": "^7.6.10",
"typescript": "4.8.2",
"unocss": "^0.47.6",
"vite": "^4.0.3",
Expand Down
22 changes: 12 additions & 10 deletions packages/vue3/src/components/Alert/Alert.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { Meta } from '@storybook/vue3';
import type { Meta, StoryObj } from '@storybook/vue3';
import Alert from './Alert.vue';

type Story = StoryObj<typeof Alert>;
const meta: Meta<typeof Alert> = {
title: 'Application/Alert',
component: Alert,
Expand All @@ -21,12 +22,14 @@ const meta: Meta<typeof Alert> = {
},
};

const Template = (args: Record<string, unknown>, { argTypes }: Record<string, Record<string, unknown>>) => ({
props: Object.keys(argTypes),
components: { Alert },
template: `
<Alert v-bind="$props" :closeAfterDuration="2000" :type="type"
>
export const Default: Story = {
render: args => ({
components: { Alert },
setup() {
return { args };
},
template: `
<Alert v-bind="args">
<template #title>
Title of Toast
</template>
Expand All @@ -35,8 +38,7 @@ const Template = (args: Record<string, unknown>, { argTypes }: Record<string, Re
</template>
</Alert>
`,
});

export const Default = Template.bind({});
}),
};

export default meta;
Loading
Loading