Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Add textarea form component #931

Merged
merged 5 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions frontend/src/component/form/TextArea.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@import '../styles/color';
@import '../styles/corner';
@import '../styles/font';

.text-area {
@include default-font();
border: 2px solid $color-text-field-border;
box-sizing: border-box;
font-size: 16px;
@include round-corner;
outline: none;
padding: 8px 20px;
width: 100%;

&:focus {
border-color: $color-primary;
}
}
32 changes: 32 additions & 0 deletions frontend/src/component/form/TextAreaField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { ChangeEvent, Component } from 'react';
import './TextArea.scss';

interface IProps {
rows?: number;
value?: string;
placeholder?: string;
onChange?: (value: string) => void;
onBlur?: () => void;
}

export class TextAreaField extends Component<IProps, any> {
render() {
return (
<textarea
className={'text-area'}
rows={this.props.rows}
rohithbalaji123 marked this conversation as resolved.
Show resolved Hide resolved
value={this.props.value}
placeholder={this.props.placeholder}
onChange={this.handleChange}
onBlur={this.props.onBlur}
/>
);
}

private handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
if (!this.props.onChange) {
return;
}
this.props.onChange(event.target.value);
};
}
2 changes: 1 addition & 1 deletion frontend/src/component/form/TextField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

.text-field {
@include default-font();
border: 2px solid #9e9e9e;
border: 2px solid $color-text-field-border;
rohithbalaji123 marked this conversation as resolved.
Show resolved Hide resolved
box-sizing: border-box;
font-size: 16px;
@include round-corner;
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/component/styles/color.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ $color-highlight: lightblue;
$color-scrollbar-track: #ccc;
$color-divider: #dbdbdb;
$color-time: #9e9e9e;
$color-text-field-border: #9e9e9e;

// Toast
$color-toast-background: $color-dark-gray;
$color-toast-text: $color-light-gray;

Expand Down