Skip to content
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

style: CountNumber 공통 컴포넌트 제작 #38

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/components/CountNumber.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import styled from '@emotion/styled'

type CountNumberProps = {
currentLength: number
maxLength: number
color: string
right: number
}

type StyleCountNumberProps = {
color: string
right: number
}

const CountNumber = ({ right, currentLength, maxLength, color }: CountNumberProps): JSX.Element => {
return (
<StyleCountNumber
right={right}
color={color}
>{`${currentLength}/${maxLength}`}</StyleCountNumber>
)
}

const StyleCountNumber = styled.span<StyleCountNumberProps>`
position: relative;
right: ${(props) => props.right}px;
bottom: 3px;
font-size: 12px;
color: ${(props) => props.color};
`

export default CountNumber
33 changes: 20 additions & 13 deletions src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,35 @@ const Input = ({
}: InputProps) => {
return (
<>
<StyleInput
placeholder={placeholder}
placeholderSize={placeholderSize}
placeholderColor={placeholderColor}
width={width}
height={height}
borderColor={borderColor}
borderWidth={borderWidth}
inputTextColor={inputTextColor}
inputTextSize={inputTextSize}
inputBackgroundColor={inputBackgroundColor}
borderRadius={borderRadius}
></StyleInput>
<InputWrapper>
<StyleInput
placeholder={placeholder}
placeholderSize={placeholderSize}
placeholderColor={placeholderColor}
width={width}
height={height}
borderColor={borderColor}
borderWidth={borderWidth}
inputTextColor={inputTextColor}
inputTextSize={inputTextSize}
inputBackgroundColor={inputBackgroundColor}
borderRadius={borderRadius}
></StyleInput>
</InputWrapper>
</>
)
}

const InputWrapper = styled.div`
position: relative;
`

const StyleInput = styled.input<InputProps>`
::placeholder {
font-size: ${(props) => props.placeholderSize};
color: ${(props) => props.placeholderColor};
}
position: relative;
placeholder: ${(props) => props.placeholder};
width: ${(props) => props.width};
height: ${(props) => props.height};
Expand Down