Skip to content

Commit

Permalink
Implements storybook (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsnow301 authored Nov 16, 2024
1 parent 6ecbeff commit aadb982
Show file tree
Hide file tree
Showing 57 changed files with 3,422 additions and 39 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules

*storybook.log
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ pnpm-lock.yaml
*.css
*.jsx
*.json
.github/PULL_REQUEST_TEMPLATE.md
26 changes: 26 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { StorybookConfig } from '@storybook/react-vite';
import sass from 'sass';

const config: StorybookConfig = {
stories: ['../stories/**/*.stories.tsx'],
addons: [
'@storybook/addon-onboarding',
'@storybook/addon-essentials',
'@chromatic-com/storybook',
'@storybook/addon-interactions',
{
name: 'storybook-addon-sass-postcss',
options: {
postcssLoaderOptions: {
implementation: sass,
},
},
},
],
framework: {
name: '@storybook/react-vite',
options: {},
},
};

export default config;
21 changes: 21 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Preview } from '@storybook/react';
import 'tgui-styles';
import '../stories/assets/fonts.css';
import '../stories/assets/all.min.css';

const preview: Preview = {
parameters: {
backgrounds: {
values: [{ name: 'dark', value: 'hsl(0, 0%, 14%)' }],
default: 'dark',
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"files": {
"ignoreUnknown": false,
"ignore": ["node_modules", "dist", "styles/**/*.d.ts"]
"ignore": ["node_modules", "dist", "stories/assets"]
},
"formatter": {
"enabled": true,
Expand Down
26 changes: 17 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@
"name": "tgui-core",
"version": "1.3.0",
"description": "TGUI core component library",
"keywords": [
"TGUI",
"library",
"typescript"
],
"files": [
"dist"
],
"keywords": ["TGUI", "library", "typescript"],
"files": ["dist"],
"exports": {
"./components": {
"import": "./dist/components/index.js",
Expand All @@ -28,14 +22,24 @@
"dev": "vite",
"build": "tsc --noEmit && vite build",
"lint": "biome check lib",
"lint:fix": "prettier . --write && biome check . --fix"
"lint:fix": "prettier . --write && biome check . --fix",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build"
},
"author": "jlsnow301",
"license": "MIT",
"type": "module",
"devDependencies": {
"@biomejs/biome": "1.9.4",
"@chromatic-com/storybook": "3.2.2",
"@popperjs/core": "^2.11.8",
"@storybook/addon-essentials": "8.4.4",
"@storybook/addon-interactions": "8.4.4",
"@storybook/addon-onboarding": "8.4.4",
"@storybook/blocks": "8.4.4",
"@storybook/react": "8.4.4",
"@storybook/react-vite": "8.4.4",
"@storybook/test": "8.4.4",
"@types/node": "^22.9.0",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
Expand All @@ -44,6 +48,10 @@
"glob": "^11.0.0",
"prettier": "^3.3.3",
"react-popper": "^2.3.0",
"sass": "^1.81.0",
"storybook": "8.4.4",
"storybook-addon-sass-postcss": "^0.3.2",
"tgui-styles": "^0.0.8",
"typescript": "^5.6.3",
"vite": "^5.4.11",
"vite-plugin-dts": "^4.3.0"
Expand Down
Loading

0 comments on commit aadb982

Please sign in to comment.