From e6eb175798e01e5a60d1d1812fcd300cc0c96d3c Mon Sep 17 00:00:00 2001
From: zoonyoung <9851248@gmail.com>
Date: Tue, 28 May 2024 19:30:03 +0900
Subject: [PATCH 01/20] =?UTF-8?q?fix:=20default-props=EA=B4=80=EB=A0=A8=20?=
=?UTF-8?q?lint=EC=84=A4=EC=A0=95=20off?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.eslintrc.json | 1 +
1 file changed, 1 insertion(+)
diff --git a/.eslintrc.json b/.eslintrc.json
index 63612ed..68084a3 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -15,6 +15,7 @@
],
"ignorePatterns": ["next.config.mjs"],
"rules": {
+ "react/require-default-props": "off",
"react/react-in-jsx-scope": "off",
"react/jsx-filename-extension": [1, { "extensions": [".ts", ".tsx"] }],
"react/jsx-props-no-spreading": "off",
From e112ab8175c3252350ef10d5b8e95728006c1d0c Mon Sep 17 00:00:00 2001
From: zoonyoung <9851248@gmail.com>
Date: Tue, 28 May 2024 19:30:32 +0900
Subject: [PATCH 02/20] =?UTF-8?q?fix:=20eye-on=20=EC=9D=B4=EB=AF=B8?=
=?UTF-8?q?=EC=A7=80=ED=8C=8C=EC=9D=BC=20=ED=8C=8C=EC=9D=BC=EB=AA=85=20?=
=?UTF-8?q?=EC=9E=98=EB=AA=BB=EB=90=98=EC=96=B4=EC=9E=88=EB=8A=94=EA=B2=83?=
=?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/utils/constant.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/utils/constant.ts b/src/utils/constant.ts
index 8592fd8..605376c 100644
--- a/src/utils/constant.ts
+++ b/src/utils/constant.ts
@@ -18,7 +18,7 @@ export const STAR_ICON = "/images/star-gray.svg";
export const THUMBS_UP_ICON = "/images/thumbs-up-inactive.svg";
export const THUMBS_UP_ACTIVE_ICON = "/images/thumbs-up-active.svg";
export const EYE_OFF_ICON = "/images/visibility-off.svg";
-export const EYE_ON_ICON = "/images/visibility-on.svg";
+export const EYE_ON_ICON = "/images/visibility.svg";
export const LOADING_SMALL_IMAGE = "/images/loading-small.svg";
export const LOADING_LARGE_IMAGE = "/images/loading-large.svg";
export const LOGO_IMAGE = "/images/main-logo.svg";
From 35d28dd45801798af2fc197048c5d9739ff56a25 Mon Sep 17 00:00:00 2001
From: zoonyoung <9851248@gmail.com>
Date: Tue, 28 May 2024 19:31:47 +0900
Subject: [PATCH 03/20] =?UTF-8?q?feat:=20Input=EC=BB=B4=ED=8F=AC=EB=84=8C?=
=?UTF-8?q?=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/Input/Input.module.scss | 48 ++++++++++++++++++
src/components/Input/Input.tsx | 70 ++++++++++++++++++++++++++
2 files changed, 118 insertions(+)
create mode 100644 src/components/Input/Input.module.scss
create mode 100644 src/components/Input/Input.tsx
diff --git a/src/components/Input/Input.module.scss b/src/components/Input/Input.module.scss
new file mode 100644
index 0000000..7450e55
--- /dev/null
+++ b/src/components/Input/Input.module.scss
@@ -0,0 +1,48 @@
+@import "@/styles/_index.scss";
+
+.container {
+ display: flex;
+ flex-direction: column;
+ gap: 0.4rem;
+ width: 40rem;
+}
+
+.label {
+ color: $white-100;
+}
+
+.input {
+ border: none;
+ width: 100%;
+ outline: 1px solid $gray-300;
+ background: $black-200;
+ color: $white-100;
+ padding: 1rem;
+
+ &:focus {
+ outline: 1px solid $blue-100;
+ }
+
+ @include rounded-md;
+}
+
+.inputBox {
+ position: relative;
+}
+
+.eyeIcon {
+ position: absolute;
+ top: 50%;
+ right: 0.6rem;
+ transform: translateY(-50%);
+}
+
+.error {
+ outline: 1px solid $red-100;
+}
+
+.errorMessage {
+ color: $red-100;
+
+ @include text-xs;
+}
diff --git a/src/components/Input/Input.tsx b/src/components/Input/Input.tsx
new file mode 100644
index 0000000..591bd00
--- /dev/null
+++ b/src/components/Input/Input.tsx
@@ -0,0 +1,70 @@
+"use client";
+
+import Image from "next/image";
+import { useState } from "react";
+import { useForm } from "react-hook-form";
+import cn from "@/utils/classNames";
+import { EYE_OFF_ICON, EYE_ON_ICON } from "@/utils/constant";
+import styles from "./Input.module.scss";
+
+type InputProps = {
+ name: string;
+ type?: "email" | "text" | "password";
+ label?: string;
+ placeholder?: string;
+ required?: string;
+ minLength?: { value: number; message: string };
+ maxLength?: { value: number; message: string };
+ pattern?: { value: RegExp; message: string };
+ validate?: { ["type"]: () => string };
+};
+
+export default function Input({
+ name,
+ label,
+ type,
+ placeholder = "",
+ required,
+ minLength,
+ maxLength,
+ pattern,
+ validate,
+}: InputProps) {
+ const {
+ register,
+ formState: { errors },
+ } = useForm({ mode: "onBlur" });
+
+ const [showPassword, setShowPassword] = useState(false);
+ const handleEyeIconClick = () => setShowPassword((prev: boolean) => !prev);
+
+ return (
+
+
+
+
+ {type === "password" && (
+
+ )}
+
+ {errors[name] &&
{errors[name]?.message?.toString()}
}
+
+ );
+}
From d92963aa5dc596fc7ed7d37bb4e60bbe70583d90 Mon Sep 17 00:00:00 2001
From: yubin
Date: Wed, 29 May 2024 11:19:01 +0900
Subject: [PATCH 04/20] =?UTF-8?q?[#28]=20feat:=20comparePage=20=EC=83=9D?=
=?UTF-8?q?=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/compare/compare.module.scss | 5 +++++
src/app/compare/page.tsx | 12 ++++++++++++
2 files changed, 17 insertions(+)
create mode 100644 src/app/compare/compare.module.scss
create mode 100644 src/app/compare/page.tsx
diff --git a/src/app/compare/compare.module.scss b/src/app/compare/compare.module.scss
new file mode 100644
index 0000000..5630d42
--- /dev/null
+++ b/src/app/compare/compare.module.scss
@@ -0,0 +1,5 @@
+@import "@/styles/_index";
+
+.background {
+ background-color: $bg-black-100;
+}
diff --git a/src/app/compare/page.tsx b/src/app/compare/page.tsx
new file mode 100644
index 0000000..e8bdca1
--- /dev/null
+++ b/src/app/compare/page.tsx
@@ -0,0 +1,12 @@
+import React from "react";
+import styles from "./compare.module.scss";
+
+function ComparePage() {
+ return (
+
+ );
+}
+
+export default ComparePage;
From d12fe242e992ce83d6b7db0e7afcfc23f5085f3d Mon Sep 17 00:00:00 2001
From: yubin
Date: Wed, 29 May 2024 13:55:38 +0900
Subject: [PATCH 05/20] =?UTF-8?q?[#28]=20feat:=20comparePage=20=EB=A0=88?=
=?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/compare/compare.module.scss | 74 +++++++++++++++++++
src/app/compare/page.tsx | 23 +++++-
.../CategoryFilter.module.scss | 1 +
.../Chip/Category/Category.module.scss | 3 +-
.../Chip/Compare/Compare.module.scss | 2 +
.../Chip/Ranking/Ranking.module.scss | 3 +-
6 files changed, 103 insertions(+), 3 deletions(-)
diff --git a/src/app/compare/compare.module.scss b/src/app/compare/compare.module.scss
index 5630d42..82365ba 100644
--- a/src/app/compare/compare.module.scss
+++ b/src/app/compare/compare.module.scss
@@ -1,5 +1,79 @@
@import "@/styles/_index";
+@import "@/styles/_media";
.background {
+ position: fixed;
+ width: 100%;
+ height: 100%;
background-color: $bg-black-100;
}
+.content {
+ display: flex;
+ justify-content: center;
+ align-items: end;
+ gap: 20px;
+ margin-top: 60px;
+ @include respond-to(tablet) {
+ margin-top: 40px;
+ }
+ @include respond-to(mobile) {
+ margin-top: 30px;
+ flex-direction: column;
+ align-items: center;
+ gap: 30px;
+ }
+}
+.input {
+ width: 350px;
+ height: 70px;
+ padding: 23px 20px;
+ gap: 10px;
+ border-radius: 8px;
+ border: 1px solid $gray-300;
+ background: $black-200;
+ &:focus {
+ border: 1px solid $blue-100;
+ outline: none;
+ }
+ @include respond-to(tablet) {
+ width: 240px;
+ height: 55px;
+ }
+ @include respond-to(mobile) {
+ width: 335px;
+ height: 55px;
+ padding: 23px 20px;
+ border-radius: 8px;
+ }
+}
+.text {
+ color: $white-100;
+ font-family: Pretendard;
+ font-size: 16px;
+ font-weight: 400;
+ margin-bottom: 10px;
+}
+.button {
+ width: 200px;
+ height: 70px;
+ gap: 10px;
+ border-radius: 8px;
+ background: linear-gradient(91.17deg, #5097fa 0%, #5363ff 100%);
+ border: none;
+ font-size: 18px;
+ font-weight: 600;
+ color: $white-100;
+ font-family: Pretendard;
+ @include respond-to(tablet) {
+ width: 164px;
+ height: 55px;
+ font-size: 16px;
+ font-weight: 600;
+ }
+ @include respond-to(mobile) {
+ width: 335px;
+ height: 50px;
+ gap: 10px;
+ border-radius: 8px;
+ }
+}
diff --git a/src/app/compare/page.tsx b/src/app/compare/page.tsx
index e8bdca1..61914f7 100644
--- a/src/app/compare/page.tsx
+++ b/src/app/compare/page.tsx
@@ -4,7 +4,28 @@ import styles from "./compare.module.scss";
function ComparePage() {
return (
);
}
diff --git a/src/components/Chip/Category-filter/CategoryFilter.module.scss b/src/components/Chip/Category-filter/CategoryFilter.module.scss
index 70c1207..6b7a003 100644
--- a/src/components/Chip/Category-filter/CategoryFilter.module.scss
+++ b/src/components/Chip/Category-filter/CategoryFilter.module.scss
@@ -1,4 +1,5 @@
@import "@/styles/_index";
+@import "@/styles/_media";
.container {
display: flex;
diff --git a/src/components/Chip/Category/Category.module.scss b/src/components/Chip/Category/Category.module.scss
index 19e526d..46c6e60 100644
--- a/src/components/Chip/Category/Category.module.scss
+++ b/src/components/Chip/Category/Category.module.scss
@@ -1,4 +1,5 @@
@import "@/styles/_index";
+@import "@/styles/_media";
.container {
display: flex;
@@ -10,7 +11,7 @@
border-radius: 8px;
font-size: 18px;
font-weight: 500;
- @include respond-to(mibile) {
+ @include respond-to(mobile) {
padding: 4px 8px;
font-size: 12px;
}
diff --git a/src/components/Chip/Compare/Compare.module.scss b/src/components/Chip/Compare/Compare.module.scss
index 4d2e859..246cc7f 100644
--- a/src/components/Chip/Compare/Compare.module.scss
+++ b/src/components/Chip/Compare/Compare.module.scss
@@ -1,4 +1,6 @@
@import "@/styles/_index";
+@import "@/styles/_media";
+
.back {
background-color: black;
}
diff --git a/src/components/Chip/Ranking/Ranking.module.scss b/src/components/Chip/Ranking/Ranking.module.scss
index 57440fb..da2d906 100644
--- a/src/components/Chip/Ranking/Ranking.module.scss
+++ b/src/components/Chip/Ranking/Ranking.module.scss
@@ -1,4 +1,5 @@
@import "@/styles/_index";
+@import "@/styles/_media";
.container {
display: flex;
@@ -8,7 +9,7 @@
width: 3.2rem;
height: 1.8rem;
font-size: 1.2rem;
- @include respond-to(mibile) {
+ @include respond-to(mobile) {
width: 2.6rem;
height: 1.6rem;
font-size: 1rem;
From 53d9badbb5179fcb282bce73d52949766a40196b Mon Sep 17 00:00:00 2001
From: yubin
Date: Sat, 1 Jun 2024 11:29:40 +0900
Subject: [PATCH 06/20] chore: stylelint
---
src/app/compare/compare.module.scss | 90 +++++++++++++++----
src/app/compare/page.tsx | 67 +++++++++++++-
.../CategoryFilter.module.scss | 10 +--
.../Chip/Category/Category.module.scss | 36 +++++---
.../Chip/Compare/Compare.module.scss | 19 ++--
.../Chip/Ranking/Ranking.module.scss | 14 +--
src/components/Chip/Thumbs/Thumbs.module.scss | 14 +--
7 files changed, 195 insertions(+), 55 deletions(-)
diff --git a/src/app/compare/compare.module.scss b/src/app/compare/compare.module.scss
index 82365ba..067c5b7 100644
--- a/src/app/compare/compare.module.scss
+++ b/src/app/compare/compare.module.scss
@@ -7,38 +7,49 @@
height: 100%;
background-color: $bg-black-100;
}
+
.content {
display: flex;
- justify-content: center;
- align-items: end;
gap: 20px;
- margin-top: 60px;
+ align-items: end;
+ justify-content: center;
+
+ // margin-top: 60px;
@include respond-to(tablet) {
margin-top: 40px;
}
+
@include respond-to(mobile) {
- margin-top: 30px;
flex-direction: column;
- align-items: center;
gap: 30px;
+ align-items: center;
+ margin-top: 30px;
}
}
+
.input {
+ gap: 10px;
width: 350px;
height: 70px;
padding: 23px 20px;
- gap: 10px;
- border-radius: 8px;
- border: 1px solid $gray-300;
+ font-family: Pretendard;
+ font-size: 16px;
+ color: $white-100;
background: $black-200;
+ border: 1px solid $gray-300;
+ border-radius: 8px;
+
&:focus {
border: 1px solid $blue-100;
outline: none;
}
+
@include respond-to(tablet) {
width: 240px;
height: 55px;
+ font-size: 14px;
}
+
@include respond-to(mobile) {
width: 335px;
height: 55px;
@@ -46,34 +57,81 @@
border-radius: 8px;
}
}
+
.text {
- color: $white-100;
+ margin-bottom: 10px;
font-family: Pretendard;
font-size: 16px;
font-weight: 400;
- margin-bottom: 10px;
+ color: $white-100;
}
+
.button {
+ gap: 10px;
width: 200px;
height: 70px;
- gap: 10px;
- border-radius: 8px;
- background: linear-gradient(91.17deg, #5097fa 0%, #5363ff 100%);
- border: none;
+ font-family: Pretendard;
font-size: 18px;
font-weight: 600;
color: $white-100;
- font-family: Pretendard;
+ background: linear-gradient(91.17deg, #5097fa 0%, #5363ff 100%);
+ border: none;
+ border-radius: 8px;
+
@include respond-to(tablet) {
width: 164px;
height: 55px;
font-size: 16px;
font-weight: 600;
}
+
@include respond-to(mobile) {
+ gap: 10px;
width: 335px;
height: 50px;
- gap: 10px;
border-radius: 8px;
}
}
+
+.compare {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ color: $white-100;
+}
+
+.table {
+ width: 940px;
+ margin: 20px 0;
+ font-size: 1em;
+ text-align: left;
+ background-color: $black-200;
+ border-radius: 12px;
+}
+
+.trHead {
+ color: $gray-100;
+ border-bottom: 1px solid $gray-300;
+}
+
+.name {
+ color: $gray-100;
+}
+
+.th {
+ padding: 20px;
+ text-align: center;
+}
+
+.td {
+ padding: 30px;
+ text-align: center;
+}
+
+.winner {
+ color: $green-100;
+}
+
+.loser {
+ color: $pink-100;
+}
diff --git a/src/app/compare/page.tsx b/src/app/compare/page.tsx
index 61914f7..d5cd79b 100644
--- a/src/app/compare/page.tsx
+++ b/src/app/compare/page.tsx
@@ -1,31 +1,92 @@
-import React from "react";
+"use client";
+
+import React, { useState } from "react";
import styles from "./compare.module.scss";
function ComparePage() {
+ const [compare, setCompare] = useState(false);
+
return (
+ {compare && (
+
+
+
Air Pods Max 상품이 승리하였습니다!
+
6가지 항목 중 3가지 항목에서 우세합니다.
+
+
+
+
+ 기준 |
+ 상품 1 |
+ 상품 2 |
+ 결과 |
+
+
+
+
+ 절대 별점 |
+ 4.8 |
+ 4.9 |
+ 상품 2 승리 |
+
+
+ 상대 별점 |
+ +1.5 |
+ +2.5 |
+ 상품 2 승리 |
+
+
+ 절대 찜 개수 |
+ 13,580 |
+ 1,560 |
+ 상품 1 승리 |
+
+
+ 상대 찜 개수 |
+ -150 |
+ +185 |
+ 상품 2 승리 |
+
+
+ 절대 조회수 |
+ 13,580 |
+ 1,560 |
+ 상품 1 승리 |
+
+
+ 상대 조회수 |
+ +113 |
+ +113 |
+ 무승부 |
+
+
+
+
+ )}
);
}
diff --git a/src/components/Chip/Category-filter/CategoryFilter.module.scss b/src/components/Chip/Category-filter/CategoryFilter.module.scss
index 6b7a003..66f7eb8 100644
--- a/src/components/Chip/Category-filter/CategoryFilter.module.scss
+++ b/src/components/Chip/Category-filter/CategoryFilter.module.scss
@@ -3,14 +3,14 @@
.container {
display: flex;
- justify-content: center;
- align-items: center;
gap: 5px;
- color: $gray-200;
- border-radius: 100px;
+ align-items: center;
+ justify-content: center;
width: 96px;
height: 30px;
+ font-size: 14px;
+ color: $gray-200;
background-color: $black-200;
border: 0.1rem solid $gray-300;
- font-size: 14px;
+ border-radius: 100px;
}
diff --git a/src/components/Chip/Category/Category.module.scss b/src/components/Chip/Category/Category.module.scss
index 46c6e60..84469dd 100644
--- a/src/components/Chip/Category/Category.module.scss
+++ b/src/components/Chip/Category/Category.module.scss
@@ -3,59 +3,71 @@
.container {
display: flex;
- justify-content: center;
align-items: center;
+ justify-content: center;
width: fit-content;
height: 29px;
padding: 4px 10px;
- border-radius: 8px;
font-size: 18px;
font-weight: 500;
+ border-radius: 8px;
+
@include respond-to(mobile) {
padding: 4px 8px;
font-size: 12px;
}
}
+
.yellow {
- background-color: rgba(197, 209, 124, 0.1);
color: #c5d17c;
+ background-color: rgb(197 209 124 / 10%);
}
+
.red {
- background-color: rgba(247, 86, 50, 0.1);
color: #f75532;
+ background-color: rgb(247 86 50 / 10%);
}
+
.purple {
- background-color: rgba(169, 83, 255, 0.1);
color: #a953ff;
+ background-color: rgb(169 83 255 / 10%);
}
+
.green {
- background-color: rgba(73, 175, 26, 0.1);
color: #49af1a;
+ background-color: rgb(73 175 26 / 10%);
}
+
.pink {
- background-color: rgba(214, 118, 193, 0.1);
color: #d676c1;
+ background-color: rgb(214 118 193 / 10%);
}
+
.orange {
- background-color: rgba(255, 126, 70, 0.1);
color: #ff7e46;
+ background-color: rgb(255 126 70 / 10%);
}
+
.mint {
- background-color: rgba(35, 181, 129, 0.1);
color: #23b581;
+ background-color: rgb(35 181 129 / 10%);
}
+
.hotpink {
- background-color: rgba(253, 82, 154, 0.1);
color: #fd529a;
+ background-color: rgb(253 82 154 / 10%);
}
+
.navy {
- background-color: rgba(117, 122, 255, 0.1);
color: #757aff;
+ background-color: rgb(117 122 255 / 10%);
}
+
.blue {
- background-color: rgba(48, 152, 227, 0.1);
color: #3098e3;
+ background-color: rgb(48 152 227 / 10%);
}
+
.default {
display: none;
}
diff --git a/src/components/Chip/Compare/Compare.module.scss b/src/components/Chip/Compare/Compare.module.scss
index 246cc7f..13d1ed9 100644
--- a/src/components/Chip/Compare/Compare.module.scss
+++ b/src/components/Chip/Compare/Compare.module.scss
@@ -6,25 +6,28 @@
}
.container {
- width: fit-content;
display: flex;
- justify-content: center;
- align-items: center;
gap: 10px;
- border-radius: 6px;
+ align-items: center;
+ justify-content: center;
+ width: fit-content;
padding: 8px 10px;
font-size: 16px;
+ border-radius: 6px;
}
+
.closeIcon {
- background-color: rgba(0, 0, 0, 0.5);
- border-radius: 6px;
padding: 2px;
+ background-color: rgb(0 0 0 / 50%);
+ border-radius: 6px;
}
+
.compare1 {
- background-color: rgba(5, 213, 140, 0.3);
color: $green-100;
+ background-color: rgb(5 213 140 / 30%);
}
+
.compare2 {
- background-color: rgba(255, 47, 159, 0.3);
color: $pink-100;
+ background-color: rgb(255 47 159 / 30%);
}
diff --git a/src/components/Chip/Ranking/Ranking.module.scss b/src/components/Chip/Ranking/Ranking.module.scss
index da2d906..78635fc 100644
--- a/src/components/Chip/Ranking/Ranking.module.scss
+++ b/src/components/Chip/Ranking/Ranking.module.scss
@@ -3,12 +3,13 @@
.container {
display: flex;
- justify-content: center;
align-items: center;
- border-radius: 5rem;
+ justify-content: center;
width: 3.2rem;
height: 1.8rem;
font-size: 1.2rem;
+ border-radius: 5rem;
+
@include respond-to(mobile) {
width: 2.6rem;
height: 1.6rem;
@@ -18,16 +19,19 @@
.first {
color: $pink-100;
- background-color: rgba(255, 47, 158, 0.1);
+ background-color: rgb(255 47 158 / 10%);
}
+
.second {
color: $green-100;
- background-color: rgba(5, 213, 139, 0.1);
+ background-color: rgb(5 213 139 / 10%);
}
+
.third {
color: $gray-100;
- background-color: rgba(255, 200, 60, 0.1);
+ background-color: rgb(255 200 60 / 10%);
}
+
.default {
display: none;
}
diff --git a/src/components/Chip/Thumbs/Thumbs.module.scss b/src/components/Chip/Thumbs/Thumbs.module.scss
index 6f2cc27..3d372fc 100644
--- a/src/components/Chip/Thumbs/Thumbs.module.scss
+++ b/src/components/Chip/Thumbs/Thumbs.module.scss
@@ -2,22 +2,24 @@
.container {
display: flex;
- justify-content: center;
- align-items: center;
gap: 5px;
+ align-items: center;
+ justify-content: center;
width: fit-content;
padding: 6px 12px;
- border-radius: 100px;
- border: 1px solid $gray-300;
- background-color: $black-200;
- color: $gray-100;
font-size: 14px;
+ color: $gray-100;
cursor: pointer;
+ background-color: $black-200;
+ border: 1px solid $gray-300;
+ border-radius: 100px;
+
@include respond-to(mibile) {
padding: 6px 10px;
font-size: 12px;
}
}
+
.active {
color: #5363ff;
}
From 06029b44bd72b23c3668bd6947ae70b27df1827b Mon Sep 17 00:00:00 2001
From: yubin
Date: Sat, 1 Jun 2024 19:21:54 +0900
Subject: [PATCH 07/20] =?UTF-8?q?[#28]=20feat:=20media=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/app/compare/compare.module.scss | 55 ++++++++++++++++++++++++++---
src/app/compare/page.tsx | 11 ++++--
2 files changed, 59 insertions(+), 7 deletions(-)
diff --git a/src/app/compare/compare.module.scss b/src/app/compare/compare.module.scss
index 067c5b7..0856ce7 100644
--- a/src/app/compare/compare.module.scss
+++ b/src/app/compare/compare.module.scss
@@ -2,9 +2,10 @@
@import "@/styles/_media";
.background {
- position: fixed;
+ position: relative;
width: 100%;
height: 100%;
+ padding-bottom: 100px;
background-color: $bg-black-100;
}
@@ -13,17 +14,18 @@
gap: 20px;
align-items: end;
justify-content: center;
+ padding-top: 60px;
// margin-top: 60px;
@include respond-to(tablet) {
- margin-top: 40px;
+ padding-top: 40px;
}
@include respond-to(mobile) {
flex-direction: column;
gap: 30px;
align-items: center;
- margin-top: 30px;
+ padding-top: 30px;
}
}
@@ -100,13 +102,50 @@
color: $white-100;
}
+.resultBox {
+ margin-top: 80px;
+ margin-bottom: 40px;
+ text-align: center;
+}
+
+.result {
+ display: flex;
+ gap: 8px;
+ margin-bottom: 20px;
+ font-size: 24px;
+ font-weight: 600;
+
+ @include respond-to(tablet) {
+ flex-direction: column;
+ }
+}
+
+.colorText {
+ color: $pink-100;
+}
+
+.reason {
+ font-size: 16px;
+ font-weight: 400;
+ color: $gray-100;
+}
+
.table {
width: 940px;
margin: 20px 0;
- font-size: 1em;
+ font-size: 14px;
text-align: left;
background-color: $black-200;
border-radius: 12px;
+
+ @include respond-to(tablet) {
+ width: 684px;
+ }
+
+ @include respond-to(mobile) {
+ width: 335px;
+ font-size: 12px;
+ }
}
.trHead {
@@ -121,11 +160,19 @@
.th {
padding: 20px;
text-align: center;
+
+ @include respond-to(mobile) {
+ padding: 15px;
+ }
}
.td {
padding: 30px;
text-align: center;
+
+ @include respond-to(mobile) {
+ padding: 15px;
+ }
}
.winner {
diff --git a/src/app/compare/page.tsx b/src/app/compare/page.tsx
index d5cd79b..21072bd 100644
--- a/src/app/compare/page.tsx
+++ b/src/app/compare/page.tsx
@@ -33,9 +33,14 @@ function ComparePage() {
{compare && (
-
-
Air Pods Max 상품이 승리하였습니다!
-
6가지 항목 중 3가지 항목에서 우세합니다.
+
+
+
+ Air Pods Max 상품이
+
+
승리하였습니다!
+
+
6가지 항목 중 3가지 항목에서 우세합니다.
From 766a29c3bc4d723da3f93a95593674189934c06e Mon Sep 17 00:00:00 2001
From: yubin
Date: Sun, 2 Jun 2024 15:32:02 +0900
Subject: [PATCH 08/20] =?UTF-8?q?chore:=20css=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/compare/compare.module.scss | 24 ++++++++++++++++++++++--
src/app/compare/page.tsx | 15 ++++++++++++++-
2 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/app/compare/compare.module.scss b/src/app/compare/compare.module.scss
index 0856ce7..70608e9 100644
--- a/src/app/compare/compare.module.scss
+++ b/src/app/compare/compare.module.scss
@@ -4,9 +4,17 @@
.background {
position: relative;
width: 100%;
- height: 100%;
- padding-bottom: 100px;
+ min-height: calc(100vh - 85px);
+ overflow: auto;
background-color: $bg-black-100;
+ color: $white-100;
+ padding-bottom: 50px;
+ @include respond-to(tablet) {
+ min-height: calc(100vh - 78px);
+ }
+ @include respond-to(mobile) {
+ min-height: calc(100vh - 68px);
+ }
}
.content {
@@ -182,3 +190,15 @@
.loser {
color: $pink-100;
}
+.loading {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ min-height: calc(100vh - 255px);
+ @include respond-to(tablet) {
+ min-height: calc(100vh - 248px);
+ }
+ @include respond-to(mobile) {
+ min-height: calc(100vh - 380px);
+ }
+}
diff --git a/src/app/compare/page.tsx b/src/app/compare/page.tsx
index 21072bd..e2e5445 100644
--- a/src/app/compare/page.tsx
+++ b/src/app/compare/page.tsx
@@ -1,6 +1,8 @@
"use client";
+import Image from "next/image";
import React, { useState } from "react";
+import { LOADING_LARGE_IMAGE } from "@/utils/constant";
import styles from "./compare.module.scss";
function ComparePage() {
@@ -14,6 +16,7 @@ function ComparePage() {
@@ -21,6 +24,7 @@ function ComparePage() {
+ ) : (
+
+
+
)}
);
From eb382ff475985f1079295fe642e2354950ee59d9 Mon Sep 17 00:00:00 2001
From: yubin
Date: Sun, 2 Jun 2024 17:17:04 +0900
Subject: [PATCH 09/20] =?UTF-8?q?[#28]=20feat:=20compareChip=20component?=
=?UTF-8?q?=20=EC=88=98=EC=A0=95/comparePage=20chip=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/app/compare/compare.module.scss | 12 +++
src/app/compare/page.tsx | 93 ++++++++++++++++---
.../Chip/Compare/Compare.module.scss | 5 +-
src/components/Chip/Compare/Compare.tsx | 28 ++----
4 files changed, 102 insertions(+), 36 deletions(-)
diff --git a/src/app/compare/compare.module.scss b/src/app/compare/compare.module.scss
index 70608e9..bd91834 100644
--- a/src/app/compare/compare.module.scss
+++ b/src/app/compare/compare.module.scss
@@ -36,6 +36,18 @@
padding-top: 30px;
}
}
+.inputBox {
+ position: relative;
+}
+.compareChip {
+ position: absolute;
+ top: 20px;
+ left: 20px;
+ @include respond-to(tablet) {
+ top: 11px;
+ left: 13px;
+ }
+}
.input {
gap: 10px;
diff --git a/src/app/compare/page.tsx b/src/app/compare/page.tsx
index e2e5445..7c4f0a8 100644
--- a/src/app/compare/page.tsx
+++ b/src/app/compare/page.tsx
@@ -1,31 +1,102 @@
"use client";
import Image from "next/image";
-import React, { useState } from "react";
+import React, { useEffect, useRef, useState } from "react";
+import { Compare } from "@/components/Chip/Compare/Compare";
import { LOADING_LARGE_IMAGE } from "@/utils/constant";
import styles from "./compare.module.scss";
function ComparePage() {
const [compare, setCompare] = useState(false);
+ const [chips, setChips] = useState<{ product1: string; product2: string }>({ product1: "", product2: "" });
+ const [inputValue1, setInputValue1] = useState("");
+ const [inputValue2, setInputValue2] = useState("");
+ const [isFocused1, setIsFocused1] = useState(false);
+ const [isFocused2, setIsFocused2] = useState(false);
+ const inputRef1 = useRef(null);
+ const inputRef2 = useRef(null);
+
+ useEffect(() => {
+ localStorage.setItem("chips", JSON.stringify(chips));
+ }, [chips]);
+
+ const handleKeyDown = (product: "product1" | "product2") => (e: React.KeyboardEvent) => {
+ if (e.key === "Enter") {
+ e.preventDefault();
+ const value = (e.target as HTMLInputElement).value.trim();
+ if (value !== "") {
+ setChips((prevChips) => ({ ...prevChips, [product]: value }));
+ if (product === "product1") {
+ setInputValue1("");
+ if (inputRef1.current) {
+ inputRef1.current.blur();
+ }
+ } else {
+ setInputValue2("");
+ if (inputRef2.current) {
+ inputRef2.current.blur();
+ }
+ }
+ }
+ }
+ };
+ const removeChip = (product: "product1" | "product2") => () => {
+ setChips((prevChips) => {
+ const newChips = { ...prevChips, [product]: undefined };
+ window.localStorage.setItem("chips", JSON.stringify(newChips));
+ return newChips;
+ });
+ };
return (
상품 1
-
+
+
+ {!isFocused1 && chips.product1 && (
+
+ )}
+
+
setInputValue1(e.target.value)}
+ onFocus={() => setIsFocused1(true)}
+ onBlur={() => setIsFocused1(false)}
+ />
+
상품 2
-
+
+
+ {!isFocused2 && chips.product2 && (
+
+ )}
+
+
setInputValue2(e.target.value)}
+ onFocus={() => setIsFocused2(true)}
+ onBlur={() => setIsFocused2(false)}
+ />
+