Skip to content

Commit 11e7f19

Browse files
committed
add story: og images
1 parent 99c6946 commit 11e7f19

3 files changed

Lines changed: 101 additions & 0 deletions

File tree

.storybook/preview.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,50 @@ const preview: Preview = {
88
date: /Date$/i,
99
},
1010
},
11+
viewport: {
12+
viewports: {
13+
mobile1: {
14+
name: 'Small mobile',
15+
styles: {
16+
width: '320px',
17+
height: '568px',
18+
},
19+
type: 'mobile',
20+
},
21+
mobile2: {
22+
name: 'Large mobile',
23+
styles: {
24+
width: '414px',
25+
height: '896px',
26+
},
27+
type: 'mobile',
28+
},
29+
tablet: {
30+
name: 'Tablet',
31+
styles: {
32+
width: '834px',
33+
height: '1112px',
34+
},
35+
type: 'tablet',
36+
},
37+
desktop: {
38+
name: 'Desktop',
39+
styles: {
40+
width: '1024px',
41+
height: '1280px',
42+
},
43+
type: 'desktop',
44+
},
45+
ogImage: {
46+
name: 'OG Image (1200×630)',
47+
styles: {
48+
width: '1200px',
49+
height: '630px',
50+
},
51+
type: 'desktop',
52+
},
53+
},
54+
},
1155
},
1256
}
1357

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import type { Meta, StoryObj } from '@nuxtjs/storybook'
2+
import Component from './Default.vue'
3+
4+
const meta = {
5+
component: Component,
6+
tags: ['autodocs'],
7+
decorators: [
8+
() => ({
9+
template: '<div style="width:1200px;height:630px; outline:1px solid red"><story/></div>',
10+
}),
11+
],
12+
argTypes: {
13+
primaryColor: {
14+
control: { type: 'color' },
15+
description: 'Primary color used throughout the OG image',
16+
},
17+
title: {
18+
control: { type: 'text' },
19+
description: 'Main title displayed in the OG image',
20+
},
21+
description: {
22+
control: { type: 'text' },
23+
description: 'Description text (supports **bold** markdown)',
24+
},
25+
},
26+
} satisfies Meta<typeof Component>
27+
28+
export default meta
29+
type Story = StoryObj<typeof meta>
30+
31+
export const Default: Story = {}
32+
33+
export const CustomContent: Story = {
34+
args: {
35+
title: 'Custom Package',
36+
description: 'an awesome **customizable** OG image generator',
37+
primaryColor: '#f59e0b',
38+
},
39+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { Meta, StoryObj } from '@nuxtjs/storybook'
2+
import Component from './Package.vue'
3+
4+
const meta = {
5+
component: Component,
6+
decorators: [
7+
() => ({
8+
template: '<div style="width:1200px;height:630px; outline:1px solid red"><story/></div>',
9+
}),
10+
],
11+
} satisfies Meta<typeof Component>
12+
13+
export default meta
14+
type Story = StoryObj<typeof meta>
15+
16+
export const Package: Story = {
17+
args: { name: 'vue', version: 'latest' },
18+
}

0 commit comments

Comments
 (0)