diff --git a/src/components/atoms/Input/InputElement.module.css b/src/components/atoms/Input/InputElement.module.css index 13902d1c2..f30187a2a 100644 --- a/src/components/atoms/Input/InputElement.module.css +++ b/src/components/atoms/Input/InputElement.module.css @@ -240,7 +240,8 @@ input[type='range']::-moz-range-track { /* Size modifiers */ -.small { +.small, +.select.small { font-size: var(--font-size-small); height: 34px; padding: calc(var(--spacer) / 4); @@ -256,9 +257,32 @@ input[type='range']::-moz-range-track { font-size: var(--font-size-mini); } -.selectSmall { - composes: small; - height: 34px; +.select.small { + padding-right: 2rem; + + /* custom arrow */ + background-position: calc(100% - 14px) 1rem, calc(100% - 9px) 1rem, 100% 0; + background-size: 5px 5px, 5px 5px, 2rem 3rem; +} + +.large, +.select.large { + font-size: var(--font-size-large); + height: 62px; + padding: calc(var(--spacer) / 1.5); +} + +.large::placeholder { + font-size: var(--font-size-large); +} + +.prefix.large, +.postfix.large { + height: 62px; + font-size: var(--font-size-base); +} + +.select.large { padding-right: 2rem; /* custom arrow */ diff --git a/src/components/atoms/Input/InputElement.tsx b/src/components/atoms/Input/InputElement.tsx index 375318abc..f44a185f1 100644 --- a/src/components/atoms/Input/InputElement.tsx +++ b/src/components/atoms/Input/InputElement.tsx @@ -5,16 +5,19 @@ import { InputProps } from '.' import FilesInput from '../../molecules/FormFields/FilesInput' import Terms from '../../molecules/FormFields/Terms' import Datatoken from '../../molecules/FormFields/Datatoken' +import classNames from 'classnames/bind' + +const cx = classNames.bind(styles) const DefaultInput = ({ - small, + size, prefix, postfix, additionalComponent, ...props }: InputProps) => ( @@ -26,7 +29,7 @@ export default function InputElement({ name, prefix, postfix, - small, + size, field, label, help, @@ -34,14 +37,12 @@ export default function InputElement({ additionalComponent, ...props }: InputProps): ReactElement { + const styleClasses = cx({ select: true, [size]: size }) + switch (type) { case 'select': return ( - {field !== undefined && field.value === '' && ( )} @@ -95,27 +96,23 @@ export default function InputElement({ return prefix || postfix ? (
{prefix && ( -
- {prefix} -
+
{prefix}
)} {postfix && ( -
- {postfix} -
+
{postfix}
)}
) : ( ) diff --git a/src/components/atoms/Input/InputGroup.module.css b/src/components/atoms/Input/InputGroup.module.css index 8c72c3956..8fd55ce17 100644 --- a/src/components/atoms/Input/InputGroup.module.css +++ b/src/components/atoms/Input/InputGroup.module.css @@ -24,6 +24,10 @@ display: flex; } + .inputGroup > div { + flex: 1; + } + .inputGroup input { border-bottom-left-radius: var(--border-radius); border-top-right-radius: 0; @@ -37,7 +41,7 @@ margin-top: 0; margin-left: -1px; width: fit-content; - min-width: 20%; + white-space: nowrap; } } diff --git a/src/components/atoms/Input/index.tsx b/src/components/atoms/Input/index.tsx index 75d98a49f..1b230c234 100644 --- a/src/components/atoms/Input/index.tsx +++ b/src/components/atoms/Input/index.tsx @@ -39,7 +39,7 @@ export interface InputProps { postfix?: string | ReactElement step?: string defaultChecked?: boolean - small?: boolean + size?: 'small' | 'large' | 'default' } export default function Input(props: Partial): ReactElement { @@ -49,7 +49,7 @@ export default function Input(props: Partial): ReactElement { label, help, additionalComponent, - small, + size, field } = props @@ -69,7 +69,7 @@ export default function Input(props: Partial): ReactElement { - + {field && field.name !== 'price' && hasError && (