-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sidebar: Add a sidebar to hold the post settings and inspector #449
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
.editor-button { | ||
background: none; | ||
border: none; | ||
outline: none; | ||
|
||
&:disabled { | ||
opacity: 0.6; | ||
} | ||
|
||
&.is-active { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we expect this to be the same styling we'll want for the If so, should we add it here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know? :) I've always been confused with the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a question for @jasmussen for prescribing variations on button state we'll need to support. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking about hover, click and active states these days, across all controls, to ensure consistency. Right now the toggled state is visually the same as :active. Did that answer the question? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This means all the buttons will have the dark gray background when clicked (before releasing the mouse). I'm not sure we want this, do we? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm sorry, I'm tired and wasn't being very clear indeed. My mind has been thinking about the hover state, which right now is blue text and a dark gray outline, which I'm not convinced about. I've been thinking whether we could do the inverted version for both hover, active and toggled. I.e. hover would also have the dark gray background. This is in context of the accessibility and contrast discussions that took place a while back. But we might find that this feels too heavy handed, and that we might be able to have a lighter gray hover+active state, in which case only the toggled state would be dark gray. Bottomline, probably good to not hover/active/toggled states block this PR from being merged, as this is something I will revisit across all buttons later on regardless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'm renaming |
||
background: $dark-gray-500; | ||
color: $white; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,24 +2,35 @@ | |
* External dependencies | ||
*/ | ||
import { connect } from 'react-redux'; | ||
import classnames from 'classnames'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import './style.scss'; | ||
import Header from 'header'; | ||
import Sidebar from 'sidebar'; | ||
import TextEditor from 'modes/text-editor'; | ||
import VisualEditor from 'modes/visual-editor'; | ||
|
||
function Layout( { mode } ) { | ||
function Layout( { mode, sidebarOpened } ) { | ||
const className = classnames( 'editor-layout', { | ||
'sidebar-opened': sidebarOpened | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As a modifier class, I might expect some boolean-ish prefix to the class name, maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yep, that works. |
||
} ); | ||
|
||
return ( | ||
<div> | ||
<div className={ className }> | ||
<Header /> | ||
{ mode === 'text' && <TextEditor /> } | ||
{ mode === 'visual' && <VisualEditor /> } | ||
<div className="editor-layout__content"> | ||
{ mode === 'text' && <TextEditor /> } | ||
{ mode === 'visual' && <VisualEditor /> } | ||
</div> | ||
{ sidebarOpened && <Sidebar /> } | ||
</div> | ||
); | ||
} | ||
|
||
export default connect( ( state ) => ( { | ||
mode: state.mode | ||
mode: state.mode, | ||
sidebarOpened: state.sidebar.opened | ||
} ) )( Layout ); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.editor-layout.sidebar-opened .editor-layout__content { | ||
margin-right: $sidebar-width; | ||
|
||
.editor-text-editor__formatting { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be nested? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It needs to be nested under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could also define this in .editor-text-editor__formatting {
// ...
.editor-layout.is-sidebar-opened & {
// ...
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just learned that we can do |
||
margin-right: $sidebar-width; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Internal Dependencies | ||
*/ | ||
import './style.scss'; | ||
|
||
const Sidebar = () => { | ||
return ( | ||
<div className="editor-sidebar"> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Sidebar; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.editor-sidebar { | ||
position: fixed; | ||
right: 0; | ||
top: 32px + $header-height; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need some breakpoint styling for this. Not sure if we wanted to do that here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll leave this for a more "designy" eyes :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll definitely tackle this separately, it's already on my to-do 😉 |
||
bottom: 0; | ||
width: $sidebar-width; | ||
border-left: 1px solid $light-gray-500; | ||
background: $light-gray-300; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,15 @@ export function mode( state = 'visual', action ) { | |
return state; | ||
} | ||
|
||
export function sidebar( state = { opened: false }, action ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What other properties do you expect this to hold? Wondering if a simpler There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hesitated, I was expecting we may have a property saying we're showing the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's call it PostInspector when the time comes. The idea being that the entire sidebar is the inspector, but when nothing is selected, you are inspecting the post itself, therefore showing the meta boxes. |
||
switch ( action.type ) { | ||
case 'TOGGLE_SIDEBAR': | ||
return { opened: ! state.opened }; | ||
} | ||
|
||
return state; | ||
} | ||
|
||
/** | ||
* Creates a new instance of a Redux store. | ||
* | ||
|
@@ -158,7 +167,8 @@ export function createReduxStore() { | |
blocks, | ||
selectedBlock, | ||
hoveredBlock, | ||
mode | ||
mode, | ||
sidebar | ||
} ); | ||
|
||
return createStore( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend to rename the prop from
isActive
toisToggled
as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I said, "too fast and miss the details" :)