-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT] 문의 작성 페이지 마크업 #64
Merged
The head ref may contain hidden characters: "50-feat-\uBB38\uC758-\uC791\uC131-\uD398\uC774\uC9C0-\uB9C8\uD06C\uC5C5"
Merged
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d352edc
문의 작성 페이지 마크업
aha-rin f57de4b
문의 작성 페이지 마크업
aha-rin 1d0cec1
문의 작성 페이지 마크업
aha-rin 9a23430
문의 작성 페이지 마크업
aha-rin 75f1734
리뷰 관리 기능 추가
aha-rin 5b931b0
드롭다운 관리 방식 수정
aha-rin 2ec13a1
임시
aha-rin 30d8bf7
충돌 해결
aha-rin 6c2833e
Merge branch 'develop' into 50-feat-문의-작성-페이지-마크업
aha-rin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import App from './App'; | ||
|
||
test('renders learn react link', () => { | ||
render(<App />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import { IoIosArrowDown } from "react-icons/io"; | ||
|
||
const Accordion = ({ title, children, isOpen, onToggle }) => { | ||
return ( | ||
<AccordionContainer> | ||
<AccordionHeader onClick={onToggle} isOpen={isOpen}> | ||
<div><span>Q.</span><p>{title}</p></div> | ||
<Arrow isOpen={isOpen}><IoIosArrowDown /></Arrow> | ||
</AccordionHeader> | ||
{isOpen && <AccordionContent>{children}</AccordionContent>} | ||
</AccordionContainer> | ||
); | ||
}; | ||
|
||
export default Accordion; | ||
|
||
const AccordionContainer = styled.div` | ||
border-bottom: 1px solid #ddd; | ||
font-size: 16px; | ||
|
||
&:first-of-type { | ||
border-top: 1px solid #ddd; /* 첫 번째 박스만 위쪽 선 표시 */ | ||
} | ||
`; | ||
|
||
const AccordionHeader = styled.div` | ||
background-color: #ffffff; | ||
padding: 22px 15px; | ||
cursor: pointer; | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
color: #000000; | ||
|
||
div { | ||
display: flex; | ||
gap: 8px; | ||
} | ||
|
||
span { | ||
font-weight: 600; | ||
color: ${(props) => (props.isOpen ? "#D90000" : "#000000")}; | ||
} | ||
`; | ||
|
||
const Arrow = styled.span` | ||
transform: rotate(${(props) => (props.isOpen ? "180deg" : "0deg")}); | ||
transition: transform 0.3s ease; | ||
`; | ||
|
||
const AccordionContent = styled.div` | ||
padding: 22px 42px; | ||
background-color: #f9f9f9; | ||
border-top: 1px solid #ddd; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import React, { useState } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
const AccordionTable = ({ data }) => { | ||
const [openIndex, setOpenIndex] = useState(null); // 열려 있는 행의 인덱스 | ||
|
||
const toggleAccordion = (index) => { | ||
const selectedItem = data[index]; | ||
if (!selectedItem.response) { | ||
// 답변이 없는 경우 alert 창 표시 | ||
alert('문의 답변은 2-3일 정도 소요됩니다. 조금만 기다려 주세요!'); | ||
return; | ||
} | ||
// 답변이 있는 경우 아코디언 열기 | ||
setOpenIndex(openIndex === index ? null : index); | ||
}; | ||
|
||
return ( | ||
<TableContainer> | ||
<Table> | ||
<thead> | ||
<tr> | ||
<th>문의일</th> | ||
<th>문의 유형</th> | ||
<th>문의 제목</th> | ||
<th>처리 상태</th> | ||
<th>답변일</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{data.map((item, index) => ( | ||
<React.Fragment key={index}> | ||
<tr onClick={() => toggleAccordion(index)}> | ||
<td>{item.date}</td> | ||
<td>{item.type}</td> | ||
<td>{item.title}</td> | ||
<td>{item.status}</td> | ||
<td>{item.answerDate !== '-' ? item.answerDate : '-'}</td> | ||
</tr> | ||
{openIndex === index && ( | ||
<tr> | ||
<td colSpan="5"> | ||
<AccordionContent>{item.response}</AccordionContent> | ||
</td> | ||
</tr> | ||
)} | ||
</React.Fragment> | ||
))} | ||
</tbody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
}; | ||
|
||
|
||
export default AccordionTable; | ||
|
||
const TableContainer = styled.div` | ||
width: 100%; | ||
overflow-x: auto; | ||
`; | ||
|
||
const Table = styled.table` | ||
width: 100%; | ||
border-collapse: collapse; | ||
margin: 5px 0; | ||
font-size: 16px; | ||
|
||
th, | ||
td { | ||
border: 1px solid #ddd; | ||
text-align: left; | ||
padding: 8px; | ||
} | ||
|
||
th { | ||
background-color: #f4f4f4; | ||
} | ||
|
||
tr { | ||
cursor: pointer; | ||
} | ||
|
||
tr:hover { | ||
background-color: #f9f9f9; | ||
} | ||
`; | ||
|
||
const AccordionContent = styled.div` | ||
padding: 10px; | ||
background-color: #f9f9f9; | ||
border: 1px solid #ddd; | ||
border-radius: 5px; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,4 +96,4 @@ const DropdownItem = styled.div` | |
} | ||
`; | ||
|
||
export default Dropdown; | ||
export default Dropdown; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
대-소로 이어지는 종속성을 어떻게 부여해야 할지 모르겠어서 selectedOprion을 통해서 부모-자식으로 관리했는데, 올려주셨던 드롭다운 파일 수정 없이 key를 통해서 하는 방식으로 수정 하였습니다!