Skip to content

Commit

Permalink
Popover: Adding a header for mobile popovers
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Nov 22, 2017
1 parent 063ea58 commit 151066f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
8 changes: 5 additions & 3 deletions components/popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,16 @@ class Popover extends Component {
{ ...contentProps }
onKeyDown={ this.maybeClose }
>
{ this.state.isMobile && (
<div className="components-popover__header">
<IconButton className="components-popover__close" icon="no-alt" onClick={ onClose } />
</div>
) }
<div
ref={ this.bindNode( 'content' ) }
className="components-popover__content"
tabIndex="-1"
>
{ this.state.isMobile &&
<IconButton className="components-popover__close" icon="no-alt" onClick={ onClose } />
}
{ children }
</div>
</div>
Expand Down
17 changes: 13 additions & 4 deletions components/popover/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@
background: $white;
height: 100%;

&:focus {
box-shadow: $button-focus-style;
.components-popover.is-mobile & {
height: calc( 100% - #{ $panel-header-height } );
border-top: 0;
}

.components-popover:not(.is-mobile) & {
Expand Down Expand Up @@ -107,9 +108,17 @@
height: 100%;
}

.components-popover__header {
height: $panel-header-height;
background: $light-gray-300;
padding: 0 $panel-padding;
border: 1px solid $light-gray-500;
position: relative;
}

.components-popover__close.components-icon-button {
position: absolute;
top: 0;
right: 0;
top: 6px;
right: 6px;
z-index: z-index( '.components-popover__close' );
}
2 changes: 1 addition & 1 deletion editor/assets/stylesheets/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ $header-height: 56px;
$inserter-tabs-height: 36px;
$block-toolbar-height: 37px;
$sidebar-width: 280px;
$sidebar-panel-header-height: 50px;
$panel-header-height: 50px;
$admin-bar-height: 32px;
$admin-bar-height-big: 46px;
$admin-sidebar-width: 160px;
Expand Down
4 changes: 0 additions & 4 deletions editor/components/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ input[type="search"].editor-inserter__search {
&:focus {
@include input-style__focus-active;
}

.components-popover.is-mobile & {
padding-right: 30px;
}
}

.editor-inserter__category-blocks {
Expand Down
4 changes: 2 additions & 2 deletions editor/sidebar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
overflow: auto;
-webkit-overflow-scrolling: touch;
height: 100%;
padding-top: $sidebar-panel-header-height;
padding-top: $panel-header-height;
margin-top: -1px;
margin-bottom: -1px;

Expand All @@ -46,7 +46,7 @@
top: 0;
left: 0;
right: 0;
height: $sidebar-panel-header-height;
height: $panel-header-height;

@include break-small() {
position: inherit;
Expand Down

0 comments on commit 151066f

Please sign in to comment.