Skip to content

Commit

Permalink
Merge pull request #25 from primus-teoSprint/feat/#7
Browse files Browse the repository at this point in the history
[#7][#23] step3 ํŽ˜์ด์ง€ ui ๋ฐ ์ถ”๊ฐ€์„ค๋ช… ํ† ๊ธ€์ฐฝ ๊ตฌํ˜„ / ์ ๊ทน์  ํˆฌ์ž์ง€ํ‘œ ์ปดํฌ๋„ŒํŠธ ๊ตฌํ˜„
  • Loading branch information
03hoho03 authored Apr 7, 2024
2 parents e26c30a + 796f34c commit 3b0a970
Show file tree
Hide file tree
Showing 12 changed files with 415 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
.item_container {
display: flex;
/* justify-content: space-between; */
justify-content: center;
margin-bottom: 8px;
}
.item_input_wrapper {
display: flex;
}
.input {
all: unset;
font-size: 12px;
padding: 8px;
border: 1px solid #CDCDCD;
border-radius: 4px;
}
.item_name_input {
width: 100px;
margin-right: 16px;
}
.score_container {
margin-right: 16px;
}
.score_container > span {
font-size: 14px;
font-weight: bold;
}
.item_score_input {
width: 40px;
margin-right: 4px;
}
.delete_btn {
padding: 4px 8px;
background-color: rgb(248, 64, 64);
color: #ffffff;
font-size: 12px;
border-radius: 8px;
}

.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
'use client'

import React, { useState } from 'react'
import S from './index.module.css'
import cn from 'classnames'
import { useRecoilState } from 'recoil'
import investmentItemAtom, { ActiveInvestmentItemType } from '@/app/_store/atom'

interface ActiveInvestmentItemProps {
item: ActiveInvestmentItemType
}

function ActiveInvestmentItem({ item }: ActiveInvestmentItemProps) {
const [investmentItem, setInvestmentItem] = useRecoilState(investmentItemAtom)
const [itemName, setItemName] = useState(item?.name ?? '')
const [itemScore, setItemScore] = useState(item?.score ?? 0)

const handleDeleteItem = () => {
if (investmentItem.length <= 1) {
return
}

setInvestmentItem((prev) => {
const next = prev.filter(
(investmentItem) => investmentItem.id !== item.id,
)
console.log(next)

return next
})
}

const handleChangeNameInput = (e: any) => {
const { value } = e.target
setItemName(value)

setInvestmentItem((prev) =>
prev.map((investmentItem) =>
investmentItem.id === item.id
? { ...item, name: value }
: investmentItem,
),
)
}
const handleChangeScoreInput = (e: any) => {
const { value } = e.target
setItemScore(value)

setInvestmentItem((prev) =>
prev.map((investmentItem) =>
investmentItem.id === item.id
? { ...item, name: value }
: investmentItem,
),
)
}

return (
<div className={S.item_container}>
<div className={S.item_input_wrapper}>
<input
className={cn(S.item_name_input, S.input)}
placeholder="์•„์ดํ…œ1"
value={itemName}
onChange={(e) => handleChangeNameInput(e)}
/>
<div className={S.score_container}>
<input
className={cn(S.item_score_input, S.input)}
type="number"
placeholder="2"
value={itemScore}
onChange={(e) => handleChangeScoreInput(e)}
/>
<span>์ </span>
</div>
</div>
<button className={S.delete_btn} onClick={handleDeleteItem}>
์‚ญ์ œ
</button>
</div>
)
}

export default ActiveInvestmentItem
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use client'

import React from 'react'
import S from './index.module.css'
import ActiveInvestmentItem from '../ActiveInvestmentItem'
import { useRecoilValue } from 'recoil'
import investmentItemAtom from '@/app/_store/atom'

function ActiveInvestmentList() {
const investmentItem = useRecoilValue(investmentItemAtom)

return (
<div className={S.main}>
{investmentItem.map((item) => {
return <ActiveInvestmentItem key={item.id} item={item} />
})}
</div>
)
}

export default ActiveInvestmentList
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.btn {
font-size: 12px;
background-color: var(--purple-700);
color: #FFFFFF;
border-radius: 4px;
padding: 4px 8px;
height: 20px;
}
27 changes: 27 additions & 0 deletions app/(route)/verification/ibulsin/_components/ItemAddBtn/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use client'

import React from 'react'
import S from './index.module.css'
import { useSetRecoilState } from 'recoil'
import investmentItemAtom, { ActiveInvestmentItemType } from '@/app/_store/atom'

function ItemAddBtn() {
const setInvestmentItem = useSetRecoilState(investmentItemAtom)

const handleAddItem = () => {
const newItem: ActiveInvestmentItemType = {
id: new Date().toISOString(),
name: '',
score: 0,
}
setInvestmentItem((prev) => [...prev, newItem])
}

return (
<button type="button" className={S.btn} onClick={handleAddItem}>
์ถ”๊ฐ€
</button>
)
}

export default ItemAddBtn
Original file line number Diff line number Diff line change
@@ -1,39 +1,22 @@
import React from 'react'
import S from './index.module.css'
import { explainData } from '@/app/_constants/ibulsin'

interface MoreExplainToggleProps {
type: string
}

function MoreExplainToggle({ type }: MoreExplainToggleProps) {
const filteredData = explainData.filter(
(explainItem) => explainItem.type === type,
)
return (
<div className={S.toggle_container}>
{type === 'marketResponse' && (
<p>
์•„์ด๋””์–ด: ๋„ทํ”Œ๋ฆญ์Šค(์ดˆ๊ธฐ DVD ๊ธฐ๋ฐ˜ ๋ชจ๋ธ)
<br />
<br />
์‹œ์žฅํ˜ธ์‘๊ฐ€์„ค: ์šฐํŽธ ๋ฐฐ์†ก ๊ธฐ๋ฐ˜์˜ DVD ๋Œ€์—ฌ ์„œ๋น„์Šค๋ฅผ ์›”์ •์•ก ์š”๊ธˆ์ œ, ๋ฐ˜๋‚ฉ
์ง€์—ฐ ๊ณผํƒœ๋ฃŒ ๋ฌด๋ฃŒ ์ •์ฑ…๊ณผ ๊ฒฐํ•ฉํ•˜์—ฌ ๋งŽ์€ ์‚ฌ๋žŒ๋“ค์ด ๋น„๋””์˜ค ๊ฐ€๊ฒŒ๋ฅผ ์ด์šฉํ•˜๋Š”
๋Œ€์‹  ์šฐ๋ฆฌ ์„œ๋น„์Šค์— ๊ฐ€์ž…ํ•  ๊ฒƒ์ด๋‹ค.
<br />
<br />
์ด์™€๊ฐ™์ด ์‹œ์žฅ์ด ์šฐ๋ฆฌ์˜ ์ œํ’ˆ์ด๋‚˜ ์„œ๋น„์Šค๋ฅผ ์–ด๋–ป๊ฒŒ ๋ฐ›์•„๋“ค์ด์ง€์— ๋Œ€ํ•ด
์ •ํ™•ํ•œ ์ •์˜๋ฅผ ๋‚ด๋ฆฌ๊ณ , ํ•ด๋‹น ์‹œ์žฅ ์ˆ˜์š”๊ฐ€ ์กด์žฌํ•œ๋‹ค๋Š” ์ฆ๊ฑฐ๋ฅผ ์ฐพ์•„๋‚ด๋Š” ๊ฒƒ์ด
์‹œ์žฅํ˜ธ์‘๊ฐ€์„ค์ด ํ•ด์•ผ ํ•  ์ผ์ด์—์š”.
</p>
)}
{type === 'XYZ' && (
<p>
X๋Š” ํ‘œ์ ์‹œ์žฅ์˜ ๋ช‡ ํผ์„ผํŠธ๋ฅผ ์ฐจ์ง€ํ•  ์ˆ˜ ์žˆ์„์ง€, Y๋Š” ์–ด๋–ค ํ‘œ์ ์‹œ์žฅ์— ๋Œ€ํ•œ,
Z๋Š” ํ‘œ์  ์‹œ์žฅ์ด ์ œํ’ˆ์— ๋Œ€ํ•ด ์–ด๋–ค ๋ฐฉ์‹์œผ๋กœ ์–ด๋Š ๋ฒ”์œ„๊นŒ์ง€ ํ˜ธ์‘ ํ•  ๊นŒ๋ฅผ
์˜๋ฏธํ•ด์š”
<br />
<br />
์˜ˆ์ œ: ์ ์–ด๋„ 10%์˜ ๋Œ€๊ธฐ์งˆ ์ง€์ˆ˜๊ฐ€ 100 ์ด์ƒ์ธ ๋„์‹œ์— ์‚ฌ๋Š” ์‚ฌ๋žŒ๋“ค์€
120๋‹ฌ๋Ÿฌ ์งœ๋ฆฌ ํœด๋Œ€์šฉ ์˜ค์—ผ ํƒ์ง€๊ธฐ๋ฅผ ๊ตฌ๋งคํ•  ๊ฒƒ์ด๋‹ค.
{filteredData.map((explainItem, idx) => (
<p key={idx} style={{ whiteSpace: 'pre-line' }}>
{explainItem.content}
</p>
)}
))}
</div>
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.main_container {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.flex_between_wrapper {
display: flex;
justify-content: space-between;
align-items: center;
}
.flex_wrapper {
display: flex;
align-items: center;
}
.step_info {
color: #FFFFFF;
margin: 24px;
margin-bottom: 32px;
}
.step_info > h3 {
padding: 12px 0;
font-weight: 500;
font-size: 24px;
}
.step_info > p {
font-size: 24px;
}
.survey_container {
background-color: #FFFFFF;
border-top-left-radius: 8px;
border-top-right-radius: 8px;
padding: 12px;
}
.input_container {
margin-bottom: 8px;
}
.input_title_container {
display: flex;
align-items: center;
}
.input_title {
font-size: 16px;
padding:12px 0;
margin-right: 8px;
}
.input_explain {
font-size: 12px;
margin-bottom: 8px;
}
.direction_btns {
display: flex;
align-items: center;
justify-content: center;
}
.direction_btns > a {
margin: 0 8px;
}
.prev_btn {
background-color: #FFFFFF;
padding: 12px 20px;
font-size: 14px;
font-weight: bold;
border: 1px solid #DCDCDC;
border-radius: 8px;
}
.next_btn {
background-color: var(--purple-700);
color: #FFFFFF;
padding: 12px 20px;
font-size: 14px;
font-weight: bold;
border-radius: 8px;
}
55 changes: 54 additions & 1 deletion app/(route)/verification/ibulsin/_components/Step3/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,62 @@

import React from 'react'
import S from './index.module.css'
import Link from 'next/link'
import Textarea from '../Textarea'
import MoreExplainBtn from '../MoreExplainBtn'
import { ibulsinVariants } from '@/app/_constants/ibulsin'

function Step3() {
return <div className={S.main}>hello</div>
const { xyz, pretotyping } = ibulsinVariants

return (
<div className={S.main_container}>
<div className={S.step_info}>
<h3 className={S.step}>STEP 3</h3>
<p className={S.step_explain}>
xyz ๊ฐ€์„ค๊ณผ ์ ๊ทน์  ํˆฌ์ž์ง€ํ‘œ๋ฅผ
<br />
์„ธ์›Œ๋ณด์•„์š”.
</p>
</div>
<div className={S.survey_container}>
<div className={S.input_container}>
<div className={S.input_title_container}>
<h3 className={S.input_title}>xyz ๊ฐ€์„ค</h3>
<MoreExplainBtn type={xyz} />
</div>
<p className={S.input_explain}>
XYZ ๋ฒ•์น™์œผ๋กœ ํ‘œํ˜„๋œ ์‹œ์žฅ ํ˜ธ์‘ ๊ฐ€์„ค์˜ ๋ฒ”์œ„๋ฅผ ์ž˜๊ฒŒ ์ชผ๊ฐœ xyz๋ฒ•์น™์œผ๋กœ
ํ‘œํ˜„ํ•ด๋ณด์„ธ์š”.
</p>
<Textarea fieldKey={xyz} />
</div>
<div className={S.input_container}>
<div className={S.flex_between_wrapper}>
<div className={S.flex_wrapper}>
<h3 className={S.input_title}>ํ”„๋กœํ†  ํƒ€์ดํ•‘ ๊ณ„ํš</h3>
<MoreExplainBtn type={pretotyping} />
</div>
</div>
<p className={S.input_explain}>
{`xyz๊ฐ€์„ค๋กœ ํ‘œํ˜„๋œ ์‹œ์žฅ ํ˜ธ์‘ ๊ฐ€์„ค์„ ๋น ๋ฅด๊ฒŒ ์ ์€ ๋น„์šฉ์œผ๋กœ ํ…Œ์ŠคํŠธ๋ฅผ
์‹œ๋„ํ•ด๋ณด๋Š” ๊ฒƒ์„ 'ํ”„๋ฆฌํ† ํƒ€์ดํ•‘' ์ด๋ผ๊ตฌํ•ด์š”. ์‹œ์ œํ’ˆ์„ ์˜๋ฏธํ•˜๋Š” ํ”„๋กœํ† ํƒ€์ž…๊ณผ๋Š”
๋‹ค๋ฅด๊ฒŒ ์‹œ์ œํ’ˆ์ด ์—†์–ด๋„ ๋‹ค๋ฅธ ๋ฐฉ๋ฒ•์„ ๋งŒ๋“ค์–ด ๊ฐ€์„ค์„ ํ™•์ธํ•˜๋Š” ํ…Œ์ŠคํŠธ ๋ฐฉ๋ฒ•์ด์—์š”.
`}
</p>
<Textarea fieldKey={pretotyping} />
</div>
<div className={S.direction_btns}>
<Link className={S.prev_btn} href={'/verification/ibulsin?step=2'}>
์ด์ „ ๋‹จ๊ณ„
</Link>
<button className={S.next_btn} type="button">
์ œ์ถœ ํ•˜๊ธฐ
</button>
</div>
</div>
</div>
)
}

export default Step3
Loading

0 comments on commit 3b0a970

Please sign in to comment.