Skip to content
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

feat(layout-grid): Add fixed column width layout grid modifier. #816

Merged
merged 1 commit into from
Jun 22, 2017

Conversation

yeelan0319
Copy link
Contributor

Closes #748.

@yeelan0319 yeelan0319 added this to the Layout Improvement milestone Jun 13, 2017
@yeelan0319 yeelan0319 force-pushed the feat/fixed-column-width-layout-grid branch 2 times, most recently from abd9153 to 7084558 Compare June 14, 2017 14:33
@traviskaufman traviskaufman self-requested a review June 14, 2017 14:44
Copy link
Contributor

@traviskaufman traviskaufman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 💯 Looks great

@codecov-io
Copy link

codecov-io commented Jun 14, 2017

Codecov Report

Merging #816 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #816   +/-   ##
=======================================
  Coverage   99.93%   99.93%           
=======================================
  Files          68       68           
  Lines        3144     3144           
  Branches      387      387           
=======================================
  Hits         3142     3142           
  Misses          2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 184897b...3022b65. Read the comment docs.

@@ -342,6 +384,21 @@
document.documentElement.style.setProperty('--mdc-layout-grid-gutter-phone', gutterSelectPhone.value);
});

var ColumnWidthSelectDesktop = document.querySelector('#desktop-column-width');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason these variables are capitalized?

A grid consists of a group of cells, which get positioned in sequence according to a predefined number of columns.
Cells specify how many columns to span (the default being 4), and get placed side by side while there is room. When
there isn't enough room for a cell, it gets moved to the beginning of the next row, and placement continues as usual.
A grid is a container that consists of a group of cells. The grids can define its own max-width or designate its column to be a certain width. Cells get positioned in sequence according to a predefined number of columns.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The grids"...do you mean "the cells"? I thought there was only one grid

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. The grids I meant for mdc grids in general, but it seems use single will remove some confusion, changing that.


The grid has 12 columns in desktop mode (>= 840px), 8 columns in tablet mode (>= 480px), and 4 columns in phone mode
(< 480px). Column widths are variable; margins and gutters are fixed, with columns taking up the remainder of the space.
(< 480px). Cells specify how many columns to span (the default being 4), and get placed side by side while there is room. When there isn't enough room for a cell, it gets moved to the beginning of the next row, and placement continues as usual.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cells specify how many columns to span (the default is 4). Cells are placed side by side until there is no more room, then the next cell is placed at the beginning of the next row.


Margins (the space between the edge of the grid and the edge of the first cell) and gutters (the space between edges of adjacent cells) can be customized on different devices respectively based on design needs. Layout grids set default margins and gutters to 24px on desktop, 16px on tablet and phone, according to the Material Design spec.
Margins (the space between the edge of the grid and the edge of the first cell) and gutters (the space between edges of adjacent cells) can be customized on different devices respectively based on design needs. The columns are evenly distributed after container minus all margin and gutter width. Layout grids set default margins and gutters to 24px on desktop, 16px on tablet and phone, according to the Material Design spec.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The columns are evenly distributed within the container width, minus the width of all margins and gutters.

@@ -122,3 +122,17 @@
align-self: stretch;
}
}

@mixin mdc-layout-grid-fixed-column-width($size, $margin, $gutter, $column-width) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$size is kinda a vague variable...can it be $platform-type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add the same error handling in the sass as we do in mdc-theme? e.g.:

  @if not map-has-key($mdc-layout-grid-columns, $size) {
    @error "Invalid style specified! Choose one of #{map-keys($mdc-layout-grid-columns)}";
  }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the original code meant screen-size and I don't think it is vague. Since we both documented that clearly and do the type check, I feel fine to leave just as it is. WDYT?

@@ -122,3 +122,17 @@
align-self: stretch;
}
}

@mixin mdc-layout-grid-fixed-column-width($size, $margin, $gutter, $column-width) {
$columns: map-get($mdc-layout-grid-columns, $size);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$columnCount?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing:)

Copy link
Contributor

@amsheehan amsheehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, one improvement requested 😺

@@ -122,3 +122,17 @@
align-self: stretch;
}
}

@mixin mdc-layout-grid-fixed-column-width($size, $margin, $gutter, $column-width) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add the same error handling in the sass as we do in mdc-theme? e.g.:

  @if not map-has-key($mdc-layout-grid-columns, $size) {
    @error "Invalid style specified! Choose one of #{map-keys($mdc-layout-grid-columns)}";
  }

@@ -36,6 +36,12 @@ $mdc-layout-grid-default-gutter: (
phone: 16px
) !default;

$mdc-layout-grid-column-width: (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe $mdc-layout-grid-platform-column-widths? It more closely follows the naming conventions of this pattern in other components.

It would obviously have to be changed in _mixins.scss as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to look up for this pattern but haven't seen any one have this pattern 😞 The thing I search and found that use sass map to define different property based on screen size only appears in mdc-layout-grid.

Not sure if I misunderstand what you meant here, could you elaborate a bit?

@yeelan0319 yeelan0319 force-pushed the feat/fixed-column-width-layout-grid branch from 7084558 to 3022b65 Compare June 15, 2017 18:57
Copy link
Contributor

@amsheehan amsheehan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@yeelan0319 yeelan0319 merged commit 94d62ad into master Jun 22, 2017
@yeelan0319 yeelan0319 deleted the feat/fixed-column-width-layout-grid branch August 25, 2017 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants