mirror of
https://github.com/opensupports/opensupports.git
synced 2025-07-28 08:14:25 +02:00
[Ivan Diaz] - Add label to input
This commit is contained in:
parent
08d6441bff
commit
60ef79f13a
@ -21,6 +21,18 @@ var DemoPage = React.createClass({
|
|||||||
<Button type="primary">Sign up</Button>
|
<Button type="primary">Sign up</Button>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Input',
|
||||||
|
render: (
|
||||||
|
<Input placeholder="placeholder"/>
|
||||||
|
)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Input wrapped in a label',
|
||||||
|
render: (
|
||||||
|
<Input placeholder="placeholder" label="This is a label" />
|
||||||
|
)
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Widget',
|
title: 'Widget',
|
||||||
render: (
|
render: (
|
||||||
@ -30,12 +42,6 @@ var DemoPage = React.createClass({
|
|||||||
<Button type="primary">SIGN UP</Button>
|
<Button type="primary">SIGN UP</Button>
|
||||||
</Widget>
|
</Widget>
|
||||||
)
|
)
|
||||||
},
|
|
||||||
{
|
|
||||||
title: 'Input',
|
|
||||||
render: (
|
|
||||||
<Input placeholder="placeholder"/>
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -44,11 +44,10 @@ var Form = React.createClass({
|
|||||||
return props;
|
return props;
|
||||||
},
|
},
|
||||||
|
|
||||||
getInputProps(child) {
|
getInputProps({props, type}) {
|
||||||
var props = child.props;
|
|
||||||
var additionalProps = {};
|
var additionalProps = {};
|
||||||
|
|
||||||
if(child.type === Input) {
|
if(type === Input) {
|
||||||
let inputName = props.name;
|
let inputName = props.name;
|
||||||
|
|
||||||
this.validations[inputName] = props.validation;
|
this.validations[inputName] = props.validation;
|
||||||
|
@ -19,7 +19,10 @@ var Input = React.createClass({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
|
<label className="input-label">
|
||||||
|
<span className="input-label--text">{this.props.label}</span>
|
||||||
<input {...this.getProps()} />
|
<input {...this.getProps()} />
|
||||||
|
</label>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -13,4 +13,17 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
border-color: $primary-blue;
|
border-color: $primary-blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-label {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&--text {
|
||||||
|
color: $primary-black;
|
||||||
|
font-size: 14px;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: -26px;
|
||||||
|
left: 2px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user