-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bootstrap the widgets screen design (#14612)
- Loading branch information
1 parent
a9f6a1e
commit 1df3021
Showing
15 changed files
with
279 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Button } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
function Header() { | ||
return ( | ||
<div | ||
className="edit-widgets-header" | ||
role="region" | ||
aria-label={ __( 'Widgets screen top bar' ) } | ||
tabIndex="-1" | ||
> | ||
<h1 className="edit-widgets-header__title"> | ||
{ __( 'Block Areas' ) } { __( '(experimental)' ) } | ||
</h1> | ||
|
||
<div className="edit-widgets-header__actions"> | ||
<Button isPrimary isLarge> | ||
{ __( 'Update' ) } | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default Header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.edit-widgets-header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
border-bottom: 1px solid $light-gray-500; | ||
height: $header-height; | ||
background: $white; | ||
z-index: z-index(".edit-widgets-header"); | ||
|
||
left: 0; | ||
right: 0; | ||
// Stick the toolbar to the top, because the admin bar is not fixed on mobile. | ||
top: 0; | ||
position: sticky; | ||
|
||
// On mobile the main content area has to scroll, otherwise you can invoke the overscroll bounce on the non-scrolling container. | ||
@include break-small { | ||
position: fixed; | ||
padding: $grid-size; | ||
top: $admin-bar-height-big; | ||
} | ||
|
||
@include break-medium() { | ||
top: $admin-bar-height; | ||
} | ||
} | ||
@include editor-left(".edit-widgets-header"); | ||
|
||
.edit-widgets-header__title { | ||
font-size: 16px; | ||
padding: 0 20px; | ||
margin: 0; | ||
} | ||
|
||
.edit-widgets-header__actions { | ||
padding: 0 20px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Fragment } from '@wordpress/element'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { navigateRegions } from '@wordpress/components'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Header from '../header'; | ||
import Sidebar from '../sidebar'; | ||
import WidgetArea from '../widget-area'; | ||
|
||
function Layout() { | ||
const areas = [ | ||
__( 'Sidebar' ), | ||
__( 'Footer' ), | ||
__( 'Header' ), | ||
]; | ||
|
||
return ( | ||
<Fragment> | ||
<Header /> | ||
<Sidebar /> | ||
<div | ||
className="edit-widgets-layout__content" | ||
role="region" | ||
aria-label={ __( 'Widgets screen content' ) } | ||
tabIndex="-1" | ||
> | ||
{ areas.map( ( area, index ) => ( | ||
<div key={ index } className="edit-widgets-layout__area"> | ||
<WidgetArea title={ area } initialOpen={ index === 0 } /> | ||
</div> | ||
) ) } | ||
</div> | ||
</Fragment> | ||
); | ||
} | ||
|
||
export default navigateRegions( Layout ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.edit-widgets-layout__content { | ||
min-height: 100%; | ||
background: #f1f1f1; | ||
padding: 30px 0; | ||
|
||
// Temporarily disable the sidebar on mobile | ||
@include break-small() { | ||
margin-right: $sidebar-width; | ||
margin-top: $header-height; | ||
} | ||
} | ||
|
||
.edit-widgets-layout__area { | ||
max-width: $content-width; | ||
margin: 0 auto 30px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Panel } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
function Sidebar() { | ||
return ( | ||
<div | ||
className="edit-widgets-sidebar" | ||
role="region" | ||
aria-label={ __( 'Widgets advanced settings' ) } | ||
tabIndex="-1" | ||
> | ||
<Panel header={ __( 'Block Areas' ) } /> | ||
</div> | ||
); | ||
} | ||
|
||
export default Sidebar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.edit-widgets-sidebar { | ||
position: fixed; | ||
z-index: z-index(".edit-widgets-sidebar"); | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
width: $sidebar-width; | ||
border-left: $border-width solid $light-gray-500; | ||
background: $white; | ||
color: $dark-gray-500; | ||
height: 100vh; | ||
overflow: hidden; | ||
|
||
@include break-small() { | ||
top: $admin-bar-height-big + $header-height; | ||
z-index: z-index(".edit-post-sidebar {greater than small}"); | ||
height: auto; | ||
overflow: auto; | ||
-webkit-overflow-scrolling: touch; | ||
} | ||
|
||
@include break-medium() { | ||
top: $admin-bar-height + $header-height; | ||
} | ||
|
||
// Temporarily disable the sidebar on mobile | ||
display: none; | ||
@include break-small() { | ||
display: block; | ||
} | ||
|
||
> .components-panel { | ||
margin-top: -1px; | ||
margin-bottom: -1px; | ||
border-left: 0; | ||
border-right: 0; | ||
|
||
> .components-panel__header { | ||
background: $light-gray-200; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Panel, PanelBody } from '@wordpress/components'; | ||
import { | ||
BlockEditorProvider, | ||
BlockList, | ||
} from '@wordpress/block-editor'; | ||
import { useState } from '@wordpress/element'; | ||
|
||
function WidgetArea( { title, initialOpen } ) { | ||
const [ blocks, updateBlocks ] = useState( [] ); | ||
|
||
return ( | ||
<Panel> | ||
<PanelBody | ||
title={ title } | ||
initialOpen={ initialOpen } | ||
> | ||
<BlockEditorProvider | ||
value={ blocks } | ||
onInput={ updateBlocks } | ||
onChange={ updateBlocks } | ||
> | ||
<BlockList /> | ||
</BlockEditorProvider> | ||
</PanelBody> | ||
</Panel> | ||
); | ||
} | ||
|
||
export default WidgetArea; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters