forked from oku-ui/primitives
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: storybook * Update CONTRIBUTING.md
- Loading branch information
1 parent
026ba28
commit 2522a16
Showing
19 changed files
with
5,025 additions
and
684 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
module.exports = { | ||
root: true, | ||
// This tells ESLint to load the config from the package `eslint-config-custom` | ||
extends: ['custom'], | ||
extends: ['custom', 'plugin:storybook/recommended'], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import type { StorybookConfig } from "@storybook/vue3-vite"; | ||
import Unocss from 'unocss/vite' | ||
|
||
const config: StorybookConfig = { | ||
stories: ["../stories/**/*.mdx", "../packages/components/**/*.stories.@(js|jsx|ts|tsx)"], | ||
addons: [ | ||
"@storybook/addon-links", | ||
"@storybook/addon-essentials", | ||
"@storybook/addon-interactions", | ||
], | ||
framework: { | ||
name: "@storybook/vue3-vite", | ||
options: {}, | ||
}, | ||
docs: { | ||
autodocs: "tag", | ||
}, | ||
viteFinal(config) { | ||
config.plugins = config.plugins || [] | ||
config.plugins.push( | ||
Unocss() | ||
) | ||
|
||
return config | ||
} | ||
}; | ||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Preview } from "@storybook/vue3"; | ||
import '@unocss/reset/tailwind.css' | ||
import 'virtual:uno.css' | ||
|
||
const preview: Preview = { | ||
parameters: { | ||
actions: { argTypesRegex: "^on[A-Z].*" }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/components/aspect-ratio/src/aspect-ratio.stories.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
|
||
import type { AspectRatioProps } from './aspect-ratio' | ||
import { OkuAspectRatio } from './aspect-ratio' | ||
|
||
interface StoryProps extends AspectRatioProps { | ||
imageurl: string | ||
} | ||
|
||
const meta = { | ||
title: 'Components/OkuAspectRatio', | ||
component: OkuAspectRatio, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
// TODO: ratio number '16 / 9' not working how to send a string? with storybook controls | ||
ratio: { type: 'number', defaultValue: '1' }, | ||
}, | ||
// TODO: ratio number '16 / 9' not working how to send a string? with storybook controls | ||
args: { ratio: '1' }, | ||
// TODO: `render` ts props same problem as above | ||
render: (args: StoryProps) => ({ | ||
components: { OkuAspectRatio }, | ||
setup() { | ||
return { args } | ||
}, | ||
// TODO: if ratio hot reload fixed, remove this {{ args.ratio }} | ||
// TODO: ratio change not working hot reload | ||
template: ` | ||
{{ args.ratio }} | ||
<div class="max-w-xl mx-auto h-full items-center justify-center"> | ||
<OkuAspectRatio :ratio="args.ratio"> | ||
<img | ||
class="object-cover w-full h-full rounded-lg" | ||
:src="args.imageurl" | ||
alt="Landscape photograph by Tobias Tullius" | ||
> | ||
</OkuAspectRatio> | ||
</div> | ||
`, | ||
}), | ||
} satisfies Meta<typeof OkuAspectRatio> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Primary: Story = { | ||
args: { | ||
ratio: '1', | ||
imageurl: 'https://images.unsplash.com/photo-1535025183041-0991a977e25b?w=300&dpr=2&q=80', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
|
||
import type { AvatarProps } from './avatar' | ||
import { OkuAvatar,OkuAvatarImage,OkuAvatarFallback } from './avatar' | ||
|
||
interface StoryProps extends AvatarProps { | ||
} | ||
|
||
const meta = { | ||
title: 'Components/Avatar', | ||
tags: ['autodocs'], | ||
// TODO: `render` TS props same problem as above | ||
render: (args: StoryProps) => ({ | ||
components: { OkuAvatar }, | ||
setup() { | ||
return { args } | ||
}, | ||
template: ` | ||
<div class="max-w-xl mx-auto h-full items-center justify-center"> | ||
<OkuAvatar class="w-40 h-40 bg-gray-400 items-center inline-block overflow-hidden rounded-full"> | ||
<OkuAvatarImage | ||
class="w-full h-full object-cover" | ||
src="https://images.unsplash.com/photo-1492633423870-43d1cd2775eb?&w=128&h=128&dpr=2&q=80" | ||
/> | ||
<OkuAvatarFallback | ||
class="flex items-center text-white font-medium text-2xl h-full w-full justify-center" | ||
:delayms="500" | ||
> | ||
CT | ||
</OkuAvatarFallback> | ||
</OkuAvatar> | ||
</div> | ||
`, | ||
}), | ||
} satisfies Meta<typeof OkuAvatar> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Primary: Story = { | ||
args: { | ||
|
||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import type { Meta, StoryObj } from '@storybook/vue3' | ||
|
||
import type { LabelProps } from './label' | ||
import { OkuLabel } from './label' | ||
|
||
interface StoryProps extends LabelProps { | ||
} | ||
|
||
const meta = { | ||
title: 'Components/Label', | ||
component: OkuLabel, | ||
tags: ['autodocs'], | ||
// TODO: `render` TS props same problem as above | ||
render: (args: StoryProps) => ({ | ||
components: { OkuLabel }, | ||
setup() { | ||
return { args } | ||
}, | ||
template: ` | ||
<div class="max-w-xl mx-auto h-full items-center justify-center"> | ||
<OkuLabel class="block text-sm font-medium leading-6 text-gray-900" for="email"> | ||
</OkuLabel> | ||
<div class="mt-2"> | ||
<input type="email" name="email" id="email" class="px-4 block w-full rounded-md border-0 py-1.5 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm sm:leading-6" placeholder="[email protected]" /> | ||
</div> | ||
</div> | ||
`, | ||
}), | ||
} satisfies Meta<typeof OkuLabel> | ||
|
||
export default meta | ||
type Story = StoryObj<typeof meta> | ||
|
||
export const Primary: Story = { | ||
args: { | ||
|
||
}, | ||
} |
Oops, something went wrong.