Skip to content

Commit 5bd9c99

Browse files
committed
Merge branch 'pr-fluffy-experiment' of github.com:shairez/qwik-ui into pr-fluffy-experiment
2 parents 2e368c3 + f0dacd9 commit 5bd9c99

File tree

14 files changed

+2025
-601
lines changed

14 files changed

+2025
-601
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { qwikVite } from '@builder.io/qwik/optimizer';
2+
import { resolve } from 'path';
3+
import { StorybookConfig } from 'storybook-framework-qwik';
4+
import { mergeConfig } from 'vite';
5+
import viteTsConfigPaths from 'vite-tsconfig-paths';
6+
7+
const config: StorybookConfig = {
8+
addons: [
9+
'@storybook/addon-links',
10+
'@storybook/addon-essentials',
11+
'@storybook/addon-a11y'
12+
],
13+
framework: {
14+
name: 'storybook-framework-qwik'
15+
},
16+
core: {
17+
renderer: 'storybook-framework-qwik'
18+
},
19+
stories: [
20+
// ...rootMain.stories,
21+
'../src/components/**/*.stories.mdx',
22+
'../src/components/**/*.stories.@(js|jsx|ts|tsx)'
23+
],
24+
25+
viteFinal: async (config: any) => {
26+
return mergeConfig(config, {
27+
plugins: [
28+
qwikVite({
29+
vendorRoots: [__dirname],
30+
srcDir: resolve(__dirname, '../src')
31+
}),
32+
viteTsConfigPaths()
33+
]
34+
});
35+
}
36+
};
37+
38+
export default config;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script>
2+
window.global = window;
3+
</script>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Parameters } from 'storybook-framework-qwik';
2+
3+
export const parameters: Parameters = {
4+
a11y: {
5+
config: {},
6+
options: {
7+
checks: { 'color-contrast': { options: { noScroll: true } } },
8+
restoreScroll: true
9+
}
10+
},
11+
options: {
12+
showRoots: true
13+
},
14+
docs: {
15+
iframeHeight: '200px'
16+
}
17+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"extends": "../tsconfig.json",
3+
"compilerOptions": {
4+
"experimentalDecorators": true,
5+
"emitDecoratorMetadata": true
6+
},
7+
8+
"exclude": [
9+
"../**/*.spec.ts",
10+
"../**/*.test.ts",
11+
"../**/*.spec.tsx",
12+
"../**/*.test.tsx"
13+
],
14+
"include": [
15+
"../src/**/*.stories.ts",
16+
"../src/**/*.stories.js",
17+
"../src/**/*.stories.jsx",
18+
"../src/**/*.stories.tsx",
19+
"../src/**/*.stories.mdx",
20+
"*.ts",
21+
"*.js",
22+
"preview.tsx"
23+
]
24+
}

packages/kit-fluffy/package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"private": false,
2323
"scripts": {
2424
"build": "qwik build",
25+
"build-storybook": "storybook build",
2526
"build.lib": "vite build --mode lib",
2627
"build.types": "tsc --emitDeclarationOnly",
2728
"dev": "vite --mode ssr",
@@ -31,6 +32,7 @@
3132
"prebuild.pandacss": "panda codegen --silent",
3233
"release": "np",
3334
"start": "vite --open --mode ssr",
35+
"storybook": "storybook dev -p 6006",
3436
"qwik": "qwik"
3537
},
3638
"dependencies": {},
@@ -39,6 +41,14 @@
3941
},
4042
"devDependencies": {
4143
"@builder.io/vite-plugin-macro": "~0.0.7",
42-
"@pandacss/dev": "^0.4.0"
44+
"@pandacss/dev": "^0.4.0",
45+
"@storybook/addon-essentials": "7.0.23",
46+
"@storybook/addon-links": "7.0.23",
47+
"@storybook/blocks": "7.0.23",
48+
"@storybook/builder-vite": "7.0.23",
49+
"@storybook/html": "7.0.23",
50+
"@storybook/html-vite": "7.0.23",
51+
"storybook": "7.0.23",
52+
"storybook-framework-qwik": "0.2.2"
4353
}
4454
}

packages/kit-fluffy/project.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,32 @@
6565
"tag": "${tag}",
6666
"notes": "${notes}"
6767
}
68+
},
69+
"storybook": {
70+
"executor": "@nx/storybook:storybook",
71+
"options": {
72+
"port": 4400,
73+
"configDir": "packages/kit-fluffy/.storybook"
74+
},
75+
"configurations": {
76+
"ci": {
77+
"quiet": true
78+
}
79+
}
80+
},
81+
"build-storybook": {
82+
"executor": "@nx/storybook:build",
83+
"outputs": ["{options.outputDir}"],
84+
"options": {
85+
"uiFramework": "@storybook/html",
86+
"configDir": "packages/kit-fluffy/.storybook",
87+
"outputDir": "dist/storybook/fluffy"
88+
},
89+
"configurations": {
90+
"ci": {
91+
"quiet": true
92+
}
93+
}
6894
}
6995
},
7096
"tags": []
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import type { Meta, StoryObj } from 'storybook-framework-qwik';
2+
import { Button, type ButtonProps } from './button';
3+
4+
const meta: Meta<ButtonProps> = {
5+
component: Button
6+
};
7+
8+
type Story = StoryObj<ButtonProps>;
9+
10+
export default meta;
11+
12+
export const Primary: Story = {
13+
args: {
14+
size: 'medium'
15+
},
16+
render: (props) => <Button {...props}>Some button</Button>
17+
};

packages/kit-fluffy/src/components/button/button.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,31 @@
4141
* Find a way to project the source code of this file into the docs
4242
4343
*/
44+
45+
import { Slot, component$, useStylesScoped$ } from '@builder.io/qwik';
46+
47+
export interface ButtonProps {
48+
size?: 'small' | 'medium' | 'large';
49+
}
50+
export const Button = component$<ButtonProps>(({ size = 'medium' }) => {
51+
useStylesScoped$(`
52+
.size-small {
53+
font-size: 10px;
54+
}
55+
.size-medium {
56+
font-size: 14px;
57+
}
58+
.size-large {
59+
font-size: 18px;
60+
}
61+
`);
62+
return (
63+
<button
64+
class={{
65+
[`size-${size}`]: true
66+
}}
67+
>
68+
<Slot></Slot>
69+
</button>
70+
);
71+
});

packages/kit-fluffy/src/root.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/no-empty-function
2+
export default () => {};
3+
4+
// THIS FILE IS ONLY HERE TO SATISFY QWIK BUILD

0 commit comments

Comments
 (0)