Skip to content

Commit

Permalink
Merge pull request #52 from linyows/stylex
Browse files Browse the repository at this point in the history
Use stylex
  • Loading branch information
linyows authored Feb 12, 2024
2 parents e3fad04 + a1fe011 commit 7630deb
Show file tree
Hide file tree
Showing 181 changed files with 10,264 additions and 2,576 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ jobs:
run: |
npm install
npm run build
npm run test
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,3 @@ public
# packages
/packages/**/dist

# storybook
.storybook
storybook-static
36 changes: 36 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { StorybookConfig } from "@storybook/react-vite";
import { stylexPlugin } from "vite-plugin-stylex-dev";

const config: StorybookConfig = {
stories: [
"../src/**/*.mdx",
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)",
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-onboarding",
"@storybook/addon-interactions",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
staticDirs: ['../examples/nextjs/public'],
docs: {
autodocs: "tag",
},
async viteFinal(config) {
const { plugins = [] } = config;
plugins.push(
stylexPlugin({
unstable_moduleResolution: {
type: 'commonJS',
rootDir: process.cwd()
}
})
)
return config
},
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
20 changes: 16 additions & 4 deletions examples/nextjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"prismjs": "^1.29.0",
"react": "^18",
"react-dom": "^18",
"rotion": "^0.0.8"
"rotion": "^0.0.10"
},
"devDependencies": {
"@types/node": "^20",
Expand Down
3 changes: 1 addition & 2 deletions examples/nextjs/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import '@/styles/globals.css'
import type { AppProps } from 'next/app'
import Head from 'next/head'
import 'rotion/styles/notionate.css'
import 'rotion/styles/notionate-dark.css'
import 'rotion/style.css'
import styles from '@/styles/App.module.css'

export default function App({ Component, pageProps }: AppProps) {
Expand Down
12 changes: 4 additions & 8 deletions examples/nextjs/pages/block.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { GetStaticProps, NextPage } from 'next'
import Image from 'next/image'
import Link from 'next/link'
import { useState, useEffect } from 'react'
import Header from '@/components/Header'
import Head from 'next/head'
import styles from '@/styles/Page.module.css'
import mermaid from 'mermaid'
import prism from 'prismjs'
import mermaid from 'mermaid'

import 'prismjs/themes/prism.min.css'
import 'prismjs/components/prism-bash'
import 'prismjs/components/prism-go'
import 'prismjs/components/prism-typescript'
Expand Down Expand Up @@ -57,11 +58,6 @@ export const getStaticProps: GetStaticProps<Props> = async (context) => {
}

const BlocksPage: NextPage<Props> = ({ title, icon, blocks, breadcrumbs }) => {
const [exModules, setExModules] = useState({ mermaid, prism })
useEffect(() => {
mermaid.initialize({ theme: window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'neutral' })
setExModules({ mermaid, prism })
}, [])
const hrefs = ['/', '/[name]']

return (
Expand All @@ -86,7 +82,7 @@ const BlocksPage: NextPage<Props> = ({ title, icon, blocks, breadcrumbs }) => {
</header>

<div className={`${styles.page} ${styles.wrapperPage}`}>
<Page blocks={blocks} modules={exModules} link={Link} breadcrumb_hrefs={hrefs} />
<Page blocks={blocks} link={Link} breadcrumb_hrefs={hrefs} />
</div>
</div>
<span></span>
Expand Down
Loading

0 comments on commit 7630deb

Please sign in to comment.