diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-09-22 11:03:07 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-22 11:03:07 +0900 |
commit | d956b9e976c01db3944643e2260cb23e23b08221 (patch) | |
tree | d953d4d629bd31f5ba1b248133ee1f77cdf470ac /src/settings/components/form/PropertiesForm.tsx | |
parent | 5d82441ce3d12301bb8f04b78b79fffb04121a37 (diff) | |
parent | 7257406df196a29c0f172ee68ca8dbe50a72d21f (diff) |
Merge pull request #838 from ueokande/form-styled-components
Use styled-components instead of vanilla CSS/SCSS in option
Diffstat (limited to 'src/settings/components/form/PropertiesForm.tsx')
-rw-r--r-- | src/settings/components/form/PropertiesForm.tsx | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/src/settings/components/form/PropertiesForm.tsx b/src/settings/components/form/PropertiesForm.tsx index aebd9b1..53ebf03 100644 --- a/src/settings/components/form/PropertiesForm.tsx +++ b/src/settings/components/form/PropertiesForm.tsx @@ -1,6 +1,20 @@ -import "./PropertiesForm.scss"; +import styled from "styled-components"; import React from "react"; +const Form = styled.div``; + +const Row = styled.div``; + +const Label = styled.label` + display: inline-block; + min-width: 5rem; + font-weight: bold; +`; + +const Input = styled.input` + line-height: 2.2rem; +`; + interface Props { types: { [key: string]: string }; value: { [key: string]: any }; @@ -21,7 +35,7 @@ class PropertiesForm extends React.Component<Props> { const values = this.props.value; return ( - <div className="form-properties-form"> + <Form> {Object.keys(types).map((name) => { const type = types[name]; let inputType = ""; @@ -42,23 +56,22 @@ class PropertiesForm extends React.Component<Props> { return null; } return ( - <div key={name} className="form-properties-form-row"> - <label> - <span className="column-name">{name}</span> - <input + <Row key={name}> + <Label> + <span>{name}</span> + <Input type={inputType} name={name} - className="column-input" value={values[name] ? values[name] : ""} onChange={onChange} onBlur={this.props.onBlur} checked={values[name]} /> - </label> - </div> + </Label> + </Row> ); })} - </div> + </Form> ); } |