From 7a3ca8a956468db1e3a66b4f0ec3beb8ad0b81f3 Mon Sep 17 00:00:00 2001 From: jackyzha0 Date: Sun, 10 May 2020 11:48:31 -0700 Subject: add focus opacity change, password input --- frontend/src/components/FloatingLabel.js | 34 ++++++++++++++++++++++++++++++ frontend/src/components/Inputs.js | 36 +++++++++++++++++++++++++++++++- frontend/src/components/Options.js | 22 +++++++++++++++++++ frontend/src/components/PasteArea.js | 11 ++++++++-- 4 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 frontend/src/components/FloatingLabel.js create mode 100644 frontend/src/components/Options.js (limited to 'frontend/src/components') diff --git a/frontend/src/components/FloatingLabel.js b/frontend/src/components/FloatingLabel.js new file mode 100644 index 0000000..814790c --- /dev/null +++ b/frontend/src/components/FloatingLabel.js @@ -0,0 +1,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 ( + + {this.props.label} + + ); + } +} + +export default FloatingLabel \ No newline at end of file diff --git a/frontend/src/components/Inputs.js b/frontend/src/components/Inputs.js index d2238af..a45e6de 100644 --- a/frontend/src/components/Inputs.js +++ b/frontend/src/components/Inputs.js @@ -1,6 +1,7 @@ import React from 'react'; import CharLimit from './CharLimit' import styled from 'styled-components' +import FloatingLabel from './FloatingLabel' const CharLimitContainer = styled.div` position: relative; @@ -10,11 +11,17 @@ class TitleInput extends React.Component { render() { return ( + @@ -30,10 +37,15 @@ class PasteInput extends React.Component { render() { return ( +