Skip to content

Commit

Permalink
Feature/#193 radio 컴포넌트 텍스트 사이즈 변경 (#195)
Browse files Browse the repository at this point in the history
* design : StyledRadio text size

#193

* design : StyledRadio dot과텍스트 사이거리 1로 수정

#193

* design : StyledRadioGroup spacing 추가

#193
  • Loading branch information
jasper200207 authored Apr 11, 2024
1 parent a19e303 commit 4bd9f1a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/StyledRadio/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const StyledRadio = (props: StyledRadioProps) => {
justify="center"
w={6}
h={6}
mr={3}
mr={1}
borderWidth="3px"
borderColor={color.orange_light}
borderRadius="full"
Expand Down Expand Up @@ -55,7 +55,7 @@ const StyledRadio = (props: StyledRadioProps) => {
}}
bgColor={color.orange_light}
>
<Text p="3" textColor="white" {...textStyles.bold_xl}>
<Text px="6" textColor="white" {...textStyles.bold_md}>
{props.children}
</Text>
</Flex>
Expand Down
15 changes: 12 additions & 3 deletions src/components/StyledRadioGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ import { Flex, HStack, useRadioGroup, Text } from '@chakra-ui/react';
import { StyledRadioGroupProps } from '@/components/StyledRadioGroup/types';
import textStyles from '@/theme/foundations/textStyles';

const StyledRadioGroup = ({ title, name, defaultValue, value, onChange, children, w }: StyledRadioGroupProps) => {
const StyledRadioGroup = ({
title,
name,
defaultValue,
value,
onChange,
children,
w,
spacing,
}: StyledRadioGroupProps) => {
if (defaultValue && children.find((child) => child.props.value === defaultValue) === undefined) {
throw new Error('기본값이 선택지에 없습니다.');
}
Expand All @@ -22,9 +31,9 @@ const StyledRadioGroup = ({ title, name, defaultValue, value, onChange, children
const group = getRootProps();

return (
<Flex direction="column" rowGap="3" w={w} m="20">
<Flex direction="column" rowGap="3" w={w}>
<Text {...textStyles.bold_xl}>{title}</Text>
<HStack {...group}>
<HStack {...group} spacing={spacing || '4'}>
{children.map((child) => (
<child.type key={child.props.value} {...getRadioProps({ value: child.props.value })}>
{child.props.children}
Expand Down
1 change: 1 addition & 0 deletions src/components/StyledRadioGroup/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export interface StyledRadioGroupProps {
defaultValue?: string;
value?: string;
children: JSX.Element[];
spacing?: string | number;
}

0 comments on commit 4bd9f1a

Please sign in to comment.