Skip to content

Commit

Permalink
fix: checkBox size 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jikwan0327 committed Mar 26, 2023
1 parent 0a311d3 commit 6261d35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/components/checkBox/Box.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import styled, { css } from 'styled-components';
interface PropsType {
disabled?: boolean;
status: boolean;
size?: number;
}

export const Box = ({ disabled, status }: PropsType) => {
export const Box = ({ size, disabled, status }: PropsType) => {
return (
<_Wrapper disabled={disabled} status={status}>
<_Wrapper size={size} disabled={disabled} status={status}>
{status && (
<svg
width="15"
Expand All @@ -29,8 +30,8 @@ const _Wrapper = styled.span<PropsType>`
justify-content: center;
float: left;
border-radius: 2px;
width: 24px;
height: 24px;
width: ${({ size }) => `${size}px`};
height: ${({ size }) => `${size}px`};
${({ status, disabled, theme }) => {
const { gray2, primaryLighten1, gray3, gray5, primary } = theme.color;
if (status && disabled) {
Expand Down
6 changes: 5 additions & 1 deletion src/components/checkBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ interface PropsType extends marginCssType {
disabled?: boolean;
label?: string;
status: boolean;
size?: number;
onChange: (status: boolean) => void;
}

Expand All @@ -19,6 +20,7 @@ export const CheckBox = ({
label,
status,
onChange,
size = 24,
margin,
}: PropsType) => {
return (
Expand All @@ -28,7 +30,7 @@ export const CheckBox = ({
onClick={() => !disabled && onChange(!status)}
margin={margin}
>
<Box status={status} disabled={disabled} />
<Box size={size} status={status} disabled={disabled} />
{label && <Label label={label} disabled={disabled} />}
</_Wrapper>
);
Expand All @@ -39,6 +41,8 @@ interface WrapperProps extends marginCssType {
}

const _Wrapper = styled.div<WrapperProps>`
display: flex;
align-items: center;
cursor: ${({ disabled }) => (disabled ? 'no-drop' : 'pointer')};
${({ margin }) => marginToCss({ margin })};
`;

0 comments on commit 6261d35

Please sign in to comment.