diff --git a/web/app/components/input/index.js b/web/app/components/input/index.js new file mode 100644 index 00000000..820718c5 --- /dev/null +++ b/web/app/components/input/index.js @@ -0,0 +1,3 @@ +export { default } from './input'; + +require('./input.scss'); diff --git a/web/app/components/input/input.jsx b/web/app/components/input/input.jsx new file mode 100644 index 00000000..5207de00 --- /dev/null +++ b/web/app/components/input/input.jsx @@ -0,0 +1,25 @@ +import { h, Component } from 'preact'; + +export default class Input extends Component { + constructor(props) { + super(props); + + this.autoResize = this.autoResize.bind(this); + } + + autoResize() { + this.rootNode.style.height = ''; + this.setState({ height: this.rootNode.scrollHeight }); + } + + render(props, { height }) { + return ( + + ); + } +} diff --git a/web/app/components/input/input.scss b/web/app/components/input/input.scss new file mode 100644 index 00000000..b6bf33f1 --- /dev/null +++ b/web/app/components/input/input.scss @@ -0,0 +1,24 @@ +.input { + $lineHeight: 1.4; + $fontSize: 16px; + $paddingVrt: 10px; + $height: $fontSize * $lineHeight + $paddingVrt * 2; + + box-sizing: border-box; + width: 100%; + height: $height; + min-height: $height; + padding: $paddingVrt 15px; + font-family: 'PT Sans', Helvetica, Arial, sans-serif; + font-size: $fontSize; + line-height: $lineHeight; + box-shadow: 0 0 0 1px #eee; + border: 0; + border-radius: 4px; + resize: none; + + &:focus { + box-shadow: 0 0 0 1px #aaa; + outline: none; + } +}