Skip to content

Commit ea9168d

Browse files
committed
chore: add storybook
Signed-off-by: Fernando Fernández <[email protected]>
1 parent 035afef commit ea9168d

File tree

10 files changed

+2594
-207
lines changed

10 files changed

+2594
-207
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,5 @@ sw.js
9494

9595
# Debian build artifacts
9696
packaging/jellyfin-vue*
97+
98+
*storybook.log

frontend/package.json

+10-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"start": "vite",
2525
"serve": "vite preview",
2626
"prod": "npm run build && npm run serve",
27-
"clean": "git clean -fxd"
27+
"clean": "git clean -fxd",
28+
"storybook": "storybook dev -p 6006 --config-dir storybook --no-open"
2829
},
2930
"dependencies": {
3031
"@fontsource-variable/figtree": "5.1.2",
@@ -53,15 +54,23 @@
5354
"vuetify": "3.7.4"
5455
},
5556
"devDependencies": {
57+
"@chromatic-com/storybook": "3.2.4",
5658
"@iconify/json": "2.2.293",
5759
"@intlify/unplugin-vue-i18n": "4.0.0",
5860
"@jellyfin-vue/configs": "*",
5961
"@jellyfin-vue/vite-plugins": "*",
6062
"@rollup/plugin-virtual": "3.0.2",
63+
"@storybook/addon-a11y": "8.5.1",
64+
"@storybook/addon-essentials": "8.5.1",
65+
"@storybook/addon-interactions": "8.5.1",
66+
"@storybook/blocks": "8.5.1",
67+
"@storybook/vue3": "8.5.1",
68+
"@storybook/vue3-vite": "8.5.1",
6169
"@types/sortablejs": "1.15.8",
6270
"@vitejs/plugin-vue": "5.2.1",
6371
"browserslist": "4.24.4",
6472
"lightningcss": "1.28.2",
73+
"storybook": "8.5.1",
6574
"unocss": "0.65.4",
6675
"unplugin-vue-components": "28.0.0",
6776
"unplugin-vue-router": "0.10.9",

frontend/storybook/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from '@jellyfin-vue/configs/storybook';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import type { Meta, StoryObj } from '@storybook/vue3';
2+
import type { BaseItemKind } from '@jellyfin/sdk/lib/generated-client';
3+
import TrackList from '#/components/Playback/TrackList.vue';
4+
5+
// Mock data
6+
const mockAlbum = {
7+
Id: '123',
8+
Name: 'Test Album',
9+
Type: 'MusicAlbum' as BaseItemKind
10+
};
11+
12+
const mockTracks = [
13+
{
14+
Id: '1',
15+
Name: 'Track 1',
16+
IndexNumber: 1,
17+
ParentIndexNumber: 1,
18+
RunTimeTicks: 2_000_000_000,
19+
Type: 'Audio',
20+
Artists: ['Artist 1'],
21+
AlbumArtist: 'Artist 1',
22+
ArtistItems: [{ Id: 'artist1', Name: 'Artist 1' }]
23+
},
24+
{
25+
Id: '2',
26+
Name: 'Track 2',
27+
IndexNumber: 2,
28+
ParentIndexNumber: 1,
29+
RunTimeTicks: 3_000_000_000,
30+
Type: 'Audio',
31+
Artists: ['Artist 2'],
32+
AlbumArtist: 'Artist 1',
33+
ArtistItems: [{ Id: 'artist2', Name: 'Artist 2' }]
34+
}
35+
];
36+
37+
const meta: Meta<typeof TrackList> = {
38+
title: 'Components/Playback/TrackList',
39+
component: TrackList,
40+
tags: ['autodocs'],
41+
args: {
42+
item: mockAlbum,
43+
tracks: mockTracks
44+
}
45+
};
46+
47+
export default meta;
48+
49+
type Story = StoryObj<typeof TrackList>;
50+
51+
export const Default: Story = {
52+
args: {
53+
item: mockAlbum,
54+
tracks: mockTracks
55+
}
56+
};
57+
58+
export const MultipleDiscs: Story = {
59+
args: {
60+
item: mockAlbum,
61+
tracks: [
62+
...mockTracks,
63+
{
64+
Id: '3',
65+
Name: 'Track 1 Disc 2',
66+
IndexNumber: 1,
67+
ParentIndexNumber: 2,
68+
RunTimeTicks: 2_000_000_000,
69+
Type: 'Audio',
70+
Artists: ['Artist 1'],
71+
AlbumArtist: 'Artist 1',
72+
ArtistItems: [{ Id: 'artist1', Name: 'Artist 1' }]
73+
}
74+
]
75+
}
76+
};

0 commit comments

Comments
 (0)