Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinWijnant committed Feb 27, 2021
2 parents 19a9694 + 9ace1d8 commit 49625ce
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 6 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ jobs:
- name: Run ESLint
run: yarn lint --quiet --color

- name: Run tests
id: tests
run: yarn run test --watchAll=false --colors --ci --coverage

- name: Compile src
run: yarn build

- name: Build the docs
run: yarn document

- name: Run tests
id: tests
run: yarn run test --watchAll=false --colors --ci --coverage

- name: Upload coverage report to codecov
uses: codecov/codecov-action@v1

Expand Down
1 change: 1 addition & 0 deletions src/components/Input/Input.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
padding: 8px 14px;
width: 100%;
color: var(--color-neutral-9);
-webkit-appearance: none;
}

.input::placeholder {
Expand Down
6 changes: 6 additions & 0 deletions src/components/TextArea/TextArea.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ A Input can be used to let the user insert text using key strokes. A crucial for
<TextArea name="invalidTextArea" isInvalid />
</Playground>

### Disabled input

<Playground>
<TextArea name="disabledTextArea" isDisabled value="This field is disabled" />
</Playground>

## API

<Props of={TextArea} />
5 changes: 5 additions & 0 deletions src/components/TextArea/TextArea.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
box-shadow: 0 0 0 3px var(--color-focus);
}

.textarea:disabled {
color: var(--color-neutral-4);
border-color: var(--color-neutral-4);
}

.containsError {
border-color: var(--color-error);
}
Expand Down
9 changes: 9 additions & 0 deletions src/components/TextArea/TextArea.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ describe('TextArea', () => {
expect(textAreaElement.getAttribute('autocomplete')).toBe('on');
});

test('disabled prop', () => {
const component = <TextArea {...defaultButtonProps} isDisabled />;
const { getByTestId } = render(component);
const textAreaElement = getByTestId('textarea-comment');

expect(textAreaElement.hasAttribute('spellcheck')).toBe(true);
expect(textAreaElement.getAttribute('spellcheck')).not.toBe(false);
});

test('maxLength prop', () => {
const maxLength = 3;
const component = <TextArea {...defaultButtonProps} maxLength={3} />;
Expand Down
3 changes: 3 additions & 0 deletions src/components/TextArea/TextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface Props {
placeholder?: string;
spellCheck?: boolean;
autoComplete?: boolean;
isDisabled?: boolean;
maxLength?: number;
className?: string;
isInvalid?: boolean;
Expand All @@ -28,6 +29,7 @@ const TextArea = React.forwardRef<HTMLTextAreaElement, Props>(
isInvalid = false,
spellCheck = false,
autoComplete = false,
isDisabled = false,
maxLength,
className,
}: Props,
Expand Down Expand Up @@ -55,6 +57,7 @@ const TextArea = React.forwardRef<HTMLTextAreaElement, Props>(
className={textareaClassNames}
data-testid={name && `textarea-${name}`}
onBlur={onBlur}
disabled={isDisabled}
/>
);
},
Expand Down
4 changes: 2 additions & 2 deletions src/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@

/* Font */
--font-family: Lato, sans-serif;
--font-size: 16px;
--font-size: 14px;
--font-color: var(--color-neutral-8);
--font-color-sub: var(--color-neutral-7);
--line-height: 28px;
--line-height: 16px;

/* Border */
--border-radius-small: 3px;
Expand Down

0 comments on commit 49625ce

Please sign in to comment.