Skip to content
This repository has been archived by the owner on Jan 2, 2025. It is now read-only.

Commit

Permalink
feat(frontend): add storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
horacioh committed Sep 25, 2023
1 parent 4bb3efe commit a975709
Show file tree
Hide file tree
Showing 29 changed files with 6,857 additions and 4,321 deletions.
2 changes: 0 additions & 2 deletions .envrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ git config pull.rebase true
use nix --max-jobs auto
watch_file shell.nix build/nix/**/*.nix

export TAMAGUI_TARGET="web"

export APP_FOLDER_NAME="Mintter.dev"

export VITE_BACKEND_HTTP_PORT='55002'
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
- name: Build, package & make (Unix)
if: matrix.config.os != 'windows-latest'
run: |
TAMAGUI_TARGET=web DEBUG='electron-osx-sign*,electron-notarize*' yarn desktop:make --arch=${{ matrix.config.arch }}
DEBUG='electron-osx-sign*,electron-notarize*' yarn desktop:make --arch=${{ matrix.config.arch }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
Expand All @@ -120,7 +120,6 @@ jobs:
- name: Build, package and make (Win32)
if: matrix.config.os == 'windows-latest'
run: |
$env:TAMAGUI_TARGET="web"
$env:DEBUG='electron-osx-sign*,electron-notarize*'
yarn desktop:make --arch=${{ matrix.config.arch }}
env:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/testing-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
- name: Build, package & make (Unix)
if: matrix.config.os != 'windows-latest'
run: |
TAMAGUI_TARGET=web DEBUG='electron-osx-sign*,electron-notarize*' yarn desktop:make --arch=${{ matrix.config.arch }}
DEBUG='electron-osx-sign*,electron-notarize*' yarn desktop:make --arch=${{ matrix.config.arch }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
Expand All @@ -118,7 +118,6 @@ jobs:
- name: Build, package and make (Win32)
if: matrix.config.os == 'windows-latest'
run: |
$env:TAMAGUI_TARGET="web"
$env:DEBUG='electron-osx-sign*,electron-notarize*'
yarn desktop:make --arch=${{ matrix.config.arch }}
env:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,7 @@ thumbs.db
_env.scss

# changelog file
whats-new.txt
whats-new.txt

# tamagui
**/.tamagui/*
449 changes: 225 additions & 224 deletions .yarn/releases/yarn-3.5.1.cjs → .yarn/releases/yarn-3.6.1.cjs

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,5 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-version.cjs
spec: "@yarnpkg/plugin-version"

yarnPath: .yarn/releases/yarn-3.5.1.cjs
yarnPath: .yarn/releases/yarn-3.6.1.cjs
48 changes: 24 additions & 24 deletions frontend/apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,51 @@
},
"dependencies": {
"@bufbuild/connect-web": "0.7.0",
"@mintter/app": "workspace:*",
"@mintter/prettier": "workspace:*",
"@mintter/shared": "workspace:*",
"@mintter/ui": "workspace:*",
"@mintter/app": "*",
"@mintter/prettier": "*",
"@mintter/shared": "*",
"@mintter/ui": "*",
"@sentry/electron": "4.7.0",
"@sentry/vite-plugin": "latest",
"@trpc/client": "10.37.1",
"@trpc/react-query": "10.37.1",
"@trpc/server": "10.37.1",
"console-log-colors": "0.4.0",
"electron-log": "beta",
"electron-squirrel-startup": "^1.0.0",
"electron-squirrel-startup": "1.0.0",
"electron-store": "8.1.0",
"electron-trpc": "0.5.2",
"fs-extra": "^11.1.1",
"fs-extra": "11.1.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hot-toast": "2.4.1",
"superjson": "1.13.1",
"zod": "3.22.2"
},
"devDependencies": {
"@electron-forge/cli": "^6.4.1",
"@electron-forge/maker-deb": "^6.4.1",
"@electron-forge/maker-squirrel": "^6.4.1",
"@electron-forge/maker-zip": "^6.4.1",
"@electron-forge/plugin-vite": "^6.4.1",
"@electron-forge/shared-types": "^6.4.2",
"@mintter/prettier": "workspace:*",
"@electron-forge/cli": "6.4.1",
"@electron-forge/maker-deb": "6.4.1",
"@electron-forge/maker-squirrel": "6.4.1",
"@electron-forge/maker-zip": "6.4.1",
"@electron-forge/plugin-vite": "6.4.1",
"@electron-forge/shared-types": "6.4.2",
"@mintter/prettier": "*",
"@playwright/test": "1.37.1",
"@tamagui/core-node": "^1.61.3",
"@tamagui/vite-plugin": "1.61.1",
"@tamagui/core-node": "1.61.3",
"@tamagui/vite-plugin": "1.69.0",
"@types/react": "18.2.20",
"@types/react-dom": "18.2.7",
"@vitejs/plugin-react": "^4.0.4",
"@vitejs/plugin-react": "4.0.4",
"electron": "26.0.0",
"electron-playwright-helpers": "1.6.0",
"eslint-config-custom": "workspace:*",
"react-devtools": "^4.28.0",
"react-error-boundary": "^4.0.11",
"react-native-svg": "^13.13.0",
"react-native-web-lite": "^1.65.0",
"tamagui": "^1.65.0",
"vite": "^4.4.9",
"eslint-config-custom": "*",
"react-devtools": "4.28.0",
"react-error-boundary": "4.0.11",
"react-native-svg": "13.9.0",
"react-native-web-lite": "1.69.0",
"tamagui": "1.69.0",
"vite": "4.4.9",
"vite-tsconfig-paths": "4.2.0",
"xvfb-maybe": "^0.2.1"
"xvfb-maybe": "0.2.1"
}
}
32 changes: 15 additions & 17 deletions frontend/apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "next dev",
"build": "TAMAGUI_TARGET=web next build",
"build": "next build",
"start": "next start",
"serve": "NODE_ENV=production next start --port 8151",
"lint": "next lint",
Expand All @@ -16,23 +16,20 @@
"@bufbuild/connect-node": "0.8.6",
"@bufbuild/connect-web": "0.7.0",
"@bufbuild/protobuf": "1.2.0",
"@mintter/shared": "0.1.0",
"@mintter/ui": "0.1.0",
"@mintter/shared": "*",
"@mintter/ui": "*",
"@sentry/nextjs": "latest",
"@tamagui/lucide-icons": "1.61.1",
"@tamagui/next-theme": "1.61.1",
"@tamagui/lucide-icons": "1.69.0",
"@tamagui/next-theme": "1.69.0",
"@tanstack/react-query": "4.33.0",
"@trpc/client": "10.37.1",
"@trpc/next": "10.37.1",
"@trpc/react-query": "10.37.1",
"@trpc/server": "10.37.1",
"@types/node": "20.5.2",
"@types/react": "18.2.20",
"@types/react-dom": "18.2.7",
"@vercel/og": "0.0.21",
"browser-headers": "0.4.1",
"clsx": "1.2.1",
"date-fns": "^2.30.0",
"date-fns": "2.30.0",
"is-plain-object": "5.0.0",
"js-video-url-parser": "0.5.1",
"long": "5.2.3",
Expand All @@ -42,25 +39,26 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-hot-toast": "2.4.1",
"react-native": "0.71.7",
"react-native-svg": "13.9.0",
"react-native-web": "0.19.4",
"react-native-web-lite": "1.61.1",
"react-native-web": "~0.19.6",
"react-native-web-lite": "1.69.0",
"react-qr-code": "2.0.11",
"shiki-es": "0.2.0",
"tamagui": "1.61.1",
"tamagui": "1.69.0",
"typescript": "5.1.6",
"unist-util-visit": "4.1.2",
"zod": "3.22.2"
},
"devDependencies": {
"@babel/core": "7.22.10",
"@mintter/prettier": "workspace:*",
"@tamagui/next-plugin": "1.61.1",
"@mintter/prettier": "*",
"@tamagui/next-plugin": "1.69.0",
"@tanstack/react-query-devtools": "4.33.0",
"@types/node": "^20.6.5",
"@types/react": "18.2.20",
"@types/react-dom": "18.2.7",
"@types/react-native": "0.71.8",
"@types/unist": "2.0.6",
"eslint-config-custom": "workspace:*",
"eslint-config-custom": "*",
"expo-modules-core": "0.6.5",
"expo-screen-orientation": "4.3.0",
"next-transpile-modules": "10.0.1",
Expand Down
23 changes: 15 additions & 8 deletions frontend/apps/site/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"extends": "../../../tsconfig.json",
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"baseUrl": ".",
"paths": {
"react-native": ["react-native-web"]
},
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -15,13 +18,17 @@
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"baseUrl": ".",
"paths": {
"@mintter/ui": ["*", "../../packages/ui/src/index.tsx"],
"@mintter/shared": ["*", "../../packages/shared/src/index.ts"],
"react-native": ["react-native-web"]
}
"plugins": [
{
"name": "next"
},
{
// docs: https://github.com/nderscore/tamagui-typescript-plugin#readme
"name": "@nderscore/tamagui-typescript-plugin",
"pathToApp": "."
}
]
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
1 change: 1 addition & 0 deletions frontend/apps/storybook/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public-storybook/
30 changes: 30 additions & 0 deletions frontend/apps/storybook/.storybook/decorator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {TamaguiProvider, Theme, ThemeName, YStack} from "@mintter/ui";
import {Decorator} from "@storybook/react";
import React from "react";
import config from "../tamagui.config";

export const StorybookDecorator: Decorator = (Story, args: any) => {
const {
theme1,
theme2,
theme3,
theme4,
// inverseTheme
} = args.globals;
const themeName =
[theme2, theme3, theme4].filter((theme) => !!theme).join("_") || null;

return (
// <UniversalThemeProvider>
<TamaguiProvider config={config} defaultTheme={theme1}>
{/* <ToastProvider> */}
<YStack backgroundColor="$background" padding="$4" f={1}>
<Theme forceClassName name={themeName as ThemeName}>
<Story />
</Theme>
</YStack>
{/* </ToastProvider> */}
</TamaguiProvider>
// </UniversalThemeProvider>
);
};
53 changes: 53 additions & 0 deletions frontend/apps/storybook/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {StorybookConfig} from "@storybook/nextjs";
import path from "path";

const config: StorybookConfig = {
stories: ["../../../packages/ui/**/*.stories.@(ts|tsx|mdx)"],
features: {
storyStoreV7: false,
},
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
{
name: "@storybook/addon-react-native-web",
options: {
modulesToTranspile: [
// "solito",
// "expo-linking",
// "expo-constants",
// "expo-modules-core",
// "expo-document-picker",
// "expo-av",
// "expo-asset",
],
},
},
],
framework: {
name: path.resolve(require.resolve("@storybook/nextjs/preset"), ".."),
options: {
builder: {
useSWC: true,
},
},
},
core: {
builder: {
name: "@storybook/builder-webpack5",
options: {
fsCache: true,
lazyCompilation: true,
},
},
},
env: (config) => ({
...config,
// TAMAGUI_TARGET: "web",
}),
docs: {
autodocs: true,
},
};
export default config;
Loading

0 comments on commit a975709

Please sign in to comment.