Skip to content

Commit

Permalink
feat: 프로젝트 아키텍처 구축 (#14)
Browse files Browse the repository at this point in the history
Auto-merging PR
  • Loading branch information
Andrevile authored Jun 21, 2024
1 parent f2d019b commit ad66858
Show file tree
Hide file tree
Showing 52 changed files with 448 additions and 151 deletions.
88 changes: 2 additions & 86 deletions apps/web/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,95 +1,11 @@
import Image from "next/image";
import styles from "./page.module.css";
import { FirstDomainExampleScreen } from "@sambad/domains/first-domain";

export default function Home() {
return (
<main className={styles.main}>
<div className={styles.description}>
<p>
Get started by editing&nbsp;
<code className={styles.code}>src/app/page.tsx</code>
</p>
<div>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
By{" "}
<Image
src="/vercel.svg"
alt="Vercel Logo"
className={styles.vercelLogo}
width={100}
height={24}
priority
/>
</a>
</div>
</div>

<div className={styles.center}>
<Image
className={styles.logo}
src="/next.svg"
alt="Next.js Logo"
width={180}
height={37}
priority
/>
</div>

<div className={styles.grid}>
<a
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Docs <span>-&gt;</span>
</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>

<a
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Learn <span>-&gt;</span>
</h2>
<p>Learn about Next.js in an interactive course with&nbsp;quizzes!</p>
</a>

<a
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Templates <span>-&gt;</span>
</h2>
<p>Explore starter templates for Next.js.</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
className={styles.card}
target="_blank"
rel="noopener noreferrer"
>
<h2>
Deploy <span>-&gt;</span>
</h2>
<p>
Instantly deploy your Next.js site to a shareable URL with Vercel.
</p>
</a>
</div>
<FirstDomainExampleScreen />
</main>
);
}
11 changes: 11 additions & 0 deletions apps/web/app/second/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Image from "next/image";
import styles from "../page.module.css";
import { SecondDomainExampleScreen } from "@sambad/domains/second-domain";

export default function Second() {
return (
<main className={styles.main}>
<SecondDomainExampleScreen />
</main>
);
}
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@sambad/ui": "workspace:*",
"@sambad/domains": "workspace:*",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "14.2.4"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions packages/core/sds/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `sds`
20 changes: 20 additions & 0 deletions packages/core/sds/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@sambad/sds",
"version": "0.0.0",
"private": true,
"exports": {},
"scripts": {
"lint": "eslint . --max-warnings 0"
},
"devDependencies": {
"@sambad/eslint-config": "workspace:*",
"@sambad/typescript-config": "workspace:*",
"@types/node": "^20.11.24",
"@types/eslint": "^8.56.5",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"eslint": "^8.57.0",
"react": "^18",
"typescript": "^5.3.3"
}
}
Empty file added packages/core/sds/src/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@repo/typescript-config/react-library.json",
"extends": "@sambad/typescript-config/react-library.json",
"compilerOptions": {
"outDir": "dist"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "@repo/typescript-config/react-library.json",
"extends": "@sambad/typescript-config/react-library.json",
"compilerOptions": {
"outDir": "dist"
},
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions packages/core/ui/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["@repo/eslint-config/react-internal.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.lint.json",
tsconfigRootDir: __dirname,
},
};
7 changes: 2 additions & 5 deletions packages/ui/package.json → packages/core/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
"version": "0.0.0",
"private": true,
"exports": {
"./button": "./src/button.tsx",
"./card": "./src/card.tsx",
"./code": "./src/code.tsx"
".": "./src/index.ts"
},
"scripts": {
"lint": "eslint . --max-warnings 0",
"generate:component": "turbo gen react-component"
"lint": "eslint . --max-warnings 0"
},
"devDependencies": {
"@sambad/eslint-config": "workspace:*",
Expand Down
12 changes: 9 additions & 3 deletions packages/ui/src/button.tsx → packages/core/ui/src/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
"use client";

import { ReactNode } from "react";
import { HTMLAttributes, ReactNode } from "react";

interface ButtonProps {
interface ButtonProps extends HTMLAttributes<HTMLButtonElement> {
children: ReactNode;
className?: string;
appName: string;
}

export const Button = ({ children, className, appName }: ButtonProps) => {
export const Button = ({
children,
className,
appName,
...rest
}: ButtonProps) => {
return (
<button
className={className}
onClick={() => alert(`Hello from your ${appName} app!`)}
{...rest}
>
{children}
</button>
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions packages/core/ui/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { Button } from "./Button";
export { Card } from "./Card";
export { Code } from "./Code";
8 changes: 8 additions & 0 deletions packages/core/ui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@sambad/typescript-config/react-library.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
8 changes: 8 additions & 0 deletions packages/core/ui/tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@sambad/typescript-config/react-library.json",
"compilerOptions": {
"outDir": "dist"
},
"include": ["src", "turbo"],
"exclude": ["node_modules", "dist"]
}
10 changes: 10 additions & 0 deletions packages/domains/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ["@sambad/eslint-config/react-internal.js"],
parser: "@typescript-eslint/parser",
parserOptions: {
project: "./tsconfig.lint.json",
tsconfigRootDir: __dirname,
},
};
1 change: 1 addition & 0 deletions packages/domains/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# `domains`
25 changes: 25 additions & 0 deletions packages/domains/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@sambad/domains",
"version": "0.0.0",
"private": true,
"exports": {
"./first-domain": "./src/first-domain/index.ts",
"./second-domain": "./src/second-domain/index.ts"
},
"scripts": {
"lint": "eslint . --max-warnings 0"
},
"dependencies": {},
"devDependencies": {
"@sambad/ui": "workspace:*",
"@sambad/eslint-config": "workspace:*",
"@sambad/typescript-config": "workspace:*",
"@types/node": "^20.11.24",
"@types/eslint": "^8.56.5",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"eslint": "^8.57.0",
"react": "^18",
"typescript": "^5.3.3"
}
}
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Button } from "@sambad/ui";
import { PropsWithChildren } from "react";

interface FirstFeatureOfFirstDomainBoxProps {
displayText: string;
onClick?: () => void;
}

export const FirstFeatureOfFirstDomainBox = ({
displayText,
onClick,
children,
}: PropsWithChildren<FirstFeatureOfFirstDomainBoxProps>) => {
return (
<div>
<Button appName="Container Box Button" onClick={onClick}>
FirstDomainTestBox
</Button>
{displayText}
{children}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Button } from "@sambad/ui";
import { HTMLAttributes, ReactNode } from "react";
import { useFirstFeatureOfFirstDomainTestButton } from "../hooks/useFirstFeatureOfFirstDomainTestButton";

interface FirstFeaturedOfFirstDomainTestButtonProps
extends HTMLAttributes<HTMLButtonElement> {
children?: ReactNode;
}

export const FirstFeatureOfFirstDomainTestButton = ({
children,
...rest
}: FirstFeaturedOfFirstDomainTestButtonProps) => {
const { testText, handleChangeTestText } =
useFirstFeatureOfFirstDomainTestButton();

return (
<Button appName="sambad" onClick={handleChangeTestText} {...rest}>
{children}
{testText}
</Button>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use client";

import { FirstFeatureOfFirstDomainBox } from "../components/FirstFeatureOfFirstDomainTestBox";
import { FirstFeatureOfFirstDomainTestButton } from "../components/FirstFeatureOfFirstDomainTestButton";
import { useFirstFeatureOfFirstDomainService } from "../services/useFirstFeatureOfFirstDomainTestService";

export const FirstFeatureOfFirstDomainTestContainer = () => {
const { displayText, handleChangeDisplayText } =
useFirstFeatureOfFirstDomainService();

return (
<FirstFeatureOfFirstDomainBox
displayText={displayText}
onClick={handleChangeDisplayText}
>
<FirstFeatureOfFirstDomainTestButton
onClick={() => {
alert("Button is Clicked at Container");
}}
/>
</FirstFeatureOfFirstDomainBox>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useState } from "react";

export const useFirstFeatureOfFirstDomainTestButton = () => {
const [testText, setTestText] = useState<string>("Default Button Text");

const handleChangeTestText = () => {
setTestText("Test Button is Clicked!!");
};

return {
testText,
handleChangeTestText,
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { useState } from "react";

export const useFirstFeatureOfFirstDomainService = () => {
const [displayText, setDisplayText] = useState<string>("");

const handleChangeDisplayText = () => {
setDisplayText("Test Container Button Clicked");
};

return {
displayText,
handleChangeDisplayText,
};
};
1 change: 1 addition & 0 deletions packages/domains/src/first-domain/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { FirstDomainExampleScreen } from "./screens/FirstDomainExampleScreen";
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { FirstFeatureOfFirstDomainTestContainer } from "../features/containers/FirstFeatureOfFirstDomainTestContainer";

export const FirstDomainExampleScreen = () => {
return (
<div>
<h1>도메인 화면을 전체 담당 하는 컴포넌트입니다.</h1>
<FirstFeatureOfFirstDomainTestContainer />
</div>
);
};
Empty file.
Loading

0 comments on commit ad66858

Please sign in to comment.