From 0a2f0f2a0c9f9d21a300afc48daa9944be0df228 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Wed, 22 Feb 2017 08:36:17 +1300 Subject: [PATCH] Condense actions into expansion panel --- src/js/components/Header.js | 25 +++++++- src/scss/components/_dropdown-field.scss | 29 +++++++++ src/scss/components/_header.scss | 81 ++++++++++++++++++------ 3 files changed, 113 insertions(+), 22 deletions(-) diff --git a/src/js/components/Header.js b/src/js/components/Header.js index 50320a93..d1bafa27 100755 --- a/src/js/components/Header.js +++ b/src/js/components/Header.js @@ -1,5 +1,7 @@ import React, { PropTypes } from 'react' +import FontAwesome from 'react-fontawesome' + import Icon from './Icon' import SidebarToggleButton from './SidebarToggleButton' @@ -7,6 +9,27 @@ export default class Header extends React.Component{ constructor(props) { super(props); + + this.state = { + expanded: false + } + } + + renderActions(){ + if (!this.props.actions) return null + + return ( +
+ + + + { this.props.actions } + + +
+ ) } render(){ @@ -15,7 +38,7 @@ export default class Header extends React.Component{

{ this.props.title }

- { this.props.actions ?
{ this.props.actions }
: null } + {this.renderActions()} ); } diff --git a/src/scss/components/_dropdown-field.scss b/src/scss/components/_dropdown-field.scss index f61a8b53..f8044a7e 100755 --- a/src/scss/components/_dropdown-field.scss +++ b/src/scss/components/_dropdown-field.scss @@ -48,5 +48,34 @@ } } } + + @include responsive( $bp_medium ){ + &.expanded { + background: none !important; + color: inherit !important; + } + + .label { + background: none !important; + color: inherit !important; + + .fa { + display: none; + } + } + + .options { + display: block; + position: relative; + top: 0; + background: lighten($light_grey,5%); + + .option { + color: #000000; + border-color: $light_grey; + background: none !important; + } + } + } } diff --git a/src/scss/components/_header.scss b/src/scss/components/_header.scss index 00513eee..af20da32 100755 --- a/src/scss/components/_header.scss +++ b/src/scss/components/_header.scss @@ -43,33 +43,72 @@ main { &:active { background: rgba(0,0,0,0.15); } + + &.trigger { + display: none; + font-size: 18px; + padding: 16px 14px; + } } } @include responsive( $bp_medium ){ - .dropdown-field { - .label { - padding-left: 16px; - padding-right: 16px; - - .text { - display: none; - } - .fa { - line-height: 24px; - } - } - } .actions { - button { - font-size: 1px; - color: transparent; - vertical-align: top; + right: 0; - .fa { - font-size: 14px; - color: #000000; - vertical-align: middle; + button.trigger { + display: inline-block; + } + + .items { + display: none; + } + + &.expanded { + z-index: 98; + + button.trigger { + z-index: 99; + color: #FFFFFF; + position: relative; + } + + .items { + display: block; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: rgba(0,0,0,0.9); + overflow-y: scroll; + + .liner { + display: block; + width: 200px; + margin: 30px auto; + background: $light_grey; + } + + button, + .dropdown-field { + display: block; + width: 100%; + text-align: left; + border-bottom: 1px solid rgba(0,0,0,0.1); + + .fa { + width: 1.5em; + text-align: center; + } + + &.dropdown-field { + .label { + padding-left: 14px; + padding-right: 14px; + } + } + } } } }