-
Notifications
You must be signed in to change notification settings - Fork 5
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
컨벤션 반영 #41
Closed
Closed
컨벤션 반영 #41
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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,2 @@ | ||
export { CheckBox } from "./CheckBox"; | ||
export { CheckBoxGroup } from "./CheckBoxGroup"; |
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,2 @@ | ||
export { Radio } from "./Radio"; | ||
export { RadioButtonGroup } from "./RadioButtonGroup"; |
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,44 @@ | ||
import { css } from "@emotion/react"; | ||
import { useContext } from "react"; | ||
|
||
import { CheckBoxContext } from "./CheckBoxGroup"; | ||
|
||
import ListItemCard from "@/component/common/Card/ListItemCard"; | ||
|
||
type CheckBoxProps = { | ||
value: string; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export function CheckBox({ value, children }: CheckBoxProps) { | ||
const checkboxContext = useContext(CheckBoxContext); | ||
return ( | ||
<ListItemCard variant={checkboxContext?.isChecked(value) ? "theme" : "default"}> | ||
<label | ||
htmlFor={value} | ||
css={css` | ||
font-weight: 600; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100%; | ||
width: 100%; | ||
cursor: pointer; | ||
`} | ||
> | ||
{children} | ||
</label> | ||
<input | ||
type="checkbox" | ||
id={value} | ||
value={value} | ||
onChange={(e) => { | ||
checkboxContext?.onChange && checkboxContext.onChange(e.target.value); | ||
}} | ||
css={css` | ||
display: none; | ||
`} | ||
/> | ||
</ListItemCard> | ||
); | ||
} |
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,27 @@ | ||
import { css } from "@emotion/react"; | ||
import { createContext } from "react"; | ||
|
||
export type CheckBoxContextState = { | ||
isChecked: (value: string) => boolean; | ||
onChange: (value: string) => void; | ||
}; | ||
|
||
export const CheckBoxContext = createContext<CheckBoxContextState | undefined>(undefined); | ||
|
||
type CheckBoxProps = { | ||
children: React.ReactNode; | ||
} & CheckBoxContextState; | ||
|
||
export function CheckBoxGroup({ children, ...props }: CheckBoxProps) { | ||
return ( | ||
<div | ||
css={css` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
`} | ||
> | ||
<CheckBoxContext.Provider value={props}>{children}</CheckBoxContext.Provider> | ||
</div> | ||
); | ||
} |
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,2 @@ | ||
export { CheckBox } from "./CheckBox"; | ||
export { CheckBoxGroup } from "./CheckBoxGroup"; |
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,34 @@ | ||
import { css } from "@emotion/react"; | ||
import { forwardRef, useContext } from "react"; | ||
|
||
import { InputContext } from "./InputLabelContainer"; | ||
|
||
type InputProps = { | ||
width?: string; | ||
} & React.InputHTMLAttributes<HTMLInputElement>; | ||
|
||
export const Input = forwardRef(function ({ id, width = "100%", ...props }: InputProps) { | ||
const inputContext = useContext(InputContext); | ||
return ( | ||
<div> | ||
<div | ||
css={css` | ||
width: ${width}; | ||
border: 1px solid #e3e6ea; // FIXME: 디자인 토큰 적용하기 | ||
border-radius: 0.8rem; | ||
padding: 1.6rem; | ||
`} | ||
> | ||
<input | ||
id={id || inputContext?.id} | ||
css={css` | ||
width: 100%; | ||
`} | ||
{...props} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}); | ||
|
||
Input.displayName = "Input"; |
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,27 @@ | ||
import { css } from "@emotion/react"; | ||
import { createContext } from "react"; | ||
|
||
type InputLabelContainerProps = { | ||
id: string; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const InputContext = createContext<{ id: string } | undefined>(undefined); | ||
|
||
export function InputLabelContainer({ id, children }: InputLabelContainerProps) { | ||
return ( | ||
<InputContext.Provider value={{ id }}> | ||
<div | ||
css={[ | ||
css` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 2rem; | ||
`, | ||
]} | ||
> | ||
{children} | ||
</div> | ||
</InputContext.Provider> | ||
); | ||
} |
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,63 @@ | ||
import { css, Interpolation, Theme } from "@emotion/react"; | ||
import { useContext } from "react"; | ||
|
||
import { InputContext } from "./InputLabelContainer"; | ||
|
||
type LabelProps = { | ||
order?: number; | ||
styles?: Interpolation<Theme>; | ||
} & React.LabelHTMLAttributes<HTMLLabelElement>; | ||
|
||
export function Label({ id, children, order, styles }: LabelProps) { | ||
const inputContext = useContext(InputContext); | ||
|
||
return ( | ||
<label | ||
htmlFor={id || inputContext?.id} | ||
css={ | ||
order | ||
? css` | ||
display: flex; | ||
align-items: center; | ||
gap: 0.8rem; | ||
` | ||
: null | ||
} | ||
> | ||
{order && ( | ||
<div | ||
css={[ | ||
css` | ||
background-color: #212529; // FIXME: 디자인 토큰 적용하기 | ||
width: 2rem; | ||
height: 2rem; | ||
border-radius: 0.4rem; | ||
vertical-align: middle; | ||
text-align: center; | ||
`, | ||
styles, | ||
]} | ||
> | ||
{/* FIXME text 컴포넌트 적용하기 */} | ||
<span | ||
css={css` | ||
color: #fff; | ||
font-size: 1rem; | ||
font-weight: 600; | ||
`} | ||
> | ||
{order} | ||
</span> | ||
</div> | ||
)} | ||
<span | ||
css={css` | ||
font-size: 1.4rem; | ||
font-weight: 600; | ||
`} | ||
> | ||
{children} | ||
</span> | ||
</label> | ||
); | ||
} |
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,3 @@ | ||
export { Input } from "./Input"; | ||
export { Label } from "./Label"; | ||
export { InputLabelContainer } from "./InputLabelContainer"; |
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,45 @@ | ||
import { css } from "@emotion/react"; | ||
import { useContext } from "react"; | ||
|
||
import { RadioContext } from "./RadioButtonGroup"; | ||
|
||
import ListItemCard from "@/component/common/Card/ListItemCard"; | ||
|
||
type RadioProps = { | ||
value: string; | ||
children: React.ReactNode; | ||
}; | ||
|
||
export function Radio({ value, children }: RadioProps) { | ||
const radioContext = useContext(RadioContext); | ||
return ( | ||
<ListItemCard variant={radioContext?.isChecked(value) ? "theme" : "default"}> | ||
<label | ||
htmlFor={value} | ||
css={css` | ||
font-weight: 600; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100%; | ||
width: 100%; | ||
cursor: pointer; | ||
`} | ||
> | ||
{children} | ||
</label> | ||
<input | ||
type="radio" | ||
name={radioContext?.radioName} | ||
id={value} | ||
value={value} | ||
onChange={(e) => { | ||
radioContext?.onChange && radioContext.onChange(e.target.value); | ||
}} | ||
css={css` | ||
display: none; | ||
`} | ||
/> | ||
</ListItemCard> | ||
); | ||
} |
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,28 @@ | ||
import { css } from "@emotion/react"; | ||
import { createContext } from "react"; | ||
|
||
export type RadioContextState = { | ||
radioName: string; | ||
isChecked: (value: string) => boolean; | ||
onChange: (value: string) => void; | ||
}; | ||
|
||
export const RadioContext = createContext<RadioContextState | undefined>(undefined); | ||
|
||
type RadioButtonGroupProps = { | ||
children: React.ReactNode; | ||
} & RadioContextState; | ||
|
||
export function RadioButtonGroup({ children, ...props }: RadioButtonGroupProps) { | ||
return ( | ||
<div | ||
css={css` | ||
display: flex; | ||
flex-direction: column; | ||
gap: 1rem; | ||
`} | ||
> | ||
<RadioContext.Provider value={props}>{children}</RadioContext.Provider> | ||
</div> | ||
); | ||
} |
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,2 @@ | ||
export { Radio } from "./Radio"; | ||
export { RadioButtonGroup } from "./RadioButtonGroup"; |
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
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.
엇 이거 넣으면 파일 명에 변화가 생기는건가?!
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.
아 요게 계속 폴더 대소문자를 구분 못해서 넣어봤는데 파일명 한정어서인지 해도 안되네
근데 이게 내 깃이 대소문자를 구분 못하고 있어서 그랬던 거 같아서 깃 설정하고 새로 브랜치 파서 다시 pr 올릴게!