diff --git a/apps/docs/src/App.tsx b/apps/docs/src/App.tsx index 07dbbab..8054a7d 100644 --- a/apps/docs/src/App.tsx +++ b/apps/docs/src/App.tsx @@ -77,7 +77,17 @@ function App() { onReset={handleSearchReset} />
- }>여긴 본문 + } + bottomAddon={ + 레프트애드온
} + rightAddon={
롸이트애드온
} + /> + } + > + 여긴 본문 + ); } diff --git a/packages/ui/FieldBox/BottomAddon.tsx b/packages/ui/FieldBox/BottomAddon.tsx new file mode 100644 index 0000000..73ab412 --- /dev/null +++ b/packages/ui/FieldBox/BottomAddon.tsx @@ -0,0 +1,21 @@ +import type { HTMLAttributes, ReactNode } from 'react'; +import { forwardRef } from 'react'; +import { bottomAddonContainerStyle } from './style.css'; + +export interface BottomAddon extends HTMLAttributes { + leftAddon?: ReactNode; + rightAddon?: ReactNode; +} + +export const BottomAddon = forwardRef((props, forwardedRef) => { + const { leftAddon, rightAddon } = props; + + return ( +
+ {leftAddon} + {rightAddon} +
+ ); +}); + +BottomAddon.displayName = 'BottomAddon'; diff --git a/packages/ui/FieldBox/FieldBox.tsx b/packages/ui/FieldBox/FieldBox.tsx index 07e1675..f4a79b1 100644 --- a/packages/ui/FieldBox/FieldBox.tsx +++ b/packages/ui/FieldBox/FieldBox.tsx @@ -1,6 +1,7 @@ import { forwardRef } from 'react'; import type { HTMLAttributes, ReactNode } from 'react'; import { FieldBoxLabel } from './Label'; +import { BottomAddon } from './BottomAddon'; export interface FieldBoxProps extends HTMLAttributes { topAddon?: ReactNode; @@ -23,4 +24,5 @@ FieldBoxImpl.displayName = 'FieldBoxImpl'; export const FieldBox = Object.assign(FieldBoxImpl, { Label: FieldBoxLabel, + BottomAddon, }); diff --git a/packages/ui/FieldBox/Label.tsx b/packages/ui/FieldBox/Label.tsx index 5a08d74..3255be4 100644 --- a/packages/ui/FieldBox/Label.tsx +++ b/packages/ui/FieldBox/Label.tsx @@ -1,6 +1,6 @@ import type { HTMLAttributes } from 'react'; import { forwardRef } from 'react'; -import * as S from './style.css'; +import { requiredMarkStyle, TopAddonDescriptionStyle, TopAddonLabelStyle } from './style.css'; export interface FieldBoxLabelProps extends HTMLAttributes { label: string; @@ -13,12 +13,12 @@ export const FieldBoxLabel = forwardRef((pro return (
-
); diff --git a/packages/ui/FieldBox/index.ts b/packages/ui/FieldBox/index.ts index 857636f..6436cb0 100644 --- a/packages/ui/FieldBox/index.ts +++ b/packages/ui/FieldBox/index.ts @@ -1,2 +1,3 @@ export * from './FieldBox'; export * from './Label'; +export * from './BottomAddon'; diff --git a/packages/ui/FieldBox/style.css.ts b/packages/ui/FieldBox/style.css.ts index 78acb56..fc791b2 100644 --- a/packages/ui/FieldBox/style.css.ts +++ b/packages/ui/FieldBox/style.css.ts @@ -1,7 +1,7 @@ import { style } from '@vanilla-extract/css'; import theme from '../theme.css'; -export const label = style({ +export const TopAddonLabelStyle = style({ ...theme.fontsObject.LABEL_3_14_SB, display: 'flex', flexDirection: 'column', @@ -9,13 +9,20 @@ export const label = style({ color: theme.colors.white, }); -export const description = style({ +export const TopAddonDescriptionStyle = style({ ...theme.fontsObject.LABEL_4_12_SB, color: theme.colors.gray300, marginBottom: '8px', }); -export const required = style({ +export const requiredMarkStyle = style({ color: theme.colors.secondary, marginLeft: '4px', }); + +export const bottomAddonContainerStyle = style({ + marginTop: '8px', + display: 'flex', + justifyContent: 'space-between', + alignItems: 'center', +});