-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
granen32
authored and
granen32
committed
Sep 9, 2023
1 parent
46c4ccb
commit 144e52d
Showing
16 changed files
with
380 additions
and
12 deletions.
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,83 @@ | ||
import React, { useRef } from 'react'; | ||
import { styled } from 'styled-components'; | ||
|
||
interface Option { | ||
value: string; | ||
label: string; | ||
} | ||
interface SelectOptionProps { | ||
selectedValue: string | undefined; | ||
onSelect: (value: string) => void; | ||
options: Option[]; | ||
optionStyle?: React.CSSProperties; | ||
selectedOptionStyle?: React.CSSProperties; | ||
placeholder: string | undefined; | ||
} | ||
const CustomSelect = styled.div` | ||
position: relative; | ||
max-width: 240px; | ||
font-size: 0; | ||
display: flex; | ||
`; | ||
const Select = styled.select` | ||
width: 100%; | ||
height: 3rem; | ||
font-size: 1rem; | ||
padding-left: 2rem; | ||
border: 1px solid#dddddd; | ||
border-radius: 1rem; | ||
box-sizing: border-box; | ||
background-color: #fff; | ||
color: #939393; | ||
-webkit-appearance: none; | ||
-moz-appearance: none; | ||
appearance: none; | ||
`; | ||
const IconSVG = styled.svg` | ||
margin-left: -44px; | ||
align-self: center; | ||
width: 32px; | ||
height: 32px; | ||
`; | ||
const StyledOption = styled.option<{ isSelected: boolean }>` | ||
cursor: pointer; | ||
background-color: ${(props) => (props.isSelected ? 'lightblue' : 'white')}; | ||
font-weight: ${(props) => (props.isSelected ? 'bold' : 'normal')}; | ||
`; | ||
|
||
const SelectOption: React.FC<SelectOptionProps> = ({ selectedValue, onSelect, options, placeholder }) => { | ||
const containerRef = useRef<HTMLDivElement>(null); | ||
return ( | ||
<Container ref={containerRef}> | ||
<CustomSelect> | ||
<Select placeholder={placeholder}> | ||
{options.map((option) => ( | ||
<StyledOption | ||
key={option.value} | ||
value={option.value} | ||
isSelected={selectedValue === option.value} | ||
onMouseEnter={() => onSelect(option.value)} | ||
> | ||
{option.label} | ||
</StyledOption> | ||
))} | ||
</Select> | ||
<IconSVG width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M16.7425 21.1716C16.3452 21.614 15.6519 21.614 15.2545 21.1716L8.83648 14.0253C8.25832 13.3816 8.7152 12.3571 9.58047 12.3571L22.4166 12.3571C23.2819 12.3571 23.7388 13.3816 23.1606 14.0253L16.7425 21.1716Z" | ||
fill="#4EC1BF" | ||
/> | ||
</IconSVG> | ||
</CustomSelect> | ||
</Container> | ||
); | ||
}; | ||
|
||
export default SelectOption; | ||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
position: relative; | ||
width: 100%; | ||
margin-bottom: 1rem; | ||
`; |
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
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
2 changes: 1 addition & 1 deletion
2
src/pages/breeders/[id].tsx โ src/pages/mypage/breeders/[id].tsx
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
File renamed without changes.
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 @@ | ||
export { default as Reviews } from './reviews'; |
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,85 @@ | ||
import Pagination from 'components/common/board/Pagination'; | ||
import Button, { ButtonSize } from 'components/common/button/Button'; | ||
import SearchInput from 'components/common/search/SearchInput'; | ||
import MypageLayout from 'layout/MypageLayout'; | ||
import { API_PATHS } from '@constants'; | ||
import { Link } from 'react-router-dom'; | ||
import { useMemo, useState } from 'react'; | ||
import { Page } from 'pageable-response'; | ||
import MypageForm from 'layout/MypageForm'; | ||
import SelectOption from 'components/common/select/OptionsSelected'; | ||
interface Option { | ||
value: string; | ||
label: string; | ||
} | ||
const options: Option[] = [ | ||
{ value: '์ ์ฒด', label: '์ ์ฒด' }, | ||
{ value: '๊ฒฌ์ข ', label: '๊ฒฌ์ข ' }, | ||
{ value: '์ ๋ชฉ', label: '์ ๋ชฉ' }, | ||
{ value: '๊ฐ์์ง ์ด๋ฆ', label: '๊ฐ์์ง ์ด๋ฆ' }, | ||
]; | ||
const Reviews = () => { | ||
const [page, setPage] = useState(1); | ||
const [pageInfo, setPageInfo] = useState<Page>({ | ||
totalPages: 0, | ||
first: false, | ||
last: false, | ||
number: 0, | ||
}); | ||
const [selectedOption, setSelectedOption] = useState<string | undefined>(undefined); | ||
const handleOptionSelect = (value: string) => { | ||
setSelectedOption(value); | ||
}; | ||
return ( | ||
<MypageLayout> | ||
<MypageForm> | ||
<MypageLayout.ContentsHeaders | ||
style={{ | ||
marginBottom: '4rem', | ||
}} | ||
> | ||
<MypageLayout.Label>๋ถ์ํ๊ธฐ ๊ด๋ฆฌ</MypageLayout.Label> | ||
<SelectOption | ||
placeholder="์ ํํด์ฃผ์ธ์" | ||
selectedValue={selectedOption} | ||
onSelect={handleOptionSelect} | ||
options={options} | ||
/> | ||
<SearchInput placeholder="๊ฒ์์ด๋ฅผ ์ ๋ ฅํด์ฃผ์ธ์." onSearch={(v) => console.log(v)} /> | ||
</MypageLayout.ContentsHeaders> | ||
<MypageLayout.Content | ||
style={{ | ||
display: 'grid', | ||
gridTemplateColumns: 'repeat(4, 1fr)', | ||
gridTemplateRows: 'repeat(2, 1fr)', | ||
gap: '3rem', | ||
marginBottom: '6rem', | ||
}} | ||
></MypageLayout.Content> | ||
<MypageLayout.Footer> | ||
<Pagination | ||
style={{ | ||
alignSelf: 'center', | ||
}} | ||
currentpage={page} | ||
totalPage={pageInfo.totalPages} | ||
onChange={(page) => setPage(page)} | ||
/> | ||
<Link | ||
to="" | ||
style={{ | ||
position: 'absolute', | ||
right: 0, | ||
}} | ||
> | ||
<Button buttonSize={ButtonSize.MEDIUM} style={{ fontSize: 18 }}> | ||
์ถ๊ฐ | ||
</Button> | ||
</Link> | ||
</MypageLayout.Footer> | ||
</MypageForm> | ||
</MypageLayout> | ||
); | ||
}; | ||
|
||
export default Reviews; |
Empty file.
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,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "./src", | ||
"paths": { | ||
"~/*": ["./*"], | ||
"@constants": ["constants.ts"], | ||
} | ||
} | ||
} |
Oops, something went wrong.