Skip to content

Commit

Permalink
Merge pull request #91 from boostcampwm-2024/Feature/#080_panda_css_๋ผโ€ฆ
Browse files Browse the repository at this point in the history
โ€ฆ์ด๋ธŒ๋Ÿฌ๋ฆฌ_์„ค์ •

Feature/#80 panda css ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์ •
  • Loading branch information
minjungw00 authored Nov 11, 2024
2 parents 318e649 + 316d21c commit 05e6b0b
Show file tree
Hide file tree
Showing 40 changed files with 2,297 additions and 159 deletions.
7 changes: 6 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@
"printWidth": 100,
"tabWidth": 2,
"jsxSingleQuote": false,
"singleQuote": false
"singleQuote": false,

"plugins": ["@pandabox/prettier-plugin"],
"pandaFirstProps": ["as", "className", "layerStyle", "textStyle"],
"pandaStylePropsFirst": true,
"pandaSortOtherProps": true
}
4 changes: 4 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ dist-ssr
*.njsproj
*.sln
*.sw?

## Panda
styled-system
styled-system-studio
44 changes: 43 additions & 1 deletion client/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import jsxA11y from "eslint-plugin-jsx-a11y";
import { fileURLToPath } from "url";
import { dirname, resolve } from "path";
import rootConfig from "../eslint.config.js";
import panda from "@pandacss/eslint-plugin";
import pandabox from "@pandabox/prettier-plugin";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
Expand All @@ -14,10 +16,13 @@ export default [

{
files: ["src/**/*.{ts,tsx}"],
ignores: ["styled-system"],
plugins: {
react,
"react-hooks": reactHooks,
"jsx-a11y": jsxA11y,
"@pandacss": panda,
"@pandabox": pandabox,
},
languageOptions: {
parserOptions: {
Expand Down Expand Up @@ -70,17 +75,54 @@ export default [
"jsx-a11y/click-events-have-key-events": "warn",
"jsx-a11y/no-static-element-interactions": "warn",
"jsx-a11y/label-has-associated-control": "warn",

// import ์ˆœ์„œ
"import/order": [
"error",
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
"object",
"type",
],
pathGroups: [
{
pattern: "@/**",
group: "internal",
},
],
alphabetize: {
order: "asc",
},
},
],

...panda.configs.recommended.rules,
"@pandacss/no-config-function-in-source": "off",
"@pandacss/prefer-longhand-properties": "error",
},
settings: {
"import/resolver": {
typescript: {
alwaysTryTypes: true,
project: resolve(__dirname, "./tsconfig.json"),
project: "./tsconfig.json",
},
},
react: {
version: "detect",
},
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"],
},
"import/internal-regex": "^@/",
},
},
];
8 changes: 7 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
"dev": "vite --host",
"build": "tsc -b && vite build",
"lint": "eslint \"src/**/*.{ts,tsx}\" --fix",
"preview": "vite preview"
"preview": "vite preview",
"prepare": "panda codegen"
},
"dependencies": {
"@pandabox/panda-plugins": "^0.0.8",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"socket.io-client": "^4.8.1"
},
"devDependencies": {
"@pandabox/prettier-plugin": "^0.1.3",
"@pandacss/dev": "^0.47.1",
"@pandacss/eslint-plugin": "^0.2.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react": "^4.3.3",
Expand All @@ -23,6 +28,7 @@
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.14",
"prettier": "^3.0.0",
"vite": "^5.4.10",
"vite-tsconfig-paths": "^5.1.0"
}
Expand Down
30 changes: 30 additions & 0 deletions client/panda.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { defineConfig } from "@pandacss/dev";
import { radii } from "@styles/tokens/radii";
import { colors } from "@styles/tokens/color";
import { shadows } from "@styles/tokens/shadow";
import { spacing } from "@styles/tokens/spacing";
import { textStyles } from "@styles/typography";
import { globalStyles } from "@styles/global";
import { glassContainerRecipe } from "@styles/recipes/glassContainerRecipe";

export default defineConfig({
preflight: true,
include: ["./src/**/*.{js,jsx,ts,tsx}", "./pages/**/*.{js,jsx,ts,tsx}"],
exclude: [],
globalCss: globalStyles,
theme: {
extend: {
tokens: {
colors,
radii,
shadows,
spacing,
},
recipes: {
glassContainer: glassContainerRecipe,
},
textStyles,
},
},
outdir: "styled-system",
});
5 changes: 5 additions & 0 deletions client/postcss.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
'@pandacss/dev/postcss': {},
},
}
1 change: 0 additions & 1 deletion client/public/vite.svg

