blob: 814790cff626c25a23f852af0d422a0236b52e3a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import React from 'react';
import styled, { css } from 'styled-components'
const StyledLabel = styled.label`
position: absolute;
top: 0.5em;
font-weight: 700;
font-size: 1em;
opacity: 0;
transition: all 0.5s cubic-bezier(.25,.8,.25,1);
${props =>
(props.value.length > 0) &&
css`
top: 0em;
opacity: 1
`};
`
class FloatingLabel extends React.Component {
render() {
return (
<StyledLabel
label={this.props.label}
value={this.props.value}
className={this.props.id}
htmlFor={this.props.id}>
{this.props.label}
</StyledLabel>
);
}
}
export default FloatingLabel
|