mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-25 06:24:19 +00:00
✨ Add TextArea
This commit is contained in:
parent
90af13e2a9
commit
21ef90f17f
2 changed files with 54 additions and 0 deletions
22
code/frontend/src/components/TextArea.js
Normal file
22
code/frontend/src/components/TextArea.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import React from "react"
|
||||
import Style from "./TextArea.module.css"
|
||||
import classNames from "classnames"
|
||||
|
||||
|
||||
/**
|
||||
* A multiline text field which can optionally be resized.
|
||||
*
|
||||
* @param resize - `true` if the resizing the textarea should be allowed, `false` otherwise.
|
||||
* @param children - The value of the `<textarea>`.
|
||||
* @param className - Additional class(es) to add to the textarea.
|
||||
* @param props - Additional props to pass to the textarea.
|
||||
* @returns {JSX.Element}
|
||||
* @constructor
|
||||
*/
|
||||
export default function TextArea({ resize, children, className, ...props }) {
|
||||
return (
|
||||
<textarea className={classNames(Style.TextArea, resize ? Style.TextAreaResizable : Style.TextAreaNoResize, className)} {...props}>
|
||||
{children}
|
||||
</textarea>
|
||||
)
|
||||
}
|
32
code/frontend/src/components/TextArea.module.css
Normal file
32
code/frontend/src/components/TextArea.module.css
Normal file
|
@ -0,0 +1,32 @@
|
|||
.TextArea {
|
||||
/* Remember the margin! */
|
||||
height: calc(100% - 4px);
|
||||
width: calc(100% - 4px);
|
||||
|
||||
border-radius: 25px;
|
||||
border-width: 0;
|
||||
|
||||
min-height: 28px;
|
||||
padding: 10px 20px;
|
||||
margin: 2px;
|
||||
|
||||
color: var(--fg-field-off);
|
||||
background-color: var(--bg-field-off);
|
||||
|
||||
font-family: var(--font-regular);
|
||||
}
|
||||
|
||||
.TextArea:focus {
|
||||
outline: 0;
|
||||
|
||||
color: var(--fg-field-on);
|
||||
background-color: var(--bg-field-on);
|
||||
}
|
||||
|
||||
.TextAreaResizable {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.TextAreaNoResize {
|
||||
resize: none;
|
||||
}
|
Loading…
Reference in a new issue