diff --git a/package.json b/package.json index f097600b..bcf737c3 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "react-scale-text": "^1.2.2", "react-select": "2.0.0", "react-transition-group": "^2.2.1", + "redbox-react": "^1.6.0", "redux": "4.0.0", "redux-logger": "^3.0.6", "redux-raven-middleware": "^1.2.0", diff --git a/src/js/components/Button/index.js b/src/js/components/Button/index.js index 9c9a0759..15642eb1 100644 --- a/src/js/components/Button/index.js +++ b/src/js/components/Button/index.js @@ -14,18 +14,62 @@ const Wrapper = styled.button` background: ${colors.GREEN_PRIMARY}; color: ${colors.WHITE}; border: 0; + &:hover { background: ${colors.GREEN_SECONDARY}; } + &:active { background: ${colors.GREEN_TERTIARY}; } + ${props => props.disabled && css` pointer-events: none; color: ${colors.TEXT_SECONDARY}; background: ${colors.GRAY_LIGHT}; `} + ${props => props.isBlue && css` + background: transparent; + border: 1px solid ${colors.INFO_PRIMARY}; + color: ${colors.INFO_PRIMARY}; + padding: 12px 58px; + + &:hover { + color: ${colors.WHITE}; + background: ${colors.INFO_PRIMARY}; + } + `} + + ${props => props.isWhite && css` + background: @color_white; + color: ${colors.TEXT_SECONDARY}; + border: 1px solid ${colors.DIVIDER}; + + &:hover { + color: ${colors.TEXT_PRIMARY}; + border-color: ${colors.TEXT_PRIMARY}; + background: ${colors.DIVIDER}; + } + + &:active { + color: ${colors.TEXT_PRIMARY}; + background: ${colors.DIVIDER}; + } + `} + + ${props => props.isTransparent && css` + background: transparent; + border: 0px; + color: ${colors.TEXT_SECONDARY}; + + &:hover, + &:active { + color: ${colors.TEXT_PRIMARY}; + background: transparent; + } + `} + ${props => props.isWebUsb && css` position: relative; padding: 12px 24px 12px 40px; @@ -81,7 +125,7 @@ const IconWrapper = styled.span` `; const Button = ({ - className, text, icon, onClick = () => { }, disabled, isBlue = false, isWhite = false, isWebUsb = false, + className, text, icon, onClick = () => { }, disabled, isBlue = false, isWhite = false, isWebUsb = false, isTransparent = false, }) => ( {icon && ( @@ -112,6 +157,7 @@ Button.propTypes = { isBlue: PropTypes.bool, isWhite: PropTypes.bool, isWebUsb: PropTypes.bool, + isTransparent: PropTypes.bool, icon: PropTypes.shape({ type: PropTypes.arrayOf(PropTypes.string).isRequired, color: PropTypes.string, diff --git a/src/js/components/Header/index.js b/src/js/components/Header/index.js index 987c7ded..b64301c5 100644 --- a/src/js/components/Header/index.js +++ b/src/js/components/Header/index.js @@ -24,9 +24,12 @@ const LayoutWrapper = styled.div` height: 100%; max-width: 1170px; margin: 0 auto; - padding: 0 32px; display: flex; align-items: center; + + @media screen and (max-width: 1170px) { + padding: 0 25px; + } `; const A = styled.a` diff --git a/src/js/components/Icon/index.js b/src/js/components/Icon/index.js index c8fc384c..45e1644e 100644 --- a/src/js/components/Icon/index.js +++ b/src/js/components/Icon/index.js @@ -1,39 +1,62 @@ import React from 'react'; import PropTypes from 'prop-types'; +import styled, { keyframes } from 'styled-components'; -const Icon = ({ icon, size = 32, color = 'black' }) => { - const styles = { - svg: { +// TODO: make animation of icons better +const rotate180up = keyframes` + from { + transform: rotate(0deg); + } + to { + transform: rotate(180deg); + } +`; + +const rotate180down = keyframes` + from { + transform: rotate(180deg); + } + to { + transform: rotate(0deg); + } +`; + +const SvgWrapper = styled.svg` + animation: ${props => (props.canAnimate ? (props.isActive ? rotate180up : rotate180down) : null)} 0.2s linear 1 forwards; +`; + +const Path = styled.path``; + +const Icon = ({ + icon, size = 32, color = 'black', isActive, canAnimate, +}) => ( + - {icon.map(iconPath => ( - - ))} - - ); -}; + }} + width={`${size}`} + height={`${size}`} + viewBox="0 0 1024 1024" + > + {icon.map(path => ( + + ))} + +); Icon.propTypes = { + canAnimate: PropTypes.bool, icon: PropTypes.arrayOf(PropTypes.string).isRequired, size: PropTypes.number, + isActive: PropTypes.bool, color: PropTypes.string, }; diff --git a/src/js/components/Log/index.js b/src/js/components/Log/index.js index 76705020..6247b32c 100644 --- a/src/js/components/Log/index.js +++ b/src/js/components/Log/index.js @@ -1,23 +1,70 @@ /* @flow */ - - import React from 'react'; +import styled from 'styled-components'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; +import colors from 'config/colors'; import { H2 } from 'components/Heading'; +import Icon from 'components/Icon'; +import P from 'components/P'; import * as LogActions from 'actions/LogActions'; -import type { State, Dispatch } from 'flowtype'; +import icons from 'config/icons'; +import { State, Dispatch } from 'flowtype'; + +const Wrapper = styled.div` + position: relative; + color: ${colors.INFO_PRIMARY}; + background: ${colors.INFO_SECONDARY}; + padding: 24px 48px; + display: flex; + flex-direction: column; + text-align: left; +`; + +const Click = styled.div` + cursor: pointer; + position: absolute; + top: 8px; + right: 0; + padding: 12px; + color: inherit; + transition: opacity 0.3s; + + &:active, + &:hover { + opacity: 0.6; + color: inherit; + } +`; + +const Textarea = styled.textarea` + width: 100%; + height: 200px; + min-height: 200px; + resize: vertical; + font-size: 10px; + + &:focus { + box-shadow: none; + } +`; + +const StyledP = styled(P)` + margin: 10px 0; +`; const Log = (props: Props): ?React$Element => { if (!props.log.opened) return null; return ( -
-