-
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.
refactor: Editor와 VideoList컴포넌트에 중복적으로 존재하던 코드를 LogoSelect 컴포넌트로 코드 리…
…펙토링함
- Loading branch information
1 parent
3a3fa7c
commit b1bd101
Showing
37 changed files
with
614 additions
and
210 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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 |
---|---|---|
@@ -1,7 +1,16 @@ | ||
import "./css/Button.css"; | ||
import { motion } from "motion/react"; | ||
|
||
const Button = ({ text, type, onClick }) => { | ||
return <button onClick={onClick} className={`Button Button_${type}`}>{text}</button> | ||
return ( | ||
<motion.button | ||
whileHover={{ scale: 1.1 }} | ||
whileTap={{ scale: 0.95 }} | ||
onClick={onClick} | ||
className={`Button Button_${type}`}> | ||
{text} | ||
</motion.button> | ||
) | ||
} | ||
|
||
export default Button; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import './css/LogoSelector.css' | ||
import LogoItem from './LogoItem' | ||
import { LogoList } from '../utils/constants' | ||
|
||
const LogoSelector = ({ selectedLogo, onLogoSelect }) => { | ||
return ( | ||
<div className="LogoSelector"> | ||
{ | ||
LogoList.map((company, index) => { | ||
return ( | ||
<LogoItem | ||
key={index} | ||
isSelected={company.logoName === selectedLogo} | ||
onClick={() => onLogoSelect(company.logoName)} | ||
logoId={company.logoId} | ||
/> | ||
) | ||
}) | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
export default LogoSelector |
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,22 @@ | ||
import Button from "./Button"; | ||
import { useNavigate } from 'react-router-dom' | ||
import './css/MenuBar.css' | ||
import Select from './Select' | ||
|
||
const MenuBar = ({ onChange }) => { | ||
const nav = useNavigate(); | ||
|
||
const handleSelectChange = (selectedOption) => { | ||
onChange({ target: { value: selectedOption.value } }); | ||
} | ||
|
||
return ( | ||
<div className="MenuBar"> | ||
<Select onChange={handleSelectChange} /> | ||
<Button text={"새 지식 쓰기"} type={"POSITIVE"} onClick={() => nav("/new")} /> | ||
<Button text={"영상 글쓰기"} type={"POSITIVE"} onClick={() => nav("/video")} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default MenuBar |
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,35 @@ | ||
import ReactSelect from 'react-select' | ||
|
||
const options = [ | ||
{ value: 'latest', label: '최신순' }, | ||
{ value: 'oldest', label: '오래된 순' }, | ||
] | ||
|
||
const customStyles = { | ||
option: (provided, state) => ({ | ||
...provided, | ||
fontWeight: state.isSelected ? "bold" : "normal", | ||
backgroundColor: state.isSelected ? 'rgb(49, 130, 239)' : 'white', | ||
}), | ||
control: (provided) => ({ | ||
...provided, | ||
width: 120 | ||
}), | ||
singleValue: (provided, state) => ({ | ||
...provided, | ||
fontSize: state.selectProps.myFontSize | ||
}) | ||
}; | ||
|
||
const Select = ({ onChange }) => { | ||
return ( | ||
<ReactSelect | ||
styles={customStyles} | ||
onChange={onChange} | ||
options={options} | ||
defaultValue={options[0]} | ||
/> | ||
) | ||
} | ||
|
||
export default Select |
This file was deleted.
Oops, something went wrong.
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
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,6 @@ | ||
.LogoSelector { | ||
display: flex; | ||
justify-content: center; | ||
gap: 16px; | ||
margin: 20px 0; | ||
} |
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,10 @@ | ||
.MenuBar { | ||
margin: 20px 0px; | ||
display: flex; | ||
gap: 10px; | ||
align-items: center; | ||
} | ||
|
||
.MenuBar Button { | ||
flex : 1; | ||
} |
Oops, something went wrong.