diff --git a/apps/react/src/app/components/input/index.ts b/apps/react/src/app/components/input/index.ts new file mode 100644 index 000000000..420aed4c8 --- /dev/null +++ b/apps/react/src/app/components/input/index.ts @@ -0,0 +1,2 @@ +export { Input } from './input' +export type { InputProps } from './input' diff --git a/apps/react/src/app/components/input/input.scss b/apps/react/src/app/components/input/input.scss new file mode 100644 index 000000000..5cd5d6754 --- /dev/null +++ b/apps/react/src/app/components/input/input.scss @@ -0,0 +1,53 @@ +@use "src/styles/framework" as *; + +.input-wrapper { + display: flex; + flex-direction: column; + gap: $space-s2; +} + +.input-label { + font-size: 14px; + font-weight: 500; + color: $text-color; +} + +.input { + padding: $space-s2 $space-m2; + border: 1px solid $border-input; + border-radius: 4px; + font-size: 14px; + color: $text-color; + transition: border-color 0.2s ease; + + &:focus { + outline: none; + border-color: $blue; + box-shadow: 0 0 0 3px rgba(27, 98, 180, 0.1); + } + + &--error { + border-color: $red; + + &:focus { + box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1); + } + } + + &:disabled { + background-color: $day-color-inactive; + cursor: not-allowed; + color: $light-gray; + } +} + +.input-error { + font-size: 12px; + color: $red; + font-weight: 500; +} + +.input-helper { + font-size: 12px; + color: $light-gray; +} diff --git a/apps/react/src/app/components/input/input.tsx b/apps/react/src/app/components/input/input.tsx new file mode 100644 index 000000000..b9c90d6f1 --- /dev/null +++ b/apps/react/src/app/components/input/input.tsx @@ -0,0 +1,33 @@ +import React from 'react' +import './input.scss' + +export interface InputProps + extends Omit, 'data-testid'> { + label?: string + error?: string + helperText?: string + 'data-testid'?: string +} + +export const Input: React.FC = ({ + label, + error, + helperText, + className = '', + ...props +}) => { + const { 'data-testid': dataTestId = 'input', ...inputProps } = props as any + + return ( +
+ {label && } + + {error && {error}} + {helperText && {helperText}} +
+ ) +}