mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
form tweaks
* add small modifier for all form elements * ditch bold font * use small elements for edit mode
This commit is contained in:
parent
583f15b6b3
commit
d1ce2c1963
@ -39,7 +39,6 @@
|
|||||||
.input {
|
.input {
|
||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
font-family: $font-family-base;
|
font-family: $font-family-base;
|
||||||
font-weight: $font-weight-bold;
|
|
||||||
color: $brand-black;
|
color: $brand-black;
|
||||||
border: none;
|
border: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
@ -62,7 +61,6 @@
|
|||||||
font-family: $font-family-base;
|
font-family: $font-family-base;
|
||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
color: $brand-grey-light;
|
color: $brand-grey-light;
|
||||||
font-weight: $font-weight-base;
|
|
||||||
transition: .2s ease-out;
|
transition: .2s ease-out;
|
||||||
opacity: .7;
|
opacity: .7;
|
||||||
}
|
}
|
||||||
@ -86,6 +84,17 @@
|
|||||||
// box-shadow: 0 0 0 1000px $brand-black inset;
|
// box-shadow: 0 0 0 1000px $brand-black inset;
|
||||||
// transition: background-color 5000s ease-in-out 0s;
|
// transition: background-color 5000s ease-in-out 0s;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
// Size modifiers
|
||||||
|
&.small {
|
||||||
|
font-size: $font-size-small;
|
||||||
|
min-height: 33px;
|
||||||
|
padding: $spacer / 4;
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
font-size: $font-size-small;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.select {
|
.select {
|
||||||
@ -114,6 +123,16 @@
|
|||||||
outline: 0;
|
outline: 0;
|
||||||
font-family: $font-family-base;
|
font-family: $font-family-base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
height: 32px;
|
||||||
|
padding-right: 2rem;
|
||||||
|
|
||||||
|
// custom arrow
|
||||||
|
background-position: calc(100% - 14px) 1rem, calc(100% - 9px) 1rem,
|
||||||
|
100% 0;
|
||||||
|
background-size: 5px 5px, 5px 5px, 2rem 3rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.radioGroup {
|
.radioGroup {
|
||||||
@ -165,26 +184,3 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size modifiers
|
|
||||||
|
|
||||||
.inputSmall {
|
|
||||||
composes: input;
|
|
||||||
font-size: $font-size-small;
|
|
||||||
min-height: 32px;
|
|
||||||
padding: $spacer / 4;
|
|
||||||
|
|
||||||
&::placeholder {
|
|
||||||
font-size: $font-size-small;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.selectSmall {
|
|
||||||
composes: select;
|
|
||||||
height: 32px;
|
|
||||||
padding-right: 2rem;
|
|
||||||
|
|
||||||
// custom arrow
|
|
||||||
background-position: calc(100% - 14px) 1rem, calc(100% - 9px) 1rem, 100% 0;
|
|
||||||
background-size: 5px 5px, 5px 5px, 2rem 3rem;
|
|
||||||
}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import cx from 'classnames'
|
|
||||||
import React, { PureComponent, FormEvent, ChangeEvent } from 'react'
|
import React, { PureComponent, FormEvent, ChangeEvent } from 'react'
|
||||||
import slugify from 'slugify'
|
import slugify from 'slugify'
|
||||||
import DatePicker from 'react-datepicker'
|
import DatePicker from 'react-datepicker'
|
||||||
|
import cx from 'classnames'
|
||||||
import { ReactComponent as SearchIcon } from '../../../img/search.svg'
|
import { ReactComponent as SearchIcon } from '../../../img/search.svg'
|
||||||
import Help from './Help'
|
import Help from './Help'
|
||||||
import Label from './Label'
|
import Label from './Label'
|
||||||
@ -31,6 +31,7 @@ interface InputProps {
|
|||||||
group?: any
|
group?: any
|
||||||
multiple?: boolean
|
multiple?: boolean
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
|
small?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
interface InputState {
|
interface InputState {
|
||||||
@ -82,6 +83,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
onChange,
|
onChange,
|
||||||
value,
|
value,
|
||||||
disabled
|
disabled
|
||||||
|
small
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
const wrapClass = this.inputWrapClasses()
|
const wrapClass = this.inputWrapClasses()
|
||||||
@ -92,7 +94,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
<div className={wrapClass}>
|
<div className={wrapClass}>
|
||||||
<select
|
<select
|
||||||
id={name}
|
id={name}
|
||||||
className={styles.select}
|
className={cx(styles.select, small && styles.small)}
|
||||||
name={name}
|
name={name}
|
||||||
required={required}
|
required={required}
|
||||||
onFocus={this.toggleFocus}
|
onFocus={this.toggleFocus}
|
||||||
@ -118,7 +120,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
<div className={wrapClass}>
|
<div className={wrapClass}>
|
||||||
<textarea
|
<textarea
|
||||||
id={name}
|
id={name}
|
||||||
className={styles.input}
|
className={cx(styles.input, small && styles.small)}
|
||||||
onFocus={this.toggleFocus}
|
onFocus={this.toggleFocus}
|
||||||
onBlur={this.toggleFocus}
|
onBlur={this.toggleFocus}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
@ -162,7 +164,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
<DatePicker
|
<DatePicker
|
||||||
selected={this.state.dateCreated}
|
selected={this.state.dateCreated}
|
||||||
onChange={this.handleDateChange}
|
onChange={this.handleDateChange}
|
||||||
className={styles.input}
|
className={cx(styles.input, small && styles.small)}
|
||||||
onFocus={this.toggleFocus}
|
onFocus={this.toggleFocus}
|
||||||
onBlur={this.toggleFocus}
|
onBlur={this.toggleFocus}
|
||||||
id={name}
|
id={name}
|
||||||
@ -179,7 +181,10 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
<input
|
<input
|
||||||
id={name}
|
id={name}
|
||||||
type={type || 'text'}
|
type={type || 'text'}
|
||||||
className={styles.input}
|
className={cx(
|
||||||
|
styles.input,
|
||||||
|
small && styles.small
|
||||||
|
)}
|
||||||
onFocus={this.toggleFocus}
|
onFocus={this.toggleFocus}
|
||||||
onBlur={this.toggleFocus}
|
onBlur={this.toggleFocus}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
@ -190,7 +195,10 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
<input
|
<input
|
||||||
id={name}
|
id={name}
|
||||||
type={type || 'text'}
|
type={type || 'text'}
|
||||||
className={styles.input}
|
className={cx(
|
||||||
|
styles.input,
|
||||||
|
small && styles.small
|
||||||
|
)}
|
||||||
onFocus={this.toggleFocus}
|
onFocus={this.toggleFocus}
|
||||||
onBlur={this.toggleFocus}
|
onBlur={this.toggleFocus}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
@ -210,12 +218,13 @@ export default class Input extends PureComponent<InputProps, InputState> {
|
|||||||
required,
|
required,
|
||||||
help,
|
help,
|
||||||
additionalComponent,
|
additionalComponent,
|
||||||
multiple
|
multiple,
|
||||||
|
small
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Row>
|
<Row small={small}>
|
||||||
<Label htmlFor={name} required={required}>
|
<Label htmlFor={name} required={required} small={small}>
|
||||||
{label}
|
{label}
|
||||||
</Label>
|
</Label>
|
||||||
|
|
||||||
|
@ -7,11 +7,13 @@
|
|||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: $spacer / 6;
|
margin-bottom: $spacer / 6;
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
font-size: $font-size-small;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.required {
|
.required {
|
||||||
composes: label;
|
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
content: '*';
|
content: '*';
|
||||||
font-size: $font-size-base;
|
font-size: $font-size-base;
|
||||||
@ -19,4 +21,10 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-left: .1rem;
|
margin-left: .1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
&:after {
|
||||||
|
font-size: $font-size-small;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import cx from 'classnames'
|
||||||
import styles from './Label.module.scss'
|
import styles from './Label.module.scss'
|
||||||
|
|
||||||
const Label = ({
|
const Label = ({
|
||||||
required,
|
required,
|
||||||
children,
|
children,
|
||||||
|
small,
|
||||||
...props
|
...props
|
||||||
}: {
|
}: {
|
||||||
required?: boolean
|
required?: boolean
|
||||||
children: string
|
children: string
|
||||||
htmlFor: string
|
htmlFor: string
|
||||||
|
small?: boolean
|
||||||
}) => (
|
}) => (
|
||||||
<label
|
<label
|
||||||
className={required ? styles.required : styles.label}
|
className={cx(
|
||||||
|
styles.label,
|
||||||
|
required && styles.required,
|
||||||
|
small && styles.small
|
||||||
|
)}
|
||||||
title={required ? 'Required' : ''}
|
title={required ? 'Required' : ''}
|
||||||
{...props}
|
{...props}
|
||||||
>
|
>
|
||||||
|
@ -2,4 +2,8 @@
|
|||||||
|
|
||||||
.row {
|
.row {
|
||||||
margin-bottom: $spacer;
|
margin-bottom: $spacer;
|
||||||
|
|
||||||
|
&.small {
|
||||||
|
margin-bottom: $spacer / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import cx from 'classnames'
|
||||||
import styles from './Row.module.scss'
|
import styles from './Row.module.scss'
|
||||||
|
|
||||||
const Row = ({ children }: { children: any }) => (
|
const Row = ({ children, small }: { children: any; small?: boolean }) => (
|
||||||
<div className={styles.row}>{children}</div>
|
<div className={cx(styles.row, small && styles.small)}>{children}</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
export default Row
|
export default Row
|
||||||
|
@ -44,6 +44,21 @@
|
|||||||
"placeholder": "e.g. 2019-08-12",
|
"placeholder": "e.g. 2019-08-12",
|
||||||
"type": "date",
|
"type": "date",
|
||||||
"required": true
|
"required": true
|
||||||
|
},
|
||||||
|
"name2": {
|
||||||
|
"label": "Your name",
|
||||||
|
"placeholder": "e.g. Jelly McJellyfish",
|
||||||
|
"type": "text",
|
||||||
|
"required": true,
|
||||||
|
"small": true,
|
||||||
|
"help": "Help me"
|
||||||
|
},
|
||||||
|
"industry2": {
|
||||||
|
"label": "Industry",
|
||||||
|
"type": "select",
|
||||||
|
"required": true,
|
||||||
|
"small": true,
|
||||||
|
"options": ["Automotive", "Technology"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,6 +152,7 @@ export default class AssetDetails extends PureComponent<
|
|||||||
onChange={this.inputChange}
|
onChange={this.inputChange}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={this.state.isLoading}
|
disabled={this.state.isLoading}
|
||||||
|
small
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<Moment date={value} format="L" interval={0} />
|
<Moment date={value} format="L" interval={0} />
|
||||||
@ -169,6 +170,7 @@ export default class AssetDetails extends PureComponent<
|
|||||||
options={steps[1].fields.categories.options}
|
options={steps[1].fields.categories.options}
|
||||||
value={value}
|
value={value}
|
||||||
disabled={this.state.isLoading}
|
disabled={this.state.isLoading}
|
||||||
|
small
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
// TODO: Make this link to search for respective category
|
// TODO: Make this link to search for respective category
|
||||||
|
@ -18,6 +18,7 @@ class Styleguide extends Component {
|
|||||||
type={value.type}
|
type={value.type}
|
||||||
help={value.help}
|
help={value.help}
|
||||||
options={value.options}
|
options={value.options}
|
||||||
|
small={value.small}
|
||||||
/>
|
/>
|
||||||
))
|
))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user