Skip to content

Commit

Permalink
refactor: Button, TextInput style overriding을 위해 className 추가, TextIn…
Browse files Browse the repository at this point in the history
…put width 변경
  • Loading branch information
imdaxsz committed Aug 26, 2023
1 parent e174438 commit 3faf41b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface ButtonProps extends ComponentProps<"button"> {
readonly size?: Size;
readonly isBlock?: boolean;
readonly icon?: React.ReactNode;
readonly className?: string;
}

export default function Button({
Expand All @@ -27,6 +28,7 @@ export default function Button({
isBlock = false,
icon,
children,
className = "",
...props
}: ButtonProps) {
const isIconOnly = icon !== undefined && !children;
Expand All @@ -38,6 +40,7 @@ export default function Button({
color={color}
size={size}
type={type}
className={className}
{...props}
>
<IconWrapper>{icon}</IconWrapper>
Expand All @@ -53,6 +56,7 @@ export default function Button({
size={size}
type={type}
isBlock={isBlock}
className={className}
{...props}
>
<ContentWrapper>
Expand Down
4 changes: 3 additions & 1 deletion src/components/TextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Message, TextInputBox, TextInputContainer } from "./style";
export interface TextInputProps extends ComponentProps<"input"> {
readonly warn?: boolean;
readonly message?: string;
readonly className?: string;
}

export interface TextInputBoxProps extends ComponentProps<"input"> {
Expand All @@ -15,10 +16,11 @@ export default function TextInput({
warn = false,
message = "",
style,
className = "",
...rest
}: TextInputProps) {
return (
<TextInputContainer style={style}>
<TextInputContainer style={style} className={className}>
<TextInputBox warn={warn} {...rest}></TextInputBox>
{warn && message !== "" && <Message>{message}</Message>}
</TextInputContainer>
Expand Down
4 changes: 2 additions & 2 deletions src/components/TextInput/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const TextInputBox = styled.input<TextInputBoxProps>`
return css`
${theme.typo["body-2-r"]};
display: flex;
width: 328px;
width: 100%;
height: 40px;
padding: 0px 1rem;
justify-content: space-between;
Expand Down Expand Up @@ -52,5 +52,5 @@ export const Message = styled.div`
`;

export const TextInputContainer = styled.div`
width: fit-content;
width: 328px;
`;

0 comments on commit 3faf41b

Please sign in to comment.