Skip to content

Commit

Permalink
Use margin calculation for full bleed image offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Apr 28, 2017
1 parent 9e5ad31 commit a2d8372
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 14 deletions.
50 changes: 48 additions & 2 deletions blocks/library/image/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,58 @@
}

&[data-align="wide"] {
left: 0;
// Here be dragons...
//
// Variable offsets:
// - Left sidebar
// - Hidden at small viewports
// - Foldable
// - Expanded at medium and above
// - Post settings
// - Collapsed
// - Expanded

left: 50%;
right: 50%;
margin-left: -50vw;
margin-right: -50vw;
width: 100vw;
padding-left: 0;
padding-right: 0;
width: 100%;
max-width: none;

.editor-layout.is-sidebar-opened & {
margin-left: calc( -50vw + #{ $sidebar-width / 2 } );
margin-right: calc( -50vw + #{ $sidebar-width / 2 } );
width: calc( 100vw - #{ $sidebar-width } );
}

@include break-medium() {
margin-left: calc( -50vw + 80px );
margin-right: calc( -50vw + 80px );
width: calc( 100vw - 160px );

.auto-fold &,
.folded & {
margin-left: calc( -50vw + 18px );
margin-right: calc( -50vw + 18px );
width: calc( 100vw - 36px );
}

.editor-layout.is-sidebar-opened & {
margin-left: calc( -50vw + 80px + #{ $sidebar-width / 2 } );
margin-right: calc( -50vw + 80px + #{ $sidebar-width / 2 } );
width: calc( 100vw - 160px - #{ $sidebar-width } );

.auto-fold &,
.folded & {
margin-left: calc( -50vw + 18px + #{ $sidebar-width / 2 } );
margin-right: calc( -50vw + 18px + #{ $sidebar-width / 2 } );
width: calc( 100vw - 36px - #{ $sidebar-width } );
}
}
}

&:before {
left: 0;
border-left-width: 0;
Expand Down
8 changes: 6 additions & 2 deletions editor/layout/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.editor-layout.is-sidebar-opened .editor-layout__content {
margin-right: $sidebar-width;
.editor-layout__content {
overflow: hidden;

.editor-layout.is-sidebar-opened & {
margin-right: $sidebar-width;
}
}
4 changes: 1 addition & 3 deletions editor/modes/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ function VisualEditor( { blocks } ) {
{ blocks.map( ( uid ) => (
<VisualEditorBlock key={ uid } uid={ uid } />
) ) }
<div className="editor-visual-editor__container">
<Inserter />
</div>
<Inserter />
</div>
);
}
Expand Down
9 changes: 2 additions & 7 deletions editor/modes/visual-editor/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.editor-visual-editor {
margin-top: 60px;
margin: 60px auto 0;
max-width: 700px;

&,
& p {
Expand All @@ -9,12 +10,6 @@
}
}

.editor-visual-editor__block,
.editor-visual-editor__container {
max-width: 700px;
margin: 0 auto;
}

.editor-visual-editor__block {
position: relative;
left: -35px;
Expand Down

0 comments on commit a2d8372

Please sign in to comment.