Skip to content

Commit ba3d7f4

Browse files
Copilottobiasdiez
andauthored
chore: migrate TypeScript Storybook stories to Vue format (#2853)
### πŸ”— Linked issue Addresses migration of all TypeScript story files to Vue story format using storybook-vue-addon. ### πŸ“š Description Migrated 10 TypeScript Storybook stories (*.stories.ts) to native Vue format (*.stories.vue) for better DX with full editor support and idiomatic Vue syntax. **Before (TypeScript CSF):** ```typescript const Template: StoryFnFn = (args) => ({ setup() { return { args } }, template: '<t-alert v-bind="args">{{args.message}}</t-alert>', }) export const Default = Template.bind({}) export const Error = Template.bind({}) Error.args = { variant: 'error', message: 'oops!', show: true } ``` **After (Vue native):** ```vue <template> <Stories title="t-alert" :component="TAlert"> <Story title="Default"> <t-alert :show="true"> Hi there! </t-alert> </Story> <Story title="Error"> <t-alert :show="true" variant="error"> oops! </t-alert> </Story> </Stories> </template> ``` **Changes:** - Converted all component stories to Vue SFC format following existing pattern (JabRefLogo.stories.vue, n-button.stories.vue) - Preserved slot content usage where components accept content between tags (e.g., t-alert, t-tag) - Removed TypeScript story files - Updated Storybook config to reflect Vue-only stories <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > Migrate all typescript storybook story files (*.stories.ts) to vue stories (*.stories.vue). The later are implemented using https://github.com/tobiasdiez/storybook-vue-addon and you can see the exsting vue stories as reference. </details> <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/JabRef/JabRefOnline/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) β€” coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: tobiasdiez <[email protected]> Co-authored-by: Tobias Diez <[email protected]>
1 parent 0ddebaa commit ba3d7f4

21 files changed

+299
-330
lines changed

β€Ž.storybook/main.tsβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { StorybookConfig } from '@nuxtjs/storybook'
22

33
const config: StorybookConfig = {
44
// Need to specify stories as workaround for https://github.com/storybookjs/storybook/issues/20761
5-
stories: ['../components/*.stories.@(vue|ts)'],
5+
stories: ['../components/*.stories.vue'],
66
core: {
77
// @ts-expect-error - need to update storybook types
88
disableTelemetry: true,

β€Žcomponents/t-alert.stories.tsβ€Ž

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script setup lang="ts">
2+
// @ts-expect-error: not yet compatible with 'bundler' module resolution
3+
import { TAlert } from '@variantjs/vue'
4+
</script>
5+
6+
<template>
7+
<Stories
8+
title="t-alert"
9+
:component="TAlert"
10+
>
11+
<Story title="Default">
12+
<t-alert :show="true"> Hi there! </t-alert>
13+
</Story>
14+
<Story title="Error">
15+
<t-alert
16+
:show="true"
17+
variant="error"
18+
>
19+
oops!
20+
</t-alert>
21+
</Story>
22+
<Story title="Success">
23+
<t-alert
24+
:show="true"
25+
variant="success"
26+
>
27+
success!
28+
</t-alert>
29+
</Story>
30+
</Stories>
31+
</template>

β€Žcomponents/t-checkbox.stories.tsβ€Ž

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<script setup lang="ts">
2+
// @ts-expect-error: not yet compatible with 'bundler' module resolution
3+
import { TCheckbox } from '@variantjs/vue'
4+
</script>
5+
6+
<template>
7+
<Stories
8+
title="t-checkbox"
9+
:component="TCheckbox"
10+
>
11+
<Story title="Default">
12+
<t-checkbox :checked="true" />
13+
</Story>
14+
<Story title="Error">
15+
<t-checkbox
16+
:checked="true"
17+
variant="error"
18+
/>
19+
</Story>
20+
<Story title="Success">
21+
<t-checkbox
22+
:checked="true"
23+
variant="success"
24+
/>
25+
</Story>
26+
<Story title="Plain">
27+
<t-checkbox
28+
:checked="true"
29+
variant="plain"
30+
/>
31+
</Story>
32+
</Stories>
33+
</template>

β€Žcomponents/t-dropdown.stories.tsβ€Ž

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<script setup lang="ts">
2+
// @ts-expect-error: not yet compatible with 'bundler' module resolution
3+
import { TDropdown } from '@variantjs/vue'
4+
</script>
5+
6+
<template>
7+
<Stories
8+
title="t-dropdown"
9+
:component="TDropdown"
10+
>
11+
<Story title="Default">
12+
<t-dropdown text="Dropdown">
13+
<div class="py-1 rounded-md shadow-2xs">
14+
<a
15+
href="#"
16+
class="block px-4 py-2 text-sm leading-5 text-gray-700 transition duration-150 ease-in-out hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100"
17+
role="menuitem"
18+
>
19+
Your Profile
20+
</a>
21+
<a
22+
href="#"
23+
class="block px-4 py-2 text-sm leading-5 text-gray-700 transition duration-150 ease-in-out hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100"
24+
role="menuitem"
25+
>
26+
Settings
27+
</a>
28+
<a
29+
href="#"
30+
class="block px-4 py-2 text-sm leading-5 text-gray-700 transition duration-150 ease-in-out hover:bg-gray-100 focus:outline-hidden focus:bg-gray-100"
31+
role="menuitem"
32+
>
33+
Sign out
34+
</a>
35+
</div>
36+
</t-dropdown>
37+
</Story>
38+
</Stories>
39+
</template>

β€Žcomponents/t-input-group.stories.tsβ€Ž

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<script setup lang="ts">
2+
// @ts-expect-error: not yet compatible with 'bundler' module resolution
3+
import { TInput, TInputGroup } from '@variantjs/vue'
4+
</script>
5+
6+
<template>
7+
<Stories
8+
title="t-input-group"
9+
:component="TInputGroup"
10+
>
11+
<Story title="Default">
12+
<t-input-group
13+
label="Label"
14+
feedback="Feedback"
15+
>
16+
<t-input value="Input text" />
17+
</t-input-group>
18+
</Story>
19+
<Story title="Error">
20+
<t-input-group
21+
variant="error"
22+
label="Label"
23+
feedback="Feedback"
24+
>
25+
<t-input
26+
variant="error"
27+
value="Input text"
28+
/>
29+
</t-input-group>
30+
</Story>
31+
<Story title="Success">
32+
<t-input-group
33+
variant="success"
34+
label="Label"
35+
feedback="Feedback"
36+
>
37+
<t-input
38+
variant="success"
39+
value="Input text"
40+
/>
41+
</t-input-group>
42+
</Story>
43+
<Story title="Important">
44+
<t-input-group
45+
variant="plain"
46+
label="Label"
47+
feedback="Feedback"
48+
>
49+
<t-input
50+
variant="plain"
51+
value="Input text"
52+
/>
53+
</t-input-group>
54+
</Story>
55+
</Stories>
56+
</template>

β€Žcomponents/t-input.stories.tsβ€Ž

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
Β (0)