diff --git a/src/components/shared/Input/Input.style.ts b/src/components/shared/Input/Input.style.ts new file mode 100644 index 00000000..73822728 --- /dev/null +++ b/src/components/shared/Input/Input.style.ts @@ -0,0 +1,26 @@ +import styled from '@emotion/styled'; + +import type { InputProps } from '.'; + +export const StyledInput = styled.input< + Pick +>` + outline: none; + border: none; + width: 100%; + line-height: ${({ height }) => height}; + height: ${({ height }) => height}; + font-size: ${({ fontSize }) => fontSize}; +`; +export const InputContainer = styled.div< + Omit +>` + box-sizing: border-box; + width: 100%; + overflow: hidden; + height: ${({ height }) => height}; + background-color: ${({ backgroundColor }) => backgroundColor}; + border: ${({ border }) => border}; + border-radius: ${({ borderRadius }) => borderRadius}; + padding: ${({ padding }) => padding}; +`; diff --git a/src/components/shared/Input/Input.tsx b/src/components/shared/Input/Input.tsx new file mode 100644 index 00000000..be6025f7 --- /dev/null +++ b/src/components/shared/Input/Input.tsx @@ -0,0 +1,44 @@ +import { theme } from '@styles/theme'; + +import { InputContainer, StyledInput } from './Input.style'; + +export type InputProps = { + isAutofocus?: boolean; + height?: string; + fontSize?: string; + backgroundColor?: string; + border?: string; + borderRadius?: string; + padding?: string; +} & React.ComponentProps<'input'>; + +export const Input = ({ + isAutofocus = false, + height = '30px', + fontSize = theme.FONT_SIZE.MD, + backgroundColor = 'white', + border = 'none', + borderRadius = '0%', + padding = '0px 10px', + ...props +}: InputProps) => { + const stringifiedHeight = + typeof height === 'number' ? `${height / 16}rem` : height; + + return ( + + + + ); +}; diff --git a/src/components/shared/Input/index.ts b/src/components/shared/Input/index.ts new file mode 100644 index 00000000..ba9fe7eb --- /dev/null +++ b/src/components/shared/Input/index.ts @@ -0,0 +1 @@ +export * from './Input';