This file was deleted.

42 changes: 0 additions & 42 deletions client/src/App.css

This file was deleted.

24 changes: 3 additions & 21 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,11 @@
import { useState } from "react";
import reactLogo from "./assets/react.svg";
import viteLogo from "/vite.svg";
import "./App.css";
import WorkSpace from "@features/workSpace/WorkSpace";

const App = () => {
const [count, setCount] = useState(0);
// TODO ๋ผ์šฐํ„ฐ, react query ์„ค์ •

return (
<>
<div>
<a href="https://vite.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>Vite + React</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>
<WorkSpace />
</>
);
};
Expand Down
4 changes: 4 additions & 0 deletions client/src/assets/icons/plusIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added client/src/assets/images/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion client/src/assets/react.svg

This file was deleted.

24 changes: 24 additions & 0 deletions client/src/components/bottomNavigator/BottomNavigator.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { css, cx } from "@styled-system/css";
import { glassContainer } from "@styled-system/recipes";

export const bottomNavigatorContainer = cx(
glassContainer({
borderRadius: "top",
}),
css({
display: "flex",
zIndex: 1000,
position: "fixed",
left: "50%",
bottom: 0,
transform: "translateX(-50%)",
gap: "lg",
justifyContent: "center",
alignItems: "center",
minWidth: "360px",
height: "88px",
padding: "sm",
paddingBottom: "lg",
background: "white/60",
}),
);
30 changes: 30 additions & 0 deletions client/src/components/bottomNavigator/BottomNavigator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { IconButton } from "@components/button/IconButton";
import { bottomNavigatorContainer } from "./BottomNavigator.style";

interface NavItem {
id: number;
icon: string;
}

export const BottomNavigator = () => {
const items: NavItem[] = [
{
id: 1,
icon: "๐Ÿ ",
},
{
id: 2,
icon: "๐Ÿ”",
},
{
id: 3,
icon: "๐Ÿ“š",
},
];

return (
<div className={bottomNavigatorContainer}>
{items?.map(({ id, icon }) => <IconButton icon={icon} key={id} size="md" />)}
</div>
);
};
48 changes: 48 additions & 0 deletions client/src/components/button/IconButton.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { cva } from "@styled-system/css";

export const iconButtonContainer = cva({
base: {
display: "flex",

justifyContent: "center",
alignItems: "center",
borderRadius: "xs",
background: "white",
"&:hover": {
cursor: "pointer",
},
},
variants: {
size: {
sm: {
width: "44px",
height: "44px",
boxShadow: "sm",
},
md: {
width: "52px",
height: "52px",
boxShadow: "md",
},
},
},
defaultVariants: {
size: "md",
},
});

export const iconBox = cva({
variants: {
size: {
sm: {
fontSize: "24px",
},
md: {
fontSize: "30px",
},
},
},
defaultVariants: {
size: "md",
},
});
16 changes: 16 additions & 0 deletions client/src/components/button/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { iconButtonContainer, iconBox } from "./IconButton.style";

interface IconButtonProps {
icon: string;
size: "sm" | "md";
onClick?: () => void;
}

export const IconButton = ({ icon, size, onClick }: IconButtonProps) => {
// TODO ์ถ”ํ›„ svg ํŒŒ์ผ์„ ๋ฐ›์•„์˜ฌ ์ˆ˜ ์žˆ๋„๋ก ์ˆ˜์ • (์‚ฌ์ด๋“œ๋ฐ” - ํŽ˜์ด์ง€ ์ถ”๊ฐ€ ๋ฒ„ํŠผ)
return (
<button className={iconButtonContainer({ size })} onClick={onClick}>
<span className={iconBox({ size })}>{icon}</span>
</button>
);
};
23 changes: 23 additions & 0 deletions client/src/components/sidebar/MenuButton.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { css } from "@styled-system/css";

export const menuItemWrapper = css({
display: "flex",
gap: "lg",
alignItems: "center",
borderRightRadius: "md",
width: "300px",
padding: "md",
boxShadow: "sm",
});

export const imageBox = css({
borderRadius: "sm",
width: "50px",
height: "50px",
overflow: "hidden",
});

export const textBox = css({
textStyle: "display-medium20",
color: "gray.900",
});
Loading

0 comments on commit 05e6b0b

Please sign in to comment.