From ec13f72edcc7255217dad2b9926f03cb1f08a619 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Sun, 12 Feb 2023 19:14:30 +0900 Subject: [PATCH 001/131] =?UTF-8?q?chore:=20=EA=B0=9C=EB=B0=9C=20=EB=B9=8C?= =?UTF-8?q?=EB=93=9C=20=EC=8B=9C=EC=9E=91=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 3698b33..b824861 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "dev": "next dev", "build": "next build", "start": "next start -p 8080", + "start:dev": "next start -p 8081", "lint": "next lint" }, "dependencies": { From 57ae547daf15d79138ff8c1947279e1f79df946e Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Sun, 12 Feb 2023 19:14:54 +0900 Subject: [PATCH 002/131] =?UTF-8?q?chore:=20dev=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EB=B0=B0=ED=8F=AC=20workflow=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD-dev.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/CD-dev.yml diff --git a/.github/workflows/CD-dev.yml b/.github/workflows/CD-dev.yml new file mode 100644 index 0000000..c7027e1 --- /dev/null +++ b/.github/workflows/CD-dev.yml @@ -0,0 +1,31 @@ +name: CD + +on: + pull_request: + types: [closed] + branches: [dev] + +jobs: + cd-dev: + name: Deploy + environment: + name: development + url: http://wealth-marble-dev.kro.kr/ + runs-on: ubuntu-latest + steps: + - name: SSH Remote Commands + uses: appleboy/ssh-action@v0.1.7 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + timeout: 30s + script: | + export NVM_DIR=~/.nvm + source ~/.nvm/nvm.sh + cd wealth-marble-frontend-dev + git pull + npm i -f + npm run build + pm2 delete wealth-marble-dev + pm2 start npm --name "wealth-marble-dev" -- run start:dev From b6e805c1787dc28bdbcc81fc9743fb65be2bd0e9 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Sun, 12 Feb 2023 19:15:22 +0900 Subject: [PATCH 003/131] =?UTF-8?q?chore:=20main=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EB=B0=B0=ED=8F=AC=20environment=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index b24e518..2eb6edc 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -8,6 +8,9 @@ on: jobs: cd: name: Deploy + environment: + name: production + url: http://wealth-marble.kro.kr/ runs-on: ubuntu-latest steps: - name: SSH Remote Commands From 858bc2045536bc14fd7ebb7ce41ea32884043e8b Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Mon, 13 Feb 2023 18:30:27 +0900 Subject: [PATCH 004/131] =?UTF-8?q?fix:=20description=20=EC=98=A4=ED=83=80?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cahoot/DetailInfo.tsx | 4 ++-- src/types/cahoot.d.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/cahoot/DetailInfo.tsx b/src/components/cahoot/DetailInfo.tsx index e776792..c94c3de 100644 --- a/src/components/cahoot/DetailInfo.tsx +++ b/src/components/cahoot/DetailInfo.tsx @@ -20,7 +20,7 @@ const DetailInfo = () => { stockNum, stockStart, stockEnd, - descritption, + description, }, }, } = useSuspendedQuery>( @@ -72,7 +72,7 @@ const DetailInfo = () => {
- {descritption} + {description}
); diff --git a/src/types/cahoot.d.ts b/src/types/cahoot.d.ts index 3c09dea..dfb23e0 100644 --- a/src/types/cahoot.d.ts +++ b/src/types/cahoot.d.ts @@ -25,7 +25,7 @@ export type CahootDetailType = CahootType & { expectedMonth: number; expectedTotalCost: number; shortDescription: string; - descritption: string; + description: string; status: string; expectedRateOfReturn: number; }; From e798af0dae5b250fd9a3cfa43280c9a711b48812 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Mon, 13 Feb 2023 21:22:19 +0900 Subject: [PATCH 005/131] =?UTF-8?q?fix:=20=EB=A7=88=EA=B0=90=EB=90=9C=20?= =?UTF-8?q?=EA=B3=B5=EB=AA=A8=20=EC=A3=BC=EB=AC=B8=20=EB=B0=A9=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/cahoot/DetailHeader.tsx | 4 +-- src/components/cahoot/OrderMobile.tsx | 46 ++++++++++++++------------ src/types/cahoot.d.ts | 2 +- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/components/cahoot/DetailHeader.tsx b/src/components/cahoot/DetailHeader.tsx index 6daab2e..239b59f 100644 --- a/src/components/cahoot/DetailHeader.tsx +++ b/src/components/cahoot/DetailHeader.tsx @@ -14,7 +14,7 @@ const DetailHeader = () => { const router = useRouter(); const { data: { - data: { images, title, location, competitionRate, stockPrice }, + data: { images, title, location, competitionRate, stockPrice, status }, }, } = useSuspendedQuery>( ['cahoot/detail', router.query.id], @@ -58,7 +58,7 @@ const DetailHeader = () => { 주당 가격 {stockPrice.toLocaleString()}원 - + {status === 'CAHOOTS_ONGOING' && } - )} - + ) : ( + + )} + + )} ); }; diff --git a/src/types/cahoot.d.ts b/src/types/cahoot.d.ts index dfb23e0..cde7ebe 100644 --- a/src/types/cahoot.d.ts +++ b/src/types/cahoot.d.ts @@ -2,7 +2,7 @@ type CahootType = { id: number; title: string; location: string; - status: string; + status: 'CAHOOTS_CLOSE' | 'CAHOOTS_ONGOING' | 'CAHOOTS_BEFORE'; stockStart: string; stockEnd: string; stockPrice: number; From 34958df0f239752a78a3f64e8914e03bf0bdb34c Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Mon, 13 Feb 2023 21:22:57 +0900 Subject: [PATCH 006/131] =?UTF-8?q?chore:=20API=20=EC=84=9C=EB=B2=84=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=ED=99=98=EA=B2=BD=20=EB=B3=80=EC=88=98?= =?UTF-8?q?=EB=A1=9C=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/next.config.js b/next.config.js index 09a518e..e26d355 100644 --- a/next.config.js +++ b/next.config.js @@ -18,7 +18,7 @@ const moduleExports = { }, async rewrites() { - return [{ source: '/api/:path*', destination: `http://13.125.187.195:8080/api/:path*` }]; + return [{ source: '/api/:path*', destination: `${process.env.SERVER_DOMAIN}/api/:path*` }]; }, sentry: { // Use `hidden-source-map` rather than `source-map` as the Webpack `devtool` From e4e7a3087e7c3adad3eb41dc651000aaf281dce5 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Mon, 13 Feb 2023 21:37:42 +0900 Subject: [PATCH 007/131] =?UTF-8?q?fix:=20CI=20.env=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CI.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f67b62d..1a57a75 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -31,5 +31,9 @@ jobs: shell: bash run: | echo "${{ secrets.SENTRY_TOKEN }}" > .sentryclirc + - name: Create .env + shell: bash + run: | + echo "${{ secrets.ENVIRONMENTS }}" > .env - name: Build Test run: npm run build From dd678d262c857ec6d3349c039c973e82d046350e Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Mon, 13 Feb 2023 21:41:29 +0900 Subject: [PATCH 008/131] =?UTF-8?q?fix:=20=ED=83=80=EC=9E=85=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20=EC=98=A4?= =?UTF-8?q?=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/mock/infinite-cahoot.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/api/mock/infinite-cahoot.ts b/src/pages/api/mock/infinite-cahoot.ts index 007d53d..1895acf 100644 --- a/src/pages/api/mock/infinite-cahoot.ts +++ b/src/pages/api/mock/infinite-cahoot.ts @@ -1,9 +1,9 @@ -import type { CahootListType } from '@/types/cahoot'; +import type { CahootListType, CahootType } from '@/types/cahoot'; import type { Response } from '@/types/response'; import type { NextApiRequest, NextApiResponse } from 'next'; -const MOCK_DATA = Array(40) +const MOCK_DATA: CahootType[] = Array(40) .fill(undefined) .map((_, index) => ({ id: index + 1, From d715fab597a47d685091a3ace958540edfc31014 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Mon, 13 Feb 2023 23:19:12 +0900 Subject: [PATCH 009/131] =?UTF-8?q?fix:=20=EB=A9=94=EC=9D=B8=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20error=20boundary=20=EB=B0=8F=20suspense=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index.tsx | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/pages/index.tsx b/src/pages/index.tsx index c86c027..06de75b 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -6,6 +6,7 @@ import RecentUploadCarousel from '@/components/RecentUploadCarousel'; import RecommendedList from '@/components/RecommendedList'; import Thumbnail from '@/components/Thumbnail'; import TopFiveList from '@/components/TopFiveList'; +import { ErrorBoundary } from '@sentry/nextjs'; import type { GetServerSideProps } from 'next'; @@ -13,15 +14,30 @@ export default function Home() { return (
- - error

}> - -
- -
- - -
+ ( + <> +

{error.message}

+ + + )} + > + + 로딩...

}> + +
+ 로딩...

}> + +
+
+ 로딩...

}> + +
+ 로딩...

}> + +
+
+
); From ff44cb599d4cbbb7084edc35552338aa2493fbce Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Tue, 14 Feb 2023 18:42:00 +0900 Subject: [PATCH 010/131] =?UTF-8?q?chore:=20.env=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=84=B8=EB=B6=84=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 1 + .env.development | 1 + .env.production | 1 + .gitignore | 1 - 4 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .env create mode 100644 .env.development create mode 100644 .env.production diff --git a/.env b/.env new file mode 100644 index 0000000..492d810 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +SERVER_DOMAIN=http://43.201.148.129:8080 \ No newline at end of file diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..823f1c1 --- /dev/null +++ b/.env.development @@ -0,0 +1 @@ +NEXT_PUBLIC_HOST=http://localhost:3000 \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..c426e06 --- /dev/null +++ b/.env.production @@ -0,0 +1 @@ +NEXT_PUBLIC_HOST=http://wealth-marble.kro.kr \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5445f02..e3923e6 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,5 @@ yarn-error.log* *.tsbuildinfo next-env.d.ts -.env # Sentry .sentryclirc From 14cbb3a512acdc84ca5763ca8ec877227364c155 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Tue, 14 Feb 2023 18:45:11 +0900 Subject: [PATCH 011/131] =?UTF-8?q?chore:=20eslint-plugin-react-refresh=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - getServerSideProps와 호환되지 않아 제거 --- .eslintrc.json | 3 +-- package-lock.json | 17 ----------------- package.json | 1 - 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index c7f5cd1..b2420bf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -32,10 +32,9 @@ "version": "detect" } }, - "plugins": ["import", "react", "react-refresh"], + "plugins": ["import", "react"], "rules": { "eol-last": [1, "always"], - "react-refresh/only-export-components": "warn", "import/no-unresolved": "off", "import/order": [ "error", diff --git a/package-lock.json b/package-lock.json index 17fddab..d335e19 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,7 +42,6 @@ "eslint-plugin-import": "^2.27.4", "eslint-plugin-react": "^7.32.0", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.3.2", "postcss": "^8.4.21", "prettier": "^2.8.3", "prettier-plugin-tailwindcss": "^0.2.2", @@ -2505,15 +2504,6 @@ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" } }, - "node_modules/eslint-plugin-react-refresh": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.3.2.tgz", - "integrity": "sha512-FbonmMTOIIskIVbaowKbUYPFdsbIXA1nRbFl/KpXBmKPpg5OjbbF1qXymTu/GAqKsU6Vwkfy7P6ngHNte2XWKw==", - "dev": true, - "peerDependencies": { - "eslint": ">=7" - } - }, "node_modules/eslint-plugin-react/node_modules/doctrine": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", @@ -7634,13 +7624,6 @@ "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", "requires": {} }, - "eslint-plugin-react-refresh": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.3.2.tgz", - "integrity": "sha512-FbonmMTOIIskIVbaowKbUYPFdsbIXA1nRbFl/KpXBmKPpg5OjbbF1qXymTu/GAqKsU6Vwkfy7P6ngHNte2XWKw==", - "dev": true, - "requires": {} - }, "eslint-scope": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", diff --git a/package.json b/package.json index b824861..8ae4833 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,6 @@ "eslint-plugin-import": "^2.27.4", "eslint-plugin-react": "^7.32.0", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-react-refresh": "^0.3.2", "postcss": "^8.4.21", "prettier": "^2.8.3", "prettier-plugin-tailwindcss": "^0.2.2", From 11cb3571c9c98ffe7cc5a8d1f3a3aa2e533fa96a Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Tue, 14 Feb 2023 20:46:13 +0900 Subject: [PATCH 012/131] =?UTF-8?q?feat:=20=EA=B4=80=EC=8B=AC=EA=B0=80?= =?UTF-8?q?=EB=8A=94=20=ED=9C=B4=EC=96=91=EC=A7=80=20mock=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/mock/markets/interests.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/pages/api/mock/markets/interests.ts diff --git a/src/pages/api/mock/markets/interests.ts b/src/pages/api/mock/markets/interests.ts new file mode 100644 index 0000000..9a0ea84 --- /dev/null +++ b/src/pages/api/mock/markets/interests.ts @@ -0,0 +1,22 @@ +import type { Response } from '@/types/response'; + +import type { NextApiRequest, NextApiResponse } from 'next'; + +const MOCK = Array(10) + .fill(undefined) + .map((_, index) => ({ + id: index + 1, + title: '따뜻한 봄바람이 불어오는 하와이 호텔과 게스트하우스', + })); + +const handler = (req: NextApiRequest, res: NextApiResponse>) => { + res.json({ status: 'success', message: null, data: MOCK }); +}; + +export const config = { + api: { + externalResolver: true, + }, +}; + +export default handler; From dc0eed466594f75960bdfe86352eb8a6a952ccd1 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Tue, 14 Feb 2023 20:47:06 +0900 Subject: [PATCH 013/131] =?UTF-8?q?style:=20gradient=20=EC=83=89=EC=83=81?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tailwind.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tailwind.config.js b/tailwind.config.js index 9161388..259d567 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -25,6 +25,10 @@ module.exports = { blue: '#364BB3', 'grey-middle': '#8E949F', }, + gradientColorStops: { + 'blue-start': '#00628B', + 'blue-end': '#017797', + }, extend: {}, }, daisyui: { From 8d4b1ecc5660fde6cbb1a73e92181c54ed6246d9 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Tue, 14 Feb 2023 20:47:23 +0900 Subject: [PATCH 014/131] =?UTF-8?q?style:=20=EA=B4=80=EC=8B=AC=EA=B0=80?= =?UTF-8?q?=EB=8A=94=20=ED=9C=B4=EC=96=91=EC=A7=80=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/market/Interests.tsx | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/components/market/Interests.tsx diff --git a/src/components/market/Interests.tsx b/src/components/market/Interests.tsx new file mode 100644 index 0000000..07c7f60 --- /dev/null +++ b/src/components/market/Interests.tsx @@ -0,0 +1,48 @@ +import Link from 'next/link'; + +import { useSuspendedQuery } from '@/hooks/useSuspendedQuery'; +import { Response } from '@/types/response'; + +import Carousel from '../common/Carousel'; +import Icon from '../common/Icons'; + +const Interests = () => { + const { + data: { data: interests }, + } = useSuspendedQuery>(['market/interests'], () => + fetch(`${process.env.NEXT_PUBLIC_HOST}/api/mock/markets/interests`).then((res) => res.json()) + ); + + const onBookmarkClick: React.MouseEventHandler = (e) => { + e.preventDefault(); + }; + + return ( +
+ + + {interests.map(({ id, title }) => ( + +
+ {title} +
+ +
+
+ + ))} +
+
+ ); +}; + +export default Interests; From f2238f30b6565ae88e95ebcc4f42abb37d7649e4 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Tue, 14 Feb 2023 20:47:46 +0900 Subject: [PATCH 015/131] =?UTF-8?q?feat:=20=EB=A7=88=EC=BC=93=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20=ED=8E=98=EC=9D=B4=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/markets/index.tsx | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/pages/markets/index.tsx diff --git a/src/pages/markets/index.tsx b/src/pages/markets/index.tsx new file mode 100644 index 0000000..a1cf738 --- /dev/null +++ b/src/pages/markets/index.tsx @@ -0,0 +1,32 @@ +import { Suspense } from 'react'; + +import DeadlineBanner from '@/components/cahoot/DeadlineBanner'; +import Layout from '@/components/common/Layout'; +import Interests from '@/components/market/Interests'; +import { ErrorBoundary } from '@sentry/nextjs'; + +const Markets = () => { + return ( + +
+ ( + <> +

{error.message}

+ + + )} + > + 로딩...

}> + +
+ 로딩...

}> + +
+
+
+
+ ); +}; + +export default Markets; From 2dd3bd04700c87f76488583a45f526bae1a6ffdd Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Tue, 14 Feb 2023 21:00:18 +0900 Subject: [PATCH 016/131] =?UTF-8?q?feat:=20=EA=B4=80=EC=8B=AC=EA=B0=80?= =?UTF-8?q?=EB=8A=94=20=ED=9C=B4=EC=96=91=EC=A7=80=20=EC=A1=B0=EA=B1=B4?= =?UTF-8?q?=EB=B6=80=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 존재하는 경우에만 렌더링 --- src/components/market/Interests.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/market/Interests.tsx b/src/components/market/Interests.tsx index 07c7f60..ad87546 100644 --- a/src/components/market/Interests.tsx +++ b/src/components/market/Interests.tsx @@ -17,7 +17,7 @@ const Interests = () => { e.preventDefault(); }; - return ( + return interests.length ? (
@@ -42,7 +42,7 @@ const Interests = () => { ))}
- ); + ) : null; }; export default Interests; From 96b994772beb66c011b534bf12c2c445fff2ebea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Wed, 15 Feb 2023 23:33:27 +0900 Subject: [PATCH 017/131] =?UTF-8?q?refactor:=20SelectBox=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/SelectBox.tsx | 53 +++++++++++++++-------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/src/components/common/SelectBox.tsx b/src/components/common/SelectBox.tsx index c2dce5a..cc96794 100644 --- a/src/components/common/SelectBox.tsx +++ b/src/components/common/SelectBox.tsx @@ -3,28 +3,31 @@ import { createPortal } from 'react-dom'; import Icon from './Icons'; +interface SelectItem { + index: number; + item: string; +} + interface PropsType { - placeholder: string; + items: SelectItem[]; containerRef: React.RefObject; + currentItem: string; + changeItem: (item: string) => void; } -const SelectBox = ({ placeholder, containerRef }: PropsType) => { +const SelectBox = ({ items, containerRef, currentItem, changeItem }: PropsType) => { const [isOpen, setIsOpen] = useState(false); - const [selectedValue, setSelectedValue] = useState(placeholder); - const handleClick = (e: MouseEvent) => { + const onClickToggle = (e: MouseEvent) => { e.stopPropagation(); setIsOpen(!isOpen); }; - const selectValue = (e: MouseEvent) => { - const eventTarget = e.target as HTMLElement; - - console.log('click value'); + const onClickItem = (item: string) => { setIsOpen(false); - setSelectedValue(eventTarget.innerText); + changeItem(item); }; - const handleBlur = () => { + const onBlur = () => { setTimeout(() => { setIsOpen(false); }, 100); @@ -33,12 +36,12 @@ const SelectBox = ({ placeholder, containerRef }: PropsType) => { return (
- {selectedValue} + {currentItem} {isOpen && } {!isOpen && } @@ -52,18 +55,16 @@ const SelectBox = ({ placeholder, containerRef }: PropsType) => { } absolute top-20 mt-6 w-24 rounded-lg border border-grey bg-white`} >
    -
  • - 대만 -
  • -
  • - 일본 -
  • + {items.map(({ index, item }) => ( + // TODO: 말줄임표 추가하기 +
  • onClickItem(item)} + className="cursor-pointer select-none rounded-lg p-2 hover:bg-main/50" + > + {item} +
  • + ))}
, containerRef.current From 7c63421b467de658f5a47c64a25e42960c4bf1b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Thu, 16 Feb 2023 09:28:34 +0900 Subject: [PATCH 018/131] =?UTF-8?q?feat:=20ButtonGroup=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/ButtonGroup.tsx | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/components/common/ButtonGroup.tsx diff --git a/src/components/common/ButtonGroup.tsx b/src/components/common/ButtonGroup.tsx new file mode 100644 index 0000000..af4e8ba --- /dev/null +++ b/src/components/common/ButtonGroup.tsx @@ -0,0 +1,34 @@ +import classNames from '@/utils/classnames'; + +interface PropsType { + items: readonly string[]; + currentItem: string; + changeItem: (item: string) => void; +} + +const ButtonGroup = ({ items, currentItem, changeItem }: PropsType) => { + const onClickButton = (item: string) => { + changeItem(item); + }; + + return ( +
+ {items.map((item, index) => ( + + ))} +
+ ); +}; + +export default ButtonGroup; From 8bb27b6f7aeb5db809855a99f3f988a75b4eb0ab Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Thu, 16 Feb 2023 20:49:35 +0900 Subject: [PATCH 019/131] =?UTF-8?q?style:=20PlusCircle=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=EC=BD=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Icons.tsx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/common/Icons.tsx b/src/components/common/Icons.tsx index b88bd07..0aabc36 100644 --- a/src/components/common/Icons.tsx +++ b/src/components/common/Icons.tsx @@ -138,7 +138,7 @@ const Up = () => ( viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="w-6 h-6" + className="h-6 w-6" > @@ -151,7 +151,7 @@ const Down = () => ( viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="w-6 h-6" + className="h-6 w-6" > @@ -252,6 +252,24 @@ const Plus = () => ( ); +const PlusCircle = () => ( + +); + const Icon = { Home, Gavel, @@ -269,6 +287,7 @@ const Icon = { XMark, Minus, Plus, + PlusCircle, }; export default Icon; From a216eb4915135278cb873ebec0e031fb6231715e Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Thu, 16 Feb 2023 21:01:13 +0900 Subject: [PATCH 020/131] =?UTF-8?q?style:=20=EA=B4=80=EC=8B=AC=EA=B0=80?= =?UTF-8?q?=EB=8A=94=20=ED=9C=B4=EC=96=91=EC=A7=80=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/market/Interests.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/market/Interests.tsx b/src/components/market/Interests.tsx index ad87546..31d982d 100644 --- a/src/components/market/Interests.tsx +++ b/src/components/market/Interests.tsx @@ -17,17 +17,21 @@ const Interests = () => { e.preventDefault(); }; - return interests.length ? ( + return (
+ {interests.map(({ id, title }) => ( -
+
{title}
- ) : null; + ); }; export default Interests; From 7c6761a007788c2ad9e86309ba2b26b2fafc53f9 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Thu, 16 Feb 2023 22:14:06 +0900 Subject: [PATCH 021/131] =?UTF-8?q?fix:=20=EB=A7=88=EC=BC=93=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20SSR=20=EC=9E=84=EC=8B=9C=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/markets/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/pages/markets/index.tsx b/src/pages/markets/index.tsx index a1cf738..682fd06 100644 --- a/src/pages/markets/index.tsx +++ b/src/pages/markets/index.tsx @@ -5,6 +5,8 @@ import Layout from '@/components/common/Layout'; import Interests from '@/components/market/Interests'; import { ErrorBoundary } from '@sentry/nextjs'; +import type { GetServerSideProps } from 'next'; + const Markets = () => { return ( @@ -29,4 +31,10 @@ const Markets = () => { ); }; +export const getServerSideProps: GetServerSideProps = async () => { + return { + props: {}, + }; +}; + export default Markets; From df5af9142a07c0a4f87dbab3f349a8a9c2e0a8bd Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Fri, 17 Feb 2023 01:48:54 +0900 Subject: [PATCH 022/131] =?UTF-8?q?refactor:=20dateFormat=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=EB=AA=85=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - formatDate로 변경 - dateFormat -> date 파일명 변경 --- src/components/cahoot/DetailInfo.tsx | 6 +++--- src/components/cahoot/ListItems.tsx | 4 ++-- src/components/cahoot/Recap.tsx | 4 ++-- src/utils/{dateFormat.ts => date.ts} | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) rename src/utils/{dateFormat.ts => date.ts} (64%) diff --git a/src/components/cahoot/DetailInfo.tsx b/src/components/cahoot/DetailInfo.tsx index c94c3de..793c282 100644 --- a/src/components/cahoot/DetailInfo.tsx +++ b/src/components/cahoot/DetailInfo.tsx @@ -5,7 +5,7 @@ import { useSuspendedQuery } from '@/hooks/useSuspendedQuery'; import { fetcher } from '@/libs/client/fetcher'; import type { CahootDetailType } from '@/types/cahoot'; import type { Response } from '@/types/response'; -import dateFormat from '@/utils/dateFormat'; +import { formatDate } from '@/utils/date'; import Carousel from '../common/Carousel'; @@ -63,9 +63,9 @@ const DetailInfo = () => {
공모 기간 - {dateFormat(stockStart ?? '')} + {formatDate(stockStart ?? '')} ~ - {dateFormat(stockEnd ?? '')} + {formatDate(stockEnd ?? '')}
diff --git a/src/components/cahoot/ListItems.tsx b/src/components/cahoot/ListItems.tsx index 110a4de..ae1c9fc 100644 --- a/src/components/cahoot/ListItems.tsx +++ b/src/components/cahoot/ListItems.tsx @@ -7,7 +7,7 @@ import { fetcher } from '@/libs/client/fetcher'; import type { CahootListType } from '@/types/cahoot'; import type { Response } from '@/types/response'; import classNames from '@/utils/classnames'; -import dateFormat from '@/utils/dateFormat'; +import { formatDate } from '@/utils/date'; import { useInfiniteQuery } from '@tanstack/react-query'; import Icon from '../common/Icons'; @@ -110,7 +110,7 @@ const ListItems = ({ keyword }: ListItemsProps) => {
공모 마감일 - {dateFormat(stockEnd)} + {formatDate(stockEnd)} 마감
diff --git a/src/components/cahoot/Recap.tsx b/src/components/cahoot/Recap.tsx index 7e76dc8..de67c4b 100644 --- a/src/components/cahoot/Recap.tsx +++ b/src/components/cahoot/Recap.tsx @@ -4,7 +4,7 @@ import Link from 'next/link'; import { useSuspendedQuery } from '@/hooks/useSuspendedQuery'; import type { CahootListType } from '@/types/cahoot'; import type { Response } from '@/types/response'; -import dateFormat from '@/utils/dateFormat'; +import { formatDate } from '@/utils/date'; import Carousel from '../common/Carousel'; @@ -35,7 +35,7 @@ const Recap = () => { {title} - {dateFormat(stockEnd)} + {formatDate(stockEnd)}
diff --git a/src/utils/dateFormat.ts b/src/utils/date.ts similarity index 64% rename from src/utils/dateFormat.ts rename to src/utils/date.ts index bd0be3f..4210058 100644 --- a/src/utils/dateFormat.ts +++ b/src/utils/date.ts @@ -1,6 +1,5 @@ -const dateFormat = (date: string) => +export const formatDate = (date: string) => Intl.DateTimeFormat('ko-KR', { dateStyle: 'short' }) .format(new Date(date || 0)) .replace(/\s|\.$/g, ''); -export default dateFormat; From af232d1fb97aeaf423bfce681d55ed2ac1c3b30d Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Fri, 17 Feb 2023 01:49:17 +0900 Subject: [PATCH 023/131] =?UTF-8?q?feat:=20formatTime=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/date.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils/date.ts b/src/utils/date.ts index 4210058..239551c 100644 --- a/src/utils/date.ts +++ b/src/utils/date.ts @@ -3,3 +3,10 @@ export const formatDate = (date: string) => .format(new Date(date || 0)) .replace(/\s|\.$/g, ''); +export const formatTime = (date: string) => + Intl.DateTimeFormat('ko-KR', { + hour: '2-digit', + minute: '2-digit', + second: '2-digit', + hour12: false, + }).format(new Date(date || 0)); From 9518f1b08de79399aa234826fedbd66ae1898a40 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Fri, 17 Feb 2023 01:49:52 +0900 Subject: [PATCH 024/131] =?UTF-8?q?feat:=20=EC=B5=9C=EA=B7=BC=20=EA=B1=B0?= =?UTF-8?q?=EB=9E=98=20=ED=9C=B4=EC=96=91=EC=A7=80=20mock=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/mock/markets/recents.ts | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/pages/api/mock/markets/recents.ts diff --git a/src/pages/api/mock/markets/recents.ts b/src/pages/api/mock/markets/recents.ts new file mode 100644 index 0000000..e98165e --- /dev/null +++ b/src/pages/api/mock/markets/recents.ts @@ -0,0 +1,30 @@ +import type { Response } from '@/types/response'; + +import type { NextApiRequest, NextApiResponse } from 'next'; + +const MOCK = Array(6) + .fill(undefined) + .map((_, index) => ({ + id: index + 1, + title: '따뜻한 봄바람이 불어오는 하와이 호텔과 게스트하우스', + price: 12400, + volume: 1235, + images: [ + 'https://wealth-marble-image.s3.ap-northeast-2.amazonaws.com/icon-yellow%20flower.png', + ], + time: '2023-01-20T23:15:53.026633', + diff: 1000 * (Math.random() < 0.5 ? 1 : -2), + amount: 1, + })); + +const handler = (req: NextApiRequest, res: NextApiResponse>) => { + res.json({ status: 'success', message: null, data: MOCK }); +}; + +export const config = { + api: { + externalResolver: true, + }, +}; + +export default handler; From efbd0170e08684e852a1d7d0ab1f7dc43fdfed86 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Fri, 17 Feb 2023 01:50:37 +0900 Subject: [PATCH 025/131] =?UTF-8?q?style:=20=EC=B5=9C=EA=B7=BC=20=EA=B1=B0?= =?UTF-8?q?=EB=9E=98=20=ED=9C=B4=EC=96=91=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/market/RecentTrade.tsx | 65 +++++++++++++++++++++++++++ src/pages/markets/index.tsx | 11 +++++ tailwind.config.js | 6 ++- 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/components/market/RecentTrade.tsx diff --git a/src/components/market/RecentTrade.tsx b/src/components/market/RecentTrade.tsx new file mode 100644 index 0000000..1a7072c --- /dev/null +++ b/src/components/market/RecentTrade.tsx @@ -0,0 +1,65 @@ +import Image from 'next/image'; +import Link from 'next/link'; + +import { useSuspendedQuery } from '@/hooks/useSuspendedQuery'; +import { Response } from '@/types/response'; +import { formatTime } from '@/utils/date'; + +type MockType = { + id: number; + title: string; + price: number; + volume: number; + images: string[]; + time: string; + diff: number; + amount: number; +}[]; + +const RecentTrade = () => { + const { + data: { data: recents }, + } = useSuspendedQuery>(['market/recents'], () => + fetch(`${process.env.NEXT_PUBLIC_HOST}/api/mock/markets/recents`).then((res) => res.json()) + ); + + return ( +
+ +
+ {recents.slice(0, 6).map(({ id, amount, diff, images, price, time, title, volume }) => ( + +
+
+
+ +
+ {formatTime(time)} +
+
+
+ {title} +
+
+ {price.toLocaleString()} + {`${ + diff < 0 ? '▼' : '▲' + } ${diff.toLocaleString()}(${Math.round((diff / price) * 100)}%)`} +
+
+ {amount}주 + {`${volume.toLocaleString()}(%)`} +
+
+ + ))} +
+
+ ); +}; + +export default RecentTrade; diff --git a/src/pages/markets/index.tsx b/src/pages/markets/index.tsx index 682fd06..7326b8e 100644 --- a/src/pages/markets/index.tsx +++ b/src/pages/markets/index.tsx @@ -3,6 +3,7 @@ import { Suspense } from 'react'; import DeadlineBanner from '@/components/cahoot/DeadlineBanner'; import Layout from '@/components/common/Layout'; import Interests from '@/components/market/Interests'; +import RecentTrade from '@/components/market/RecentTrade'; import { ErrorBoundary } from '@sentry/nextjs'; import type { GetServerSideProps } from 'next'; @@ -25,6 +26,16 @@ const Markets = () => { 로딩...

}>
+
+
+ +
+
+ 로딩...

}> + +
+
+
diff --git a/tailwind.config.js b/tailwind.config.js index 259d567..5df1bb3 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -29,7 +29,11 @@ module.exports = { 'blue-start': '#00628B', 'blue-end': '#017797', }, - extend: {}, + extend: { + padding: { + 18: '4.5rem', + }, + }, }, daisyui: { themes: [ From a440f01c85282db0545f3e9ea77bf3d1a2ff85fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Fri, 17 Feb 2023 23:31:16 +0900 Subject: [PATCH 026/131] =?UTF-8?q?style:=20SelectBox=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=EC=8A=A4=ED=83=80=EC=9D=BC=EB=A7=81=20-?= =?UTF-8?q?=20=EB=A7=90=EC=A4=84=EC=9E=84=ED=91=9C=20=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?-=20=EC=A0=84=EB=B0=98=EC=A0=81=EC=9D=B8=20=EC=8A=A4=ED=83=80?= =?UTF-8?q?=EC=9D=BC=20=EA=B0=9C=EC=84=A0(=EA=B8=80=EC=94=A8=ED=81=AC?= =?UTF-8?q?=EA=B8=B0=20=EC=B6=95=EC=86=8C,=20=EC=95=84=EC=9D=B4=EC=BD=98?= =?UTF-8?q?=20=ED=81=AC=EA=B8=B0=20=EC=B6=95=EC=86=8C=20=EB=93=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Icons.tsx | 4 ++-- src/components/common/SelectBox.tsx | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/common/Icons.tsx b/src/components/common/Icons.tsx index b88bd07..85236d4 100644 --- a/src/components/common/Icons.tsx +++ b/src/components/common/Icons.tsx @@ -138,7 +138,7 @@ const Up = () => ( viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="w-6 h-6" + className="h-4 w-4" > @@ -151,7 +151,7 @@ const Down = () => ( viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="w-6 h-6" + className="h-3 w-3" > diff --git a/src/components/common/SelectBox.tsx b/src/components/common/SelectBox.tsx index cc96794..a5ef055 100644 --- a/src/components/common/SelectBox.tsx +++ b/src/components/common/SelectBox.tsx @@ -34,14 +34,14 @@ const SelectBox = ({ items, containerRef, currentItem, changeItem }: PropsType) }; return ( -
+
- {currentItem} + {currentItem} {isOpen && } {!isOpen && } @@ -52,15 +52,14 @@ const SelectBox = ({ items, containerRef, currentItem, changeItem }: PropsType)
    {items.map(({ index, item }) => ( - // TODO: 말줄임표 추가하기
  • onClickItem(item)} - className="cursor-pointer select-none rounded-lg p-2 hover:bg-main/50" + className="cursor-pointer select-none truncate rounded-lg p-2 text-[10px] hover:bg-main/50" > {item}
  • From b9db64468352b415c1f0ba0b7458ba81f0629136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Fri, 17 Feb 2023 23:35:05 +0900 Subject: [PATCH 027/131] =?UTF-8?q?feat:=20SelectBox,=20ButtonGroup=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20title=20=EC=86=8D?= =?UTF-8?q?=EC=84=B1=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/ButtonGroup.tsx | 3 ++- src/components/common/SelectBox.tsx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/common/ButtonGroup.tsx b/src/components/common/ButtonGroup.tsx index af4e8ba..e0c8b4f 100644 --- a/src/components/common/ButtonGroup.tsx +++ b/src/components/common/ButtonGroup.tsx @@ -12,10 +12,11 @@ const ButtonGroup = ({ items, currentItem, changeItem }: PropsType) => { }; return ( -
    +
    {items.map((item, index) => (
    -
    -
    - Hot - {title} +
    +
    + Hot + {title}
    -
    +
    - + 예상 수익률 120%
    From 7bf318a5bd48ed04f64b8cd434d8bf210e85e7cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Sat, 18 Feb 2023 11:58:17 +0900 Subject: [PATCH 029/131] =?UTF-8?q?chore:=20=ED=86=A0=EA=B8=80=20=EC=95=84?= =?UTF-8?q?=EC=9D=B4=EC=BD=98=20=ED=81=AC=EA=B8=B0=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Icons.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/common/Icons.tsx b/src/components/common/Icons.tsx index 85236d4..5c2627d 100644 --- a/src/components/common/Icons.tsx +++ b/src/components/common/Icons.tsx @@ -138,7 +138,7 @@ const Up = () => ( viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" - className="h-4 w-4" + className="h-3 w-3" > From a6f9be37daa5b5a61af0a261f0924b50146bca8a Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Sun, 19 Feb 2023 00:26:35 +0900 Subject: [PATCH 030/131] =?UTF-8?q?feat:=20=EB=A7=88=EC=BC=93=20=EB=AA=A9?= =?UTF-8?q?=EB=A1=9D=20mock=20api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/mock/markets/index.ts | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/pages/api/mock/markets/index.ts diff --git a/src/pages/api/mock/markets/index.ts b/src/pages/api/mock/markets/index.ts new file mode 100644 index 0000000..0fbc446 --- /dev/null +++ b/src/pages/api/mock/markets/index.ts @@ -0,0 +1,60 @@ +import type { Response } from '@/types/response'; + +import type { NextApiRequest, NextApiResponse } from 'next'; + +const MOCK = Array(40) + .fill(undefined) + .map((_, index) => ({ + id: index + 1, + title: '따뜻한 봄바람이 불어오는 하와이 호텔 건설에 함께하실 마블 분들을 찾아요', + location: '대한민국', + price: 12400, + diff: 1000 * (Math.random() < 0.5 ? 1 : -2), + images: ['https://wealth-marble-image.s3.ap-northeast-2.amazonaws.com/icon-cup.png'], + })); + +const handler = (req: NextApiRequest, res: NextApiResponse>) => { + const { page } = req.query; + if (page === '0') { + return res.json({ + status: 'success', + message: null, + data: { + result: MOCK.slice(0, 10), + }, + }); + } else if (page === '1') { + return res.json({ + status: 'success', + message: null, + data: { + result: MOCK.slice(10, 20), + }, + }); + } else if (page === '2') { + return res.json({ + status: 'success', + message: null, + data: { + result: MOCK.slice(20, 30), + }, + }); + } else if (page === '3') { + return res.json({ + status: 'success', + message: null, + data: { + result: MOCK.slice(30, 40), + }, + }); + } + res.status(404).json({ status: 'fail', message: 'No data', data: { result: [] } }); +}; + +export const config = { + api: { + externalResolver: true, + }, +}; + +export default handler; From fd56ebccf1f649bb830d595677d51e28949e45ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Sun, 19 Feb 2023 01:35:06 +0900 Subject: [PATCH 031/131] =?UTF-8?q?chore:=20react-google-autocomplete=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 89 ++++++++++++++++++++++++++++++++++------------- package.json | 1 + 2 files changed, 65 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index d335e19..3ff58bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "react": "18.2.0", "react-dates": "^21.8.0", "react-dom": "18.2.0", + "react-google-autocomplete": "^2.7.3", "react-hook-form": "^7.42.1", "react-redux": "^8.0.5", "sharp": "^0.31.3", @@ -1377,6 +1378,7 @@ "version": "10.4.13", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.13.tgz", "integrity": "sha512-49vKpMqcZYsJjwotvt4+h/BCjJVnhGwcLpDt5xkcaOG3eLrG/HUYLagrihYsQ+qrIBgIzX1Rw7a6L8I/ZA1Atg==", + "dev": true, "funding": [ { "type": "opencollective", @@ -1516,6 +1518,7 @@ "version": "4.21.4", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", + "dev": true, "funding": [ { "type": "opencollective", @@ -2026,7 +2029,8 @@ "node_modules/electron-to-chromium": { "version": "1.4.284", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", - "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==" + "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==", + "dev": true }, "node_modules/emoji-regex": { "version": "9.2.2", @@ -2171,6 +2175,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, "engines": { "node": ">=6" } @@ -2771,6 +2776,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "dev": true, "engines": { "node": "*" }, @@ -3713,6 +3719,11 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -3983,7 +3994,8 @@ "node_modules/node-releases": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.8.tgz", - "integrity": "sha512-dFSmB8fFHEH/s81Xi+Y/15DQY6VHW81nXRj86EMSL3lmuTmK1e+aT4wrFCkTbm+gSwkw4KpX+rT/pMM2c1mF+A==" + "integrity": "sha512-dFSmB8fFHEH/s81Xi+Y/15DQY6VHW81nXRj86EMSL3lmuTmK1e+aT4wrFCkTbm+gSwkw4KpX+rT/pMM2c1mF+A==", + "dev": true }, "node_modules/normalize-path": { "version": "3.0.0", @@ -3997,6 +4009,7 @@ "version": "0.1.2", "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -4699,6 +4712,18 @@ "react": "^18.2.0" } }, + "node_modules/react-google-autocomplete": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/react-google-autocomplete/-/react-google-autocomplete-2.7.3.tgz", + "integrity": "sha512-Nm+7/VDe7/NDWb8p/a39is7ktNqt5bNqAOoQv2Ev/XkuEvjsRk08VAPFmXUH03xKuM8IUuDrk2Lwfge44YEj6Q==", + "dependencies": { + "lodash.debounce": "^4.0.8", + "prop-types": "^15.5.0" + }, + "peerDependencies": { + "react": ">=16.8.0" + } + }, "node_modules/react-hook-form": { "version": "7.42.1", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.42.1.tgz", @@ -5708,6 +5733,7 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "dev": true, "funding": [ { "type": "opencollective", @@ -6128,8 +6154,7 @@ "@rollup/plugin-virtual": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-virtual/-/plugin-virtual-3.0.0.tgz", - "integrity": "sha512-K9KORe1myM62o0lKkNR4MmCxjwuAXsZEtIHpaILfv4kILXTOrXt/R2ha7PzMcCHPYdnkWPiBZK8ed4Zr3Ll5lQ==", - "requires": {} + "integrity": "sha512-K9KORe1myM62o0lKkNR4MmCxjwuAXsZEtIHpaILfv4kILXTOrXt/R2ha7PzMcCHPYdnkWPiBZK8ed4Zr3Ll5lQ==" }, "@rollup/pluginutils": { "version": "4.2.1", @@ -6604,8 +6629,7 @@ "acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", - "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "requires": {} + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==" }, "acorn-node": { "version": "1.8.2", @@ -6794,6 +6818,7 @@ "version": "10.4.13", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.13.tgz", "integrity": "sha512-49vKpMqcZYsJjwotvt4+h/BCjJVnhGwcLpDt5xkcaOG3eLrG/HUYLagrihYsQ+qrIBgIzX1Rw7a6L8I/ZA1Atg==", + "dev": true, "requires": { "browserslist": "^4.21.4", "caniuse-lite": "^1.0.30001426", @@ -6884,6 +6909,7 @@ "version": "4.21.4", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.4.tgz", "integrity": "sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==", + "dev": true, "requires": { "caniuse-lite": "^1.0.30001400", "electron-to-chromium": "^1.4.251", @@ -7229,7 +7255,8 @@ "electron-to-chromium": { "version": "1.4.284", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.284.tgz", - "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==" + "integrity": "sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==", + "dev": true }, "emoji-regex": { "version": "9.2.2", @@ -7349,7 +7376,8 @@ "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==" + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true }, "escape-string-regexp": { "version": "4.0.0", @@ -7422,8 +7450,7 @@ "version": "8.6.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz", "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==", - "dev": true, - "requires": {} + "dev": true }, "eslint-import-resolver-node": { "version": "0.3.7", @@ -7621,8 +7648,7 @@ "eslint-plugin-react-hooks": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", - "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==", - "requires": {} + "integrity": "sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==" }, "eslint-scope": { "version": "7.1.1", @@ -7799,7 +7825,8 @@ "fraction.js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", - "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==" + "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "dev": true }, "fs-constants": { "version": "1.0.0", @@ -8456,6 +8483,11 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==" + }, "lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -8608,8 +8640,7 @@ "next-redux-wrapper": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/next-redux-wrapper/-/next-redux-wrapper-8.1.0.tgz", - "integrity": "sha512-2hIau0hcI6uQszOtrvAFqgc0NkZegKYhBB7ZAKiG3jk7zfuQb4E7OV9jfxViqqojh3SEHdnFfPkN9KErttUKuw==", - "requires": {} + "integrity": "sha512-2hIau0hcI6uQszOtrvAFqgc0NkZegKYhBB7ZAKiG3jk7zfuQb4E7OV9jfxViqqojh3SEHdnFfPkN9KErttUKuw==" }, "node-abi": { "version": "3.32.0", @@ -8635,7 +8666,8 @@ "node-releases": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.8.tgz", - "integrity": "sha512-dFSmB8fFHEH/s81Xi+Y/15DQY6VHW81nXRj86EMSL3lmuTmK1e+aT4wrFCkTbm+gSwkw4KpX+rT/pMM2c1mF+A==" + "integrity": "sha512-dFSmB8fFHEH/s81Xi+Y/15DQY6VHW81nXRj86EMSL3lmuTmK1e+aT4wrFCkTbm+gSwkw4KpX+rT/pMM2c1mF+A==", + "dev": true }, "normalize-path": { "version": "3.0.0", @@ -8645,7 +8677,8 @@ "normalize-range": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz", - "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==" + "integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA==", + "dev": true }, "npmlog": { "version": "4.1.2", @@ -8940,8 +8973,7 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.2.2.tgz", "integrity": "sha512-5RjUbWRe305pUpc48MosoIp6uxZvZxrM6GyOgsbGLTce+ehePKNm7ziW2dLG2air9aXbGuXlHVSQQw4Lbosq3w==", - "dev": true, - "requires": {} + "dev": true }, "process-nextick-args": { "version": "2.0.1", @@ -9067,11 +9099,19 @@ "scheduler": "^0.23.0" } }, + "react-google-autocomplete": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/react-google-autocomplete/-/react-google-autocomplete-2.7.3.tgz", + "integrity": "sha512-Nm+7/VDe7/NDWb8p/a39is7ktNqt5bNqAOoQv2Ev/XkuEvjsRk08VAPFmXUH03xKuM8IUuDrk2Lwfge44YEj6Q==", + "requires": { + "lodash.debounce": "^4.0.8", + "prop-types": "^15.5.0" + } + }, "react-hook-form": { "version": "7.42.1", "resolved": "https://registry.npmjs.org/react-hook-form/-/react-hook-form-7.42.1.tgz", - "integrity": "sha512-2UIGqwMZksd5HS55crTT1ATLTr0rAI4jS7yVuqTaoRVDhY2Qc4IyjskCmpnmdYqUNOYFy04vW253tb2JRVh+IQ==", - "requires": {} + "integrity": "sha512-2UIGqwMZksd5HS55crTT1ATLTr0rAI4jS7yVuqTaoRVDhY2Qc4IyjskCmpnmdYqUNOYFy04vW253tb2JRVh+IQ==" }, "react-is": { "version": "16.13.1", @@ -9219,8 +9259,7 @@ "redux-thunk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-2.4.2.tgz", - "integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q==", - "requires": {} + "integrity": "sha512-+P3TjtnP0k/FEjcBL5FZpoovtvrTNT/UXd4/sluaSyrURlSlhLSzEdfsTBW7WsKB6yPvgd7q/iZPICFjW4o57Q==" }, "reflect.ownkeys": { "version": "0.2.0", @@ -9781,6 +9820,7 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.10.tgz", "integrity": "sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==", + "dev": true, "requires": { "escalade": "^3.1.1", "picocolors": "^1.0.0" @@ -9797,8 +9837,7 @@ "use-sync-external-store": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz", - "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", - "requires": {} + "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==" }, "util-deprecate": { "version": "1.0.2", diff --git a/package.json b/package.json index 8ae4833..4580f32 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "react": "18.2.0", "react-dates": "^21.8.0", "react-dom": "18.2.0", + "react-google-autocomplete": "^2.7.3", "react-hook-form": "^7.42.1", "react-redux": "^8.0.5", "sharp": "^0.31.3", From c2cd167b8d95c7618e9a21964dac02afaa832f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Sun, 19 Feb 2023 01:37:16 +0900 Subject: [PATCH 032/131] =?UTF-8?q?feat:=20=EC=A3=BC=EC=86=8C=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EA=B4=80=EB=A0=A8=20=EC=B2=98=EB=A6=AC=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=20-=20=EC=82=AC=EC=9A=A9=EC=9E=90=EA=B0=80=20?= =?UTF-8?q?=EC=A7=81=EC=A0=91=20=EC=A3=BC=EC=86=8C=20=EC=9E=85=EB=A0=A5=20?= =?UTF-8?q?=EC=8B=9C,=20=ED=95=B4=EB=8B=B9=20=EA=B0=92=EC=9C=BC=EB=A1=9C?= =?UTF-8?q?=20=EC=A3=BC=EC=86=8C=20=EC=A0=81=EC=9A=A9=20-=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=EC=99=84=EC=84=B1=EC=9D=84=20=ED=86=B5=ED=95=B4=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=20=EC=84=A0=ED=83=9D=20=EC=8B=9C,=20?= =?UTF-8?q?=EB=82=98=EB=9D=BC=EB=AA=85,=20=EC=9A=B0=ED=8E=B8=EB=B2=88?= =?UTF-8?q?=ED=98=B8=EB=A5=BC=20=EC=A0=9C=EC=99=B8=ED=95=9C=20=EC=A3=BC?= =?UTF-8?q?=EC=86=8C=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20=ED=9B=84=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PlaceSearchBar.tsx | 62 +++++++++++++++++++++---------- src/pages/cahoots/create.tsx | 24 ++++++------ 2 files changed, 55 insertions(+), 31 deletions(-) diff --git a/src/components/PlaceSearchBar.tsx b/src/components/PlaceSearchBar.tsx index 31c9c09..a6bf3a9 100644 --- a/src/components/PlaceSearchBar.tsx +++ b/src/components/PlaceSearchBar.tsx @@ -1,32 +1,56 @@ import { useRef } from 'react'; -import { UseFormRegisterReturn } from 'react-hook-form'; +import Autocomplete from 'react-google-autocomplete'; +import { UseFormSetValue } from 'react-hook-form'; import { LoadScript, StandaloneSearchBox } from '@react-google-maps/api'; interface PropsType { - register?: UseFormRegisterReturn; + name: string; + setValue: UseFormSetValue; } -const PlaceSearchBar = ({ register }: PropsType) => { - const searchRef = useRef(null); +const PlaceSearchBar = ({ name, setValue }: PropsType) => { + const inputRef = useRef(null); - const onPlacesChanged = () => { - const searchText = searchRef.current?.value; - // console.log(searchText); - // TODO: 모달 + 지도 연동 + // 자동완성 목록에서 주소 선택 시 나라명, 우편번호를 제외한 주소 생성 + const summarizeAddress = (addressComponents: google.maps.GeocoderAddressComponent[]) => { + let address = ''; + + addressComponents + .filter((item) => !item.types.includes('country') && !item.types.includes('postal_code')) + .reverse() + .map((item) => (address += `${item.long_name} `)); + + setValue(name, address.trim()); + }; + + // 사용자 입력 주소 form value 세팅 + const onInput = () => { + const inputText = inputRef.current?.value; + if (!inputText) { + return; + } + setValue(name, inputText.trim()); }; return ( - - - - - + { + const addressComponents = place?.address_components; + if (!addressComponents) { + return; + } + summarizeAddress(addressComponents); + }} + onChange={onInput} + options={{ + types: ['(regions)'], + componentRestrictions: { country: 'kr' }, + fields: ['address_components'], + }} + className="w-96 rounded-lg border border-solid border-black/20 p-3 focus:outline-main" + /> ); }; diff --git a/src/pages/cahoots/create.tsx b/src/pages/cahoots/create.tsx index 52980d2..50ed567 100644 --- a/src/pages/cahoots/create.tsx +++ b/src/pages/cahoots/create.tsx @@ -53,13 +53,13 @@ export default function CreateCahoot() { return ( -
    +

    공모 생성

    공모를 위한 휴양지 건설 계획서를 상세하게 작성해주세요.

    -
    +
    {/* 휴양지명 */} @@ -92,14 +92,14 @@ export default function CreateCahoot() { {/* 휴양지 테마 */}
    -

    위치

    +

    위치

    -

    건물 유형

    +

    건물 유형

    {/* TODO: Loading 일 때 처리 */} - + {/* */}
    {/* 건설 진행 예상 시간 */} -
    +
    공모 완료 후 month @@ -147,7 +147,7 @@ export default function CreateCahoot() { {/* 전체 건설 지출 예상 금액 */} -
    +
    만원
    @@ -156,15 +156,15 @@ export default function CreateCahoot() {
    -

    1주 별 가격

    -
    +

    1주 별 가격

    +
    -

    발행 주식 수

    -
    +

    발행 주식 수

    +
    @@ -173,7 +173,7 @@ export default function CreateCahoot() { From 1a1cd046e629307f3cf35dafd29335768155bccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Sun, 19 Feb 2023 01:40:01 +0900 Subject: [PATCH 033/131] =?UTF-8?q?chore:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=AA=A8=EB=93=88=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 137 ------------------------------ package.json | 1 - src/components/PlaceSearchBar.tsx | 2 - 3 files changed, 140 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3ff58bd..70fbaec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "dependencies": { "@next/eslint-plugin-next": "^13.1.2", "@next/font": "13.1.2", - "@react-google-maps/api": "^2.17.1", "@reduxjs/toolkit": "^1.9.1", "@sentry/nextjs": "^7.30.0", "@tanstack/react-query": "^4.22.0", @@ -83,23 +82,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/@googlemaps/js-api-loader": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.15.1.tgz", - "integrity": "sha512-AsnEgNsB7S/VdrHGEQUaUM2e5tmjFGKBAfzR/AqO8O7TPq/jQGvoRw5liPBw4EMF38RDsHmKDV89q/X+qiUREQ==", - "dependencies": { - "fast-deep-equal": "^3.1.3" - } - }, - "node_modules/@googlemaps/markerclusterer": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/@googlemaps/markerclusterer/-/markerclusterer-2.0.13.tgz", - "integrity": "sha512-302GjQ9gsHOK/ef6hif+rJDv+AB3THst02iDCbXH2PS9GFwb/5yuytaLpuzJiqGNG+k2zvTAWTsGY/fQN5DZ7w==", - "dependencies": { - "fast-deep-equal": "^3.1.3", - "supercluster": "^7.1.3" - } - }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -394,33 +376,6 @@ "url": "https://opencollective.com/unts" } }, - "node_modules/@react-google-maps/api": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/@react-google-maps/api/-/api-2.17.1.tgz", - "integrity": "sha512-XesubSCFfyMtilqljF2kU5zdPru4nks4I4O0HH6H2xOw51wQXs26btJKlRac2/jbJ/gIiGZ/l14q0xaL/6OaBg==", - "dependencies": { - "@googlemaps/js-api-loader": "1.15.1", - "@googlemaps/markerclusterer": "2.0.13", - "@react-google-maps/infobox": "2.16.0", - "@react-google-maps/marker-clusterer": "2.16.1", - "@types/google.maps": "3.50.5", - "invariant": "2.2.4" - }, - "peerDependencies": { - "react": "^16.8 || ^17 || ^18", - "react-dom": "^16.8 || ^17 || ^18" - } - }, - "node_modules/@react-google-maps/infobox": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@react-google-maps/infobox/-/infobox-2.16.0.tgz", - "integrity": "sha512-ZojiMS25388RcUHQPycUAerSqdHDom+3dHczVcXHdT/i8fka3O8InkHxXwMhvBoM143ips7mv2BPaYOAJ5f4Nw==" - }, - "node_modules/@react-google-maps/marker-clusterer": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/@react-google-maps/marker-clusterer/-/marker-clusterer-2.16.1.tgz", - "integrity": "sha512-jOuyqzWLeXvQcoAu6TCVWHAuko+sDt0JjawNHBGqUNLywMtTCvYP0L0PiqJZOUCUeRYGdUy0AKxQ+30vAkvwag==" - }, "node_modules/@reduxjs/toolkit": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.9.1.tgz", @@ -814,11 +769,6 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, - "node_modules/@types/google.maps": { - "version": "3.50.5", - "resolved": "https://registry.npmjs.org/@types/google.maps/-/google.maps-3.50.5.tgz", - "integrity": "sha512-RuZf1MJtctGlpW+Gd4a/eGtAufUDjMf+eyN1l+B3fbe2YLScJbg8KEljJfb+6vnSPFAeM1/48geVIEg3vqOkxw==" - }, "node_modules/@types/hoist-non-react-statics": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", @@ -3228,14 +3178,6 @@ "node": ">= 0.4" } }, - "node_modules/invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "dependencies": { - "loose-envify": "^1.0.0" - } - }, "node_modules/is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -3641,11 +3583,6 @@ "node": ">=4.0" } }, - "node_modules/kdbush": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", - "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==" - }, "node_modules/language-subtag-registry": { "version": "0.3.22", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", @@ -5425,14 +5362,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/supercluster": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.5.tgz", - "integrity": "sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==", - "dependencies": { - "kdbush": "^3.0.0" - } - }, "node_modules/superjson": { "version": "1.12.2", "resolved": "https://registry.npmjs.org/superjson/-/superjson-1.12.2.tgz", @@ -5939,23 +5868,6 @@ "strip-json-comments": "^3.1.1" } }, - "@googlemaps/js-api-loader": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/@googlemaps/js-api-loader/-/js-api-loader-1.15.1.tgz", - "integrity": "sha512-AsnEgNsB7S/VdrHGEQUaUM2e5tmjFGKBAfzR/AqO8O7TPq/jQGvoRw5liPBw4EMF38RDsHmKDV89q/X+qiUREQ==", - "requires": { - "fast-deep-equal": "^3.1.3" - } - }, - "@googlemaps/markerclusterer": { - "version": "2.0.13", - "resolved": "https://registry.npmjs.org/@googlemaps/markerclusterer/-/markerclusterer-2.0.13.tgz", - "integrity": "sha512-302GjQ9gsHOK/ef6hif+rJDv+AB3THst02iDCbXH2PS9GFwb/5yuytaLpuzJiqGNG+k2zvTAWTsGY/fQN5DZ7w==", - "requires": { - "fast-deep-equal": "^3.1.3", - "supercluster": "^7.1.3" - } - }, "@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -6108,29 +6020,6 @@ "tslib": "^2.4.0" } }, - "@react-google-maps/api": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/@react-google-maps/api/-/api-2.17.1.tgz", - "integrity": "sha512-XesubSCFfyMtilqljF2kU5zdPru4nks4I4O0HH6H2xOw51wQXs26btJKlRac2/jbJ/gIiGZ/l14q0xaL/6OaBg==", - "requires": { - "@googlemaps/js-api-loader": "1.15.1", - "@googlemaps/markerclusterer": "2.0.13", - "@react-google-maps/infobox": "2.16.0", - "@react-google-maps/marker-clusterer": "2.16.1", - "@types/google.maps": "3.50.5", - "invariant": "2.2.4" - } - }, - "@react-google-maps/infobox": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@react-google-maps/infobox/-/infobox-2.16.0.tgz", - "integrity": "sha512-ZojiMS25388RcUHQPycUAerSqdHDom+3dHczVcXHdT/i8fka3O8InkHxXwMhvBoM143ips7mv2BPaYOAJ5f4Nw==" - }, - "@react-google-maps/marker-clusterer": { - "version": "2.16.1", - "resolved": "https://registry.npmjs.org/@react-google-maps/marker-clusterer/-/marker-clusterer-2.16.1.tgz", - "integrity": "sha512-jOuyqzWLeXvQcoAu6TCVWHAuko+sDt0JjawNHBGqUNLywMtTCvYP0L0PiqJZOUCUeRYGdUy0AKxQ+30vAkvwag==" - }, "@reduxjs/toolkit": { "version": "1.9.1", "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-1.9.1.tgz", @@ -6412,11 +6301,6 @@ "use-sync-external-store": "^1.2.0" } }, - "@types/google.maps": { - "version": "3.50.5", - "resolved": "https://registry.npmjs.org/@types/google.maps/-/google.maps-3.50.5.tgz", - "integrity": "sha512-RuZf1MJtctGlpW+Gd4a/eGtAufUDjMf+eyN1l+B3fbe2YLScJbg8KEljJfb+6vnSPFAeM1/48geVIEg3vqOkxw==" - }, "@types/hoist-non-react-statics": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", @@ -8140,14 +8024,6 @@ "side-channel": "^1.0.4" } }, - "invariant": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", - "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", - "requires": { - "loose-envify": "^1.0.0" - } - }, "is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", @@ -8417,11 +8293,6 @@ "object.assign": "^4.1.3" } }, - "kdbush": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/kdbush/-/kdbush-3.0.0.tgz", - "integrity": "sha512-hRkd6/XW4HTsA9vjVpY9tuXJYLSlelnkTmVFu4M9/7MIYQtFcHpbugAU7UbOfjOiVSVYl2fqgBuJ32JUmRo5Ew==" - }, "language-subtag-registry": { "version": "0.3.22", "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", @@ -9582,14 +9453,6 @@ } } }, - "supercluster": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/supercluster/-/supercluster-7.1.5.tgz", - "integrity": "sha512-EulshI3pGUM66o6ZdH3ReiFcvHpM3vAigyK+vcxdjpJyEbIIrtbmBdY23mGgnI24uXiGFvrGq9Gkum/8U7vJWg==", - "requires": { - "kdbush": "^3.0.0" - } - }, "superjson": { "version": "1.12.2", "resolved": "https://registry.npmjs.org/superjson/-/superjson-1.12.2.tgz", diff --git a/package.json b/package.json index 4580f32..4cf5f96 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,6 @@ "dependencies": { "@next/eslint-plugin-next": "^13.1.2", "@next/font": "13.1.2", - "@react-google-maps/api": "^2.17.1", "@reduxjs/toolkit": "^1.9.1", "@sentry/nextjs": "^7.30.0", "@tanstack/react-query": "^4.22.0", diff --git a/src/components/PlaceSearchBar.tsx b/src/components/PlaceSearchBar.tsx index a6bf3a9..9b21e40 100644 --- a/src/components/PlaceSearchBar.tsx +++ b/src/components/PlaceSearchBar.tsx @@ -2,8 +2,6 @@ import { useRef } from 'react'; import Autocomplete from 'react-google-autocomplete'; import { UseFormSetValue } from 'react-hook-form'; -import { LoadScript, StandaloneSearchBox } from '@react-google-maps/api'; - interface PropsType { name: string; setValue: UseFormSetValue; From c7aecc1da74c882255ecb179a530e584bce24471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Sun, 19 Feb 2023 01:43:05 +0900 Subject: [PATCH 034/131] =?UTF-8?q?fix:=20=ED=83=80=EC=9E=85=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B4=EA=B2=B0=EC=9D=84=20=EC=9C=84=ED=95=9C=20?= =?UTF-8?q?=EB=AA=A8=EB=93=88=20=EC=84=A4=EC=B9=98=20-=20@types/googlemaps?= =?UTF-8?q?=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 14 ++++++++++++++ package.json | 1 + 2 files changed, 15 insertions(+) diff --git a/package-lock.json b/package-lock.json index 70fbaec..20f2df6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,7 @@ "typescript": "4.9.4" }, "devDependencies": { + "@types/googlemaps": "^3.43.3", "@types/react-dates": "^21.8.3", "@types/redux-logger": "^3.0.9", "@typescript-eslint/eslint-plugin": "^5.48.1", @@ -769,6 +770,13 @@ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/@types/googlemaps": { + "version": "3.43.3", + "resolved": "https://registry.npmjs.org/@types/googlemaps/-/googlemaps-3.43.3.tgz", + "integrity": "sha512-ZWNoz/O8MPEpiajvj7QiqCY8tTLFNqNZ/a+s+zTV58wFVNAvvqV4bdGfnsjTb5Cs4V6wEsLrX8XRhmnyYJ2Tdg==", + "deprecated": "Types for the Google Maps browser API have moved to @types/google.maps. Note: these types are not for the googlemaps npm package, which is a Node API.", + "dev": true + }, "node_modules/@types/hoist-non-react-statics": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", @@ -6301,6 +6309,12 @@ "use-sync-external-store": "^1.2.0" } }, + "@types/googlemaps": { + "version": "3.43.3", + "resolved": "https://registry.npmjs.org/@types/googlemaps/-/googlemaps-3.43.3.tgz", + "integrity": "sha512-ZWNoz/O8MPEpiajvj7QiqCY8tTLFNqNZ/a+s+zTV58wFVNAvvqV4bdGfnsjTb5Cs4V6wEsLrX8XRhmnyYJ2Tdg==", + "dev": true + }, "@types/hoist-non-react-statics": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", diff --git a/package.json b/package.json index 4cf5f96..57cfc8d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "typescript": "4.9.4" }, "devDependencies": { + "@types/googlemaps": "^3.43.3", "@types/react-dates": "^21.8.3", "@types/redux-logger": "^3.0.9", "@typescript-eslint/eslint-plugin": "^5.48.1", From 8941f87802d05821f3a77d6360c046766b08c767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Sun, 19 Feb 2023 02:31:29 +0900 Subject: [PATCH 035/131] =?UTF-8?q?style:=20SelectBox=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20size=20=EC=A7=80=EC=A0=95=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Icons.tsx | 8 ++++---- src/components/common/SelectBox.tsx | 26 +++++++++++++++++--------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/components/common/Icons.tsx b/src/components/common/Icons.tsx index 266b7e4..49b16b5 100644 --- a/src/components/common/Icons.tsx +++ b/src/components/common/Icons.tsx @@ -131,27 +131,27 @@ const Right = () => ( ); -const Up = () => ( +const Up = ({ size }: { size: 'large' | 'small' }) => ( ); -const Down = () => ( +const Down = ({ size }: { size: 'large' | 'small' }) => ( diff --git a/src/components/common/SelectBox.tsx b/src/components/common/SelectBox.tsx index 8df58a1..eddddc5 100644 --- a/src/components/common/SelectBox.tsx +++ b/src/components/common/SelectBox.tsx @@ -13,8 +13,10 @@ interface PropsType { containerRef: React.RefObject; currentItem: string; changeItem: (item: string) => void; + size: 'large' | 'small'; } -const SelectBox = ({ items, containerRef, currentItem, changeItem }: PropsType) => { + +const SelectBox = ({ items, containerRef, currentItem, changeItem, size }: PropsType) => { const [isOpen, setIsOpen] = useState(false); const onClickToggle = (e: MouseEvent) => { @@ -39,20 +41,24 @@ const SelectBox = ({ items, containerRef, currentItem, changeItem }: PropsType) onBlur={onBlur} tabIndex={4} onClick={onClickToggle} - className="flex h-6 w-16 items-center justify-between rounded-lg border border-grey px-3 " + className={`flex ${ + size === 'large' ? 'h-12 w-36 ' : 'h-6 w-16' + } items-center justify-between rounded-lg border border-grey px-3 `} > - {currentItem} + + {currentItem} + - {isOpen && } - {!isOpen && } + {isOpen && } + {!isOpen && }
    {containerRef.current && createPortal(
      {items.map(({ index, item }) => ( @@ -60,7 +66,9 @@ const SelectBox = ({ items, containerRef, currentItem, changeItem }: PropsType) key={index.toString()} title={item} onClick={() => onClickItem(item)} - className="cursor-pointer select-none truncate rounded-lg p-2 text-[10px] hover:bg-main/50" + className={`${ + size === 'large' ? 'text-sm' : 'text-[10px]' + } cursor-pointer select-none truncate rounded-lg p-2 hover:bg-main/50`} > {item} From 6fc1d963caa660e35557a9ecc364b30f4fce631a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Sun, 19 Feb 2023 02:32:37 +0900 Subject: [PATCH 036/131] =?UTF-8?q?style:=20SelectBox=20CSS=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=EC=97=90=20=EB=94=B0=EB=A5=B8=20=EC=8A=A4=ED=83=80?= =?UTF-8?q?=EC=9D=BC=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PlaceSearchBar.tsx | 2 +- src/components/RecommendedList.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/PlaceSearchBar.tsx b/src/components/PlaceSearchBar.tsx index 9b21e40..0f7210e 100644 --- a/src/components/PlaceSearchBar.tsx +++ b/src/components/PlaceSearchBar.tsx @@ -47,7 +47,7 @@ const PlaceSearchBar = ({ name, setValue }: PropsType) => { componentRestrictions: { country: 'kr' }, fields: ['address_components'], }} - className="w-96 rounded-lg border border-solid border-black/20 p-3 focus:outline-main" + className="h-12 w-96 rounded-lg border border-solid border-black/20 p-3 text-sm focus:outline-main" /> ); }; diff --git a/src/components/RecommendedList.tsx b/src/components/RecommendedList.tsx index 60a1ef7..8e305e6 100644 --- a/src/components/RecommendedList.tsx +++ b/src/components/RecommendedList.tsx @@ -62,6 +62,7 @@ const RecommendedList = () => { containerRef={selectBoxContainer} currentItem={selectedCountry} changeItem={changeCountry} + size="small" /> { diff --git a/src/pages/markets/index.tsx b/src/pages/markets/index.tsx index 7326b8e..f5753e2 100644 --- a/src/pages/markets/index.tsx +++ b/src/pages/markets/index.tsx @@ -1,14 +1,17 @@ -import { Suspense } from 'react'; +import { Suspense, useRef } from 'react'; import DeadlineBanner from '@/components/cahoot/DeadlineBanner'; import Layout from '@/components/common/Layout'; import Interests from '@/components/market/Interests'; +import List from '@/components/market/List'; import RecentTrade from '@/components/market/RecentTrade'; import { ErrorBoundary } from '@sentry/nextjs'; import type { GetServerSideProps } from 'next'; const Markets = () => { + const scrollRef = useRef(null); + return (
      @@ -24,7 +27,7 @@ const Markets = () => { 로딩...

      }> - +
      @@ -36,6 +39,10 @@ const Markets = () => {
      +
      + 로딩...

      }> + +
      From 13131f7bfe89cc0b4de09f7cdfa6b5abf8d78ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Mon, 20 Feb 2023 01:41:43 +0900 Subject: [PATCH 039/131] =?UTF-8?q?feat:=20=EC=84=A0=ED=83=9D=ED=95=9C=20?= =?UTF-8?q?=EA=B5=AD=EA=B0=80=EC=9D=98=20=EC=9C=84=EC=B9=98=EB=A7=8C=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=EB=90=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PlaceSearchBar.tsx | 14 ++++++++++++-- src/pages/cahoots/create.tsx | 24 ++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/src/components/PlaceSearchBar.tsx b/src/components/PlaceSearchBar.tsx index 0f7210e..b5c634d 100644 --- a/src/components/PlaceSearchBar.tsx +++ b/src/components/PlaceSearchBar.tsx @@ -4,10 +4,11 @@ import { UseFormSetValue } from 'react-hook-form'; interface PropsType { name: string; + country: string; // 국가코드 setValue: UseFormSetValue; } -const PlaceSearchBar = ({ name, setValue }: PropsType) => { +const PlaceSearchBar = ({ name, country, setValue }: PropsType) => { const inputRef = useRef(null); // 자동완성 목록에서 주소 선택 시 나라명, 우편번호를 제외한 주소 생성 @@ -30,6 +31,15 @@ const PlaceSearchBar = ({ name, setValue }: PropsType) => { } setValue(name, inputText.trim()); }; + + // 국가 코드(ISO 2자리코드) 반환 + // TODO: 국가 목록 API 나온 뒤 수정 예정 + const getCountryCode = (countryName: string) => { + if (countryName === '대한민국') return 'kr'; + else if (countryName === '미국') return 'us'; + return 'kr'; + }; + return ( { onChange={onInput} options={{ types: ['(regions)'], - componentRestrictions: { country: 'kr' }, + componentRestrictions: { country: getCountryCode(country) }, fields: ['address_components'], }} className="h-12 w-96 rounded-lg border border-solid border-black/20 p-3 text-sm focus:outline-main" diff --git a/src/pages/cahoots/create.tsx b/src/pages/cahoots/create.tsx index 50ed567..bd3cf97 100644 --- a/src/pages/cahoots/create.tsx +++ b/src/pages/cahoots/create.tsx @@ -1,3 +1,4 @@ +import { useRef, useState } from 'react'; import { useForm, FieldErrors } from 'react-hook-form'; import DateRangeInput from '@/components/common/DateRangeInput'; @@ -6,6 +7,7 @@ import ImageUpload from '@/components/common/ImageUpload'; import Layout from '@/components/common/Layout'; import NumberInput from '@/components/common/NumberInput'; import RadioBtn from '@/components/common/RadioBtn'; +import SelectBox from '@/components/common/SelectBox'; import TextArea from '@/components/common/TextArea'; import TextInput from '@/components/common/TextInput'; import PlaceSearchBar from '@/components/PlaceSearchBar'; @@ -39,7 +41,14 @@ export interface FormDataType { stockNum: string; } +const selectItems = [ + { index: 1, item: '대한민국' }, + { index: 2, item: '미국' }, +]; + export default function CreateCahoot() { + const selectBoxContainer = useRef(null); + const [selectedCountry, setSelectedCountry] = useState('국가'); // 휴양지 위치 const { register, handleSubmit, setValue } = useForm(); const onSubmit = (data: FormDataType) => { @@ -51,6 +60,10 @@ export default function CreateCahoot() { console.log(errors); }; + const changeCountry = (country: string) => { + setSelectedCountry(country); + }; + return (
      @@ -110,9 +123,16 @@ export default function CreateCahoot() { {/* 위치 */} -
      +
      + {/* TODO: Loading 일 때 처리 */} - + {/* */}
      From b50175c461ed90dcf2a4b69351e966db2ad66ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Mon, 20 Feb 2023 11:40:20 +0900 Subject: [PATCH 040/131] =?UTF-8?q?chore:=20axios=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=20=EC=84=A4=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 142 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 143 insertions(+) diff --git a/package-lock.json b/package-lock.json index 20f2df6..89c6754 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "@types/node": "18.11.18", "@types/react": "18.0.26", "@types/react-dom": "18.0.10", + "axios": "^1.3.3", "daisyui": "^2.47.0", "eslint": "8.31.0", "eslint-config-next": "13.1.2", @@ -1332,6 +1333,11 @@ "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==" }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/autoprefixer": { "version": "10.4.13", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.13.tgz", @@ -1384,6 +1390,16 @@ "node": ">=4" } }, + "node_modules/axios": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.3.tgz", + "integrity": "sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==", + "dependencies": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/axobject-query": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz", @@ -1673,6 +1689,17 @@ "simple-swizzle": "^0.2.2" } }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", @@ -1900,6 +1927,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -2722,6 +2757,25 @@ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" }, + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -2730,6 +2784,19 @@ "is-callable": "^1.1.3" } }, + "node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fraction.js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", @@ -3721,6 +3788,25 @@ "node": ">=8.6" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/mimic-response": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", @@ -6712,6 +6798,11 @@ "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz", "integrity": "sha512-eBvWn1lvIApYMhzQMsu9ciLfkBY499mFZlNqG+/9WR7PVlroQw0vG30cOQQbaKz3sCEc44TAOu2ykzqXSNnwag==" }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "autoprefixer": { "version": "10.4.13", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.13.tgz", @@ -6736,6 +6827,16 @@ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.6.2.tgz", "integrity": "sha512-b1WlTV8+XKLj9gZy2DZXgQiyDp9xkkoe2a6U6UbYccScq2wgH/YwCeI2/Jq2mgo0HzQxqJOjWZBLeA/mqsk5Mg==" }, + "axios": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.3.3.tgz", + "integrity": "sha512-eYq77dYIFS77AQlhzEL937yUBSepBfPIe8FcgEDN35vMNZKMrs81pgnyrQpwfy4NF4b4XWX1Zgx7yX+25w8QJA==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "axobject-query": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz", @@ -6928,6 +7029,14 @@ "simple-swizzle": "^0.2.2" } }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, "commander": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", @@ -7091,6 +7200,11 @@ "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.1.tgz", "integrity": "sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==" }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, "delegates": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", @@ -7712,6 +7826,11 @@ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, "for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -7720,6 +7839,16 @@ "is-callable": "^1.1.3" } }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, "fraction.js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", @@ -8413,6 +8542,19 @@ "picomatch": "^2.3.1" } }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, "mimic-response": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", diff --git a/package.json b/package.json index 57cfc8d..f996d07 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "@types/node": "18.11.18", "@types/react": "18.0.26", "@types/react-dom": "18.0.10", + "axios": "^1.3.3", "daisyui": "^2.47.0", "eslint": "8.31.0", "eslint-config-next": "13.1.2", From 4333439a073c3fab255a218f184bdf08b61f0768 Mon Sep 17 00:00:00 2001 From: m4nd4r1n Date: Mon, 20 Feb 2023 20:14:41 +0900 Subject: [PATCH 041/131] =?UTF-8?q?fix:=20queryKey=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 공모 -> 마켓으로 수정 --- src/components/market/List.tsx | 2 +- src/components/market/ListItems.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/market/List.tsx b/src/components/market/List.tsx index b2a3cff..5cf6a27 100644 --- a/src/components/market/List.tsx +++ b/src/components/market/List.tsx @@ -18,7 +18,7 @@ const List = () => { return (
      - +
      diff --git a/src/components/market/ListItems.tsx b/src/components/market/ListItems.tsx index 7d6f5e5..03f5740 100644 --- a/src/components/market/ListItems.tsx +++ b/src/components/market/ListItems.tsx @@ -25,7 +25,7 @@ interface MockType { const ListItems = ({ keyword }: ListItemsProps) => { const { data, fetchNextPage, hasNextPage } = useInfiniteQuery>({ - queryKey: ['cahoot/list', keyword], + queryKey: ['market/list', keyword], queryFn: ({ pageParam = 0 }) => fetcher( `${ @@ -73,7 +73,7 @@ const ListItems = ({ keyword }: ListItemsProps) => { />
      -
      +
      {location}
      {title} From a7583c46e52a0134aaa369f53f92e96705fea677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Tue, 21 Feb 2023 01:26:42 +0900 Subject: [PATCH 042/131] =?UTF-8?q?feat:=20=EC=98=88=EC=83=81=20=EC=88=98?= =?UTF-8?q?=EC=9D=B5=EB=A5=A0=20=ED=95=84=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cahoots/create.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/pages/cahoots/create.tsx b/src/pages/cahoots/create.tsx index bd3cf97..39aac08 100644 --- a/src/pages/cahoots/create.tsx +++ b/src/pages/cahoots/create.tsx @@ -172,6 +172,13 @@ export default function CreateCahoot() { 만원
      + {/* 예상 수익률 */} + +
      + + % +
      +
      {/* 발행 주식 수량 및 가격 */}
      From deb50901da8422d35f9791d72081c5895e7bc839 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Tue, 21 Feb 2023 02:12:41 +0900 Subject: [PATCH 043/131] =?UTF-8?q?feat:=20=ED=9C=B4=EC=96=91=EC=A7=80?= =?UTF-8?q?=EB=AA=85=20=EA=B8=80=EC=9E=90=EC=88=98=20=EC=A0=9C=ED=95=9C=20?= =?UTF-8?q?=EC=A1=B0=EA=B1=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/cahoots/create.tsx | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pages/cahoots/create.tsx b/src/pages/cahoots/create.tsx index 39aac08..bc3c9a2 100644 --- a/src/pages/cahoots/create.tsx +++ b/src/pages/cahoots/create.tsx @@ -49,7 +49,12 @@ const selectItems = [ export default function CreateCahoot() { const selectBoxContainer = useRef(null); const [selectedCountry, setSelectedCountry] = useState('국가'); // 휴양지 위치 - const { register, handleSubmit, setValue } = useForm(); + const { + register, + handleSubmit, + setValue, + formState: { errors }, + } = useForm(); const onSubmit = (data: FormDataType) => { console.log(data); @@ -81,8 +86,17 @@ export default function CreateCahoot() { id="title" placeholder="5~20 글자로 작성해주세요." required={true} - register={register('title')} + register={register('title', { + minLength: 5, + maxLength: 20, + })} /> + {errors.title && errors.title.type === 'minLength' && ( +

      5자 이상 입력해주세요.

      + )} + {errors.title && errors.title.type === 'maxLength' && ( +

      20자 이하로 입력해주세요.

      + )}
      {/* 간단한 소개 */} From 9c9c9c2d286816f7e690d7ee764c094db9de6a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B6=8C=EC=9C=A0=EB=A6=AC?= <99jiyusu@gmail.com> Date: Tue, 21 Feb 2023 14:52:43 +0900 Subject: [PATCH 044/131] =?UTF-8?q?feat:=20=EA=B3=B5=EB=AA=A8=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=88=AB=EC=9E=90=20?= =?UTF-8?q?=ED=95=84=EB=93=9C=20=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/NumberInput.tsx | 44 ++++++++++++++++++--------- src/pages/cahoots/create.tsx | 42 ++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 19 deletions(-) diff --git a/src/components/common/NumberInput.tsx b/src/components/common/NumberInput.tsx index 27d29b9..34e9be8 100644 --- a/src/components/common/NumberInput.tsx +++ b/src/components/common/NumberInput.tsx @@ -3,59 +3,75 @@ import { UseFormSetValue } from 'react-hook-form'; interface PropsType { size: 'small' | 'large'; - min?: number; + min: number; + max: number; + unit?: number; value?: number; name: string; setValue: UseFormSetValue; } -const NumberInput = ({ size, min = 0, name, setValue }: PropsType) => { - const [num, setNum] = useState(0); +const NumberInput = ({ size, min = 0, max = 100, unit = 1, name, setValue }: PropsType) => { + const [num, setNum] = useState(min); const handleInput = (e: React.ChangeEvent) => { - const inputNum = Number(e.target.value); + let inputNum = Number(e.target.value); if (isNaN(inputNum) || inputNum < 0) { return; } + + if (inputNum < min) { + inputNum = min; + } else if (inputNum > max) { + inputNum = max; + } + setNum(inputNum); setValue(name, inputNum); }; const onClickPlus = () => { - setNum(num + 1); - setValue(name, num + 1); + const newVal = num + unit; + + if (newVal > max) { + return; + } + setNum(newVal); + setValue(name, newVal); }; const onClickMinus = () => { - if (num - 1 < min) { + const newVal = num - unit; + + if (newVal < min) { return; } - setNum(num - 1); - setValue(name, num - 1); + setNum(newVal); + setValue(name, newVal); }; return ( -
      +
      -
      +