Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
feat(textinput): add margin-top to TextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
coldlink committed Sep 30, 2021
1 parent 5b682af commit 7417208
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/components/text-input/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
textInput,
errorInput,
successInput,
supportingTextMargin,
labelMargin,
} from './styles';
import {
visuallyHidden as _visuallyHidden,
Expand Down Expand Up @@ -114,6 +116,7 @@ export const TextInput = ({
css={(theme) => [
width ? widths[width] : widthFluid,
textInput(theme.textInput && theme),
supporting ? supportingTextMargin : labelMargin,
error ? errorInput(theme.textInput && theme) : '',
!error && success
? successInput(theme.textInput && theme)
Expand Down
10 changes: 10 additions & 0 deletions src/core/components/text-input/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { resets } from '@guardian/src-foundations/utils';
export const errorInput = ({ textInput } = textInputDefault) => css`
border: 4px solid ${textInput.borderError};
color: ${textInput.textError};
margin-top: 0;
`;

export const successInput = ({ textInput } = textInputDefault) => css`
border: 4px solid ${textInput.borderSuccess};
color: ${textInput.textSuccess};
margin-top: 0;
`;

export const textInput = (theme = textInputDefault) => {
Expand Down Expand Up @@ -49,6 +51,14 @@ export const textInput = (theme = textInputDefault) => {
`;
};

export const labelMargin = css`
margin-top: ${space[1]}px;
`;

export const supportingTextMargin = css`
margin-top: 6px;
`;

export const widthFluid = css`
width: 100%;
`;
Expand Down

0 comments on commit 7417208

Please sign in to comment.