Skip to content

Commit

Permalink
Feature/#184 첨부 파일 관련 공통 컴포넌트 구현 (#185)
Browse files Browse the repository at this point in the history
* design: iconButton Style 추가

* feat: IconBoxProps interface 추가

#184

* feat: IconBox 구현

#184
  • Loading branch information
llddang authored Apr 1, 2024
1 parent 20ea018 commit ce31fee
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 1 deletion.
35 changes: 35 additions & 0 deletions src/components/IconBox/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Flex, IconButton, Text } from '@chakra-ui/react';

import { IconBoxProps } from './type';

const IconBox = ({ leftIcon, content, rightIcon, handleClick }: IconBoxProps) => {
return (
<Flex align="center" gap="2" w="100%" px="3" py="1" color="white" bg="orange_light" borderRadius="xl">
<IconButton
as="div"
flexShrink="0"
fontSize="28px"
aria-label=""
icon={leftIcon}
size="icon_md"
variant="transparent"
/>
<Text textStyle="bold_xl" flex="auto" isTruncated>
{content}
</Text>
{rightIcon && (
<IconButton
flexShrink="0"
fontSize="28px"
aria-label=""
icon={rightIcon}
onClick={handleClick}
size="icon_md"
variant="transparent"
/>
)}
</Flex>
);
};

export default IconBox;
6 changes: 6 additions & 0 deletions src/components/IconBox/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface IconBoxProps {
leftIcon: React.ReactElement;
content: string;
rightIcon?: React.ReactElement;
handleClick?: () => void;
}
8 changes: 7 additions & 1 deletion src/theme/components/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { defineStyleConfig } from '@chakra-ui/react';
const Button = defineStyleConfig({
baseStyle: {
borderRadius: 'full',
shadow: 'md',
},

variants: {
Expand All @@ -17,6 +16,13 @@ const Button = defineStyleConfig({
color: 'white',
minW: '24',
},
transparent: {
bg: 'transparent',
color: 'white',
_hover: {
bg: 'transparent',
},
},
},

sizes: {
Expand Down

0 comments on commit ce31fee

Please sign in to comment.