Skip to content

Commit

Permalink
Assign grid areas to diffrent alignment combinations.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtias committed Apr 3, 2018
1 parent 48028f7 commit f211200
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 52 deletions.
29 changes: 26 additions & 3 deletions edit-post/components/visual-editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
grid-template-columns:
[full-start] minmax(1em, 1fr)
[wide-start] minmax(0, 1fr)
[content-start] minmax(0, 700px) [content-end]
[content-start] minmax(0, 350px) [middle] minmax(0, 350px) [content-end]
minmax(0, 1fr) [wide-end]
minmax(1em, 1fr) [full-end];

> div,
> div > .block-list {
.editor-writing-flow,
.editor-writing-flow > div,
.editor-writing-flow > div > div,
.editor-writing-flow > div > div > div,
.editor-writing-flow .editor-block-list__layout {
grid-column: full;
display: inherit;
grid-template-columns: inherit;
Expand Down Expand Up @@ -70,6 +73,26 @@
}
}

&[data-align="card"] {
grid-column: wide-start / middle;


+ div {
grid-column: middle / wide-end;
align-self: center;
}
}

&[data-align="left"] {
grid-column: wide-start / content-start;
height: 0;
}

&[data-align="right"] {
grid-column: content-end / wide-end;
height: 0;
}

&[data-align="wide"] {
// max-width: 1100px;
grid-column: wide;
Expand Down
98 changes: 49 additions & 49 deletions editor/components/block-list/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -259,55 +259,55 @@
* Alignments
*/

&[data-align="left"],
&[data-align="right"] {
// Without z-index, won't be clickable as "above" adjacent content
z-index: z-index( '.editor-block-list__block {core/image aligned left or right}' );
width: 100%;

// When images are floated, the block itself should collapse to zero height
margin-bottom: 0;

// Hide block outline when an image is floated
&:before {
content: none;
}
}

// Apply max-width to floated items that have no intrinsic width, like Cover Image or Gallery
&[data-align="left"],
&[data-align="right"] {
> .editor-block-list__block-edit {
max-width: 360px;
width: 100%;
}

// reset when data-resized
&[data-resized="true"] > .editor-block-list__block-edit {
max-width: none;
width: auto;
}
}

// Left
&[data-align="left"] {
.editor-block-list__block-edit { // This is in the editor only, on the frontend, the img should be floated
float: left;
margin-right: 2em;
}
}

// Right
&[data-align="right"] {
.editor-block-list__block-edit { // This is in the editor only, on the frontend, the img should be floated
float: right;
margin-left: 2em;
}

.editor-block-toolbar {
float: right;
}
}
// &[data-align="left"],
// &[data-align="right"] {
// // Without z-index, won't be clickable as "above" adjacent content
// z-index: z-index( '.editor-block-list__block {core/image aligned left or right}' );
// width: 100%;
//
// // When images are floated, the block itself should collapse to zero height
// margin-bottom: 0;
//
// // Hide block outline when an image is floated
// &:before {
// content: none;
// }
// }
//
// // Apply max-width to floated items that have no intrinsic width, like Cover Image or Gallery
// &[data-align="left"],
// &[data-align="right"] {
// > .editor-block-list__block-edit {
// max-width: 360px;
// width: 100%;
// }
//
// // reset when data-resized
// &[data-resized="true"] > .editor-block-list__block-edit {
// max-width: none;
// width: auto;
// }
// }
//
// // Left
// &[data-align="left"] {
// .editor-block-list__block-edit { // This is in the editor only, on the frontend, the img should be floated
// float: left;
// margin-right: 2em;
// }
// }
//
// // Right
// &[data-align="right"] {
// .editor-block-list__block-edit { // This is in the editor only, on the frontend, the img should be floated
// float: right;
// margin-left: 2em;
// }
//
// .editor-block-toolbar {
// float: right;
// }
// }

// Wide and full-wide
&[data-align="full"],
Expand Down

0 comments on commit f211200

Please sign in to comment.