diff options
| author | jackyzha0 <[email protected]> | 2021-03-05 23:12:28 -0800 |
|---|---|---|
| committer | jackyzha0 <[email protected]> | 2021-03-05 23:12:28 -0800 |
| commit | 7a671bc96ef06df3da3d2dce3caca559f32c6627 (patch) | |
| tree | 9af8330b8a8dd2a84f07d8c8d75a6245ce84b2dc /frontend/src/components/decorators | |
| parent | refactoring css (diff) | |
| download | ctrl-v-7a671bc96ef06df3da3d2dce3caca559f32c6627.tar.xz ctrl-v-7a671bc96ef06df3da3d2dce3caca559f32c6627.zip | |
text area styling
Diffstat (limited to 'frontend/src/components/decorators')
| -rw-r--r-- | frontend/src/components/decorators/FloatingLabel.js | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/frontend/src/components/decorators/FloatingLabel.js b/frontend/src/components/decorators/FloatingLabel.js index 1e5a427..ddd963d 100644 --- a/frontend/src/components/decorators/FloatingLabel.js +++ b/frontend/src/components/decorators/FloatingLabel.js @@ -1,32 +1,22 @@ import React from 'react'; -import styled, { css } from 'styled-components' +import styled from 'styled-components' const StyledLabel = styled.label` - & > span { - position: absolute; - top: 0.5em; - font-weight: 700; - font-size: 1em; - opacity: 0.5; - transition: all 0.5s cubic-bezier(.25,.8,.25,1); - - ${props => - (props.value?.length > 0) && - css` - opacity: 1 - `}; - } + position: relative; + & > span { + position: absolute; + transform: translateY(-0.2em); + font-weight: 700; + font-size: 1em; + opacity: 0.5; + transition: opacity 0.5s cubic-bezier(.25,.8,.25,1); + } + + &:hover > span { + opacity: 1; + } ` -const FloatingLabel = (props) => { - return ( - <StyledLabel - label={props.label} - value={props.value} - > - {props.children} - </StyledLabel> - ); -} - -export default FloatingLabel
\ No newline at end of file +export default (props) => <StyledLabel label={props.label}> + {props.children} +</StyledLabel> |