diff --git a/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.stories.tsx b/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.stories.tsx new file mode 100644 index 0000000000..3bc6bd0ee8 --- /dev/null +++ b/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.stories.tsx @@ -0,0 +1,18 @@ +import { Meta, StoryFn } from '@storybook/react' + +import { BenefitInput, BenefitInputProps } from './BenefitInput' + +export default { + title: 'inputs/BenefitInput', + component: BenefitInput, +} as Meta + +const Template: StoryFn = (args: BenefitInputProps) => + +export const Default = Template.bind({}) +Default.bind({ + onMoveUp: () => undefined, + onMoveDown: () => undefined, + onRemove: () => undefined, + position: 'middle', +}) diff --git a/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.styles.ts b/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.styles.ts new file mode 100644 index 0000000000..479307351c --- /dev/null +++ b/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.styles.ts @@ -0,0 +1,51 @@ +import styled from '@emotion/styled' + +import { SvgActionTrash } from '@/assets/icons' +import { cVar, media, sizes } from '@/styles' + +export const Container = styled.div` + display: grid; + grid-template-columns: 1fr 1fr; + gap: ${sizes(2)}; + + > *:nth-child(2) { + grid-column: 1/3; + } + + > *:nth-child(3) { + grid-column: 2/3; + grid-row: 1; + justify-self: end; + } + + ${media.sm} { + gap: ${sizes(4)}; + grid-template-columns: auto 1fr auto; + + > *:nth-child(2) { + grid-column: 2/3; + } + + > *:nth-child(3) { + grid-column: 3/4; + } + } +` + +export const FlexBox = styled.div<{ dir?: 'column' | 'row' }>` + display: flex; + flex-direction: ${(props) => props.dir ?? 'row'}; + gap: ${sizes(2)}; +` +export const StyledSvgActionTrash = styled(SvgActionTrash)` + path { + fill: ${cVar('colorTextError')}; + } +` + +export const EmojiPlaceholder = styled.div` + width: 40px; + height: 40px; + border-radius: 50%; + background: gray; +` diff --git a/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.tsx b/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.tsx new file mode 100644 index 0000000000..0ba06df159 --- /dev/null +++ b/packages/atlas/src/components/_inputs/BenefitInput/BenefitInput.tsx @@ -0,0 +1,53 @@ +import { ChangeEvent } from 'react' + +import { SvgActionChevronB, SvgActionChevronT } from '@/assets/icons' +import { Button } from '@/components/_buttons/Button' +import { + Container, + EmojiPlaceholder, + FlexBox, + StyledSvgActionTrash, +} from '@/components/_inputs/BenefitInput/BenefitInput.styles' +import { Input } from '@/components/_inputs/Input' +import { TextArea } from '@/components/_inputs/TextArea' +import { useMediaMatch } from '@/hooks/useMediaMatch' + +export type BenefitInputProps = { + position: 'last' | 'first' | 'middle' + onMoveUp: () => void + onMoveDown: () => void + onRemove: () => void + title?: string + description?: string + onTitleChange?: (e: ChangeEvent) => void + onDescriptionChange?: (e: ChangeEvent) => void +} + +export const BenefitInput = ({ + onRemove, + onMoveUp, + onMoveDown, + title, + description, + onDescriptionChange, + onTitleChange, + position, +}: BenefitInputProps) => { + const smMatch = useMediaMatch('sm') + return ( + + + + + + +