Skip to content

Commit

Permalink
chore: 해커톤 신청페이지 초기 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
toothlessdev committed Sep 27, 2024
1 parent 19f7bde commit 1864c4d
Show file tree
Hide file tree
Showing 47 changed files with 3,047 additions and 183 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/client.storybook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Deploy Storybook"

on:
pull_request:
branches: ["develop"]
types: ["closed"]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- run: yarn
- uses: chromaui/action
with:
projectToken: ${{secrets.CHROMATIC_PROJECT_TOKEN}}
2 changes: 2 additions & 0 deletions packages/client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?

*storybook.log
26 changes: 26 additions & 0 deletions packages/client/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { join, dirname } from "path";

import type { StorybookConfig } from "@storybook/react-vite";

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}
const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
getAbsolutePath("@storybook/addon-onboarding"),
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@chromatic-com/storybook"),
getAbsolutePath("@storybook/addon-interactions"),
],
framework: {
name: getAbsolutePath("@storybook/react-vite"),
options: {},
},
};
export default config;
14 changes: 14 additions & 0 deletions packages/client/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
23 changes: 22 additions & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,44 @@
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build:storybook": "storybook build",
"chromatic": "npx chromatic --project-token=chpt_de8ea52bc34d1a3"
},
"dependencies": {
"@gsap/react": "^2.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.9.0",
"@eslint/js": "^9.9.0",
"@storybook/addon-essentials": "^8.3.3",
"@storybook/addon-interactions": "^8.3.3",
"@storybook/addon-links": "^8.3.3",
"@storybook/addon-onboarding": "^8.3.3",
"@storybook/blocks": "^8.3.3",
"@storybook/react": "^8.3.3",
"@storybook/react-vite": "^8.3.3",
"@storybook/test": "^8.3.3",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"chromatic": "^11.10.4",
"eslint": "^9.9.0",
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
"eslint-plugin-react-refresh": "^0.4.9",
"eslint-plugin-storybook": "^0.9.0",
"globals": "^15.9.0",
"storybook": "^8.3.3",
"typescript": "^5.5.3",
"typescript-eslint": "^8.0.1",
"vite": "^5.4.1"
},
"eslintConfig": {
"extends": [
"plugin:storybook/recommended"
]
}
}
42 changes: 0 additions & 42 deletions packages/client/src/App.css

This file was deleted.

33 changes: 2 additions & 31 deletions packages/client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,3 @@
import { useState } from "react";

import "./App.css";
import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";

function App() {
const [count, setCount] = useState(0);

return (
<>
<div>
<a href="https://vitejs.dev" target="_blank">
<img src={viteLogo} className="logo" alt="Vite logo" />
</a>
<a href="https://react.dev" target="_blank">
<img src={reactLogo} className="logo react" alt="React logo" />
</a>
</div>
<h1>Client</h1>
<div className="card">
<button onClick={() => setCount((count) => count + 1)}>count is {count}</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
<p className="read-the-docs">Click on the Vite and React logos to learn more</p>
</>
);
export default function App() {
return <>APP</>;
}

export default App;
Empty file.
1 change: 0 additions & 1 deletion packages/client/src/assets/react.svg

This file was deleted.

Empty file.
Empty file.
Empty file.
Empty file.
68 changes: 0 additions & 68 deletions packages/client/src/index.css

This file was deleted.

13 changes: 11 additions & 2 deletions packages/client/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";

import App from "./App.tsx";
import "./index.css";
import gsap from "gsap";

import { globalStyle } from "./styles/global";
import App from "@/App.tsx";
import { Global } from "@emotion/react";
import { useGSAP } from "@gsap/react";
import { ScrollTrigger } from "gsap/ScrollTrigger";

gsap.registerPlugin(useGSAP);
gsap.registerPlugin(ScrollTrigger);

createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
<Global styles={[globalStyle]} />
</StrictMode>,
);
Empty file.
Empty file.
53 changes: 53 additions & 0 deletions packages/client/src/stories/Button.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';

import { Button } from './Button';

// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
const meta = {
title: 'Example/Button',
component: Button,
parameters: {
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
layout: 'centered',
},
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
tags: ['autodocs'],
// More on argTypes: https://storybook.js.org/docs/api/argtypes
argTypes: {
backgroundColor: { control: 'color' },
},
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
args: { onClick: fn() },
} satisfies Meta<typeof Button>;

export default meta;
type Story = StoryObj<typeof meta>;

// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
export const Primary: Story = {
args: {
primary: true,
label: 'Button',
},
};

export const Secondary: Story = {
args: {
label: 'Button',
},
};

export const Large: Story = {
args: {
size: 'large',
label: 'Button',
},
};

export const Small: Story = {
args: {
size: 'small',
label: 'Button',
},
};
37 changes: 37 additions & 0 deletions packages/client/src/stories/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';

import './button.css';

export interface ButtonProps {
/** Is this the principal call to action on the page? */
primary?: boolean;
/** What background color to use */
backgroundColor?: string;
/** How large should the button be? */
size?: 'small' | 'medium' | 'large';
/** Button contents */
label: string;
/** Optional click handler */
onClick?: () => void;
}

/** Primary UI component for user interaction */
export const Button = ({
primary = false,
size = 'medium',
backgroundColor,
label,
...props
}: ButtonProps) => {
const mode = primary ? 'storybook-button--primary' : 'storybook-button--secondary';
return (
<button
type="button"
className={['storybook-button', `storybook-button--${size}`, mode].join(' ')}
style={{ backgroundColor }}
{...props}
>
{label}
</button>
);
};
Loading

0 comments on commit 1864c4d

Please sign in to comment.