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

Different way of setting up modular spacing #704

Merged
merged 25 commits into from
Nov 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d52ea19
Proof of concept; created nested map for modular spacing values inste…
yvonnetangsu Aug 4, 2020
394a0e1
Merge master
yvonnetangsu Oct 3, 2020
86074dc
Add modular-spacing-new mixin to use the nested map method
yvonnetangsu Oct 3, 2020
a8da87e
formatting fixup
yvonnetangsu Oct 3, 2020
2e72f93
fixup doc
yvonnetangsu Oct 3, 2020
c27961c
fixup and doc
yvonnetangsu Oct 3, 2020
6666f9c
No need to write media query for mobile breakpoint
yvonnetangsu Oct 5, 2020
bb77e86
cc fix
yvonnetangsu Oct 5, 2020
1adc64f
semicolon fixup
yvonnetangsu Oct 5, 2020
01bf11c
Update _modular-spacing-new.scss
sherakama Oct 6, 2020
8cf5816
Update core/src/scss/utilities/functions/modular-scale/_get-modular-s…
yvonnetangsu Oct 6, 2020
a563662
Update core/src/scss/utilities/functions/modular-scale/_get-modular-s…
yvonnetangsu Oct 6, 2020
a11bdb7
Merge branch 'master' into modular-spacing-map
yvonnetangsu Oct 8, 2020
77c40e0
WIP - renaming mixin to responsive-spacing
yvonnetangsu Oct 8, 2020
bdcb6be
Separate responsive-spacing map into its own variable file
yvonnetangsu Oct 9, 2020
57aa822
Merge branch 'master' of github.com:SU-SWS/decanter into modular-spac…
sherakama Nov 4, 2020
c514028
Merge branch 'modular-spacing-map' of github.com:SU-SWS/decanter into…
sherakama Nov 4, 2020
67996b1
Update and render.
sherakama Nov 4, 2020
1eda60b
Add deprecation notices.
sherakama Nov 4, 2020
2bc9873
Replace more modular-spacing calls in our components.
sherakama Nov 4, 2020
2a6cda6
Replace more modular-spacing calls in our components.
sherakama Nov 4, 2020
c1f444e
Changelog start.
sherakama Nov 4, 2020
a152035
Changelog.
sherakama Nov 4, 2020
79b125b
fixup! node versions.
sherakama Nov 4, 2020
eb9fe1d
fixup! node versions.
sherakama Nov 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.8.0
14
3 changes: 2 additions & 1 deletion .tugboat/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install 14.8.0
nvm install
cd styleguide
nvm use
npm install
Expand All @@ -24,6 +24,7 @@ services:
NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
cd styleguide
nvm install
nvm use
npm install "https://github.com/su-sws/decanter.git#${TUGBOAT_GITHUB_HEAD}" --save --force
npm audit fix
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

Version 6.2.0 2020-11-04
---------------------------------------------
- Added responsive-spacing mixin to replace modular-spacing
- Added deprecation notices for Noto-Sans and Kalam fonts
- D8CORE-1261: Revised table styles. (#617)
- D8CORE-1623: Adding a mixin and icons for `@include icon` (#690)

Version 6.1.3 2020-09-23
---------------------------------------------

Expand Down Expand Up @@ -139,7 +146,7 @@ Version 5.1.0 2019-10-31
- New Mixin: `link-glyph()`
- New Mixin: `link-icon()`
- New Function: `breakpoint-previous`
- New Typography styles:
- New Typography styles:
-- `.su-type-a`: Display Type A (used for H1 heading)
-- `.su-type-b`: Display Type B (used for H2 heading)
-- `.su-type-c`: Display Type C (used for H3 heading)
Expand Down
4 changes: 2 additions & 2 deletions DEPRECATIONS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Deprecation Notices

*Deprecated in 6.1.14*

*Deprecated in 6.2.0*
- `modular-spacing` mixin will be removed in Version 7. Please use `responsive-spacing` instead.
- Noto Sans Font will be removed in Version 7
- Kalam Font will be removed in Version 7.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [Decanter](https://github.com/SU-SWS/decanter)
##### Version: 6.1.3-dev
##### Version: 6.2.0

Changelog: [CHANGELOG.md](CHANGELOG.md)

Expand All @@ -21,5 +21,5 @@ Accessibility
---
[![WCAG Conformance 2.0 AA Badge](https://www.w3.org/WAI/wcag2AA-blue.png)](https://www.w3.org/TR/WCAG20/)

Evaluation Date: 2020-09-01
Evaluation Date: 2020-09-01
This project conforms to level AA WCAG 2.0 standards as required by the university's accessibility policy. For more information on the policy please visit: [https://ucomm.stanford.edu/policies/accessibility-policy.html](https://ucomm.stanford.edu/policies/accessibility-policy.html).
5 changes: 5 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Upgrade

Upgrade from version 6.1.4 to 6.2.0
-----------------------------------

Find and replace all occurances of modular-spacing with responsive-spacing.

Upgrade from version 6.0.6 to 6.1.0
-----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion core/dist/css/decanter.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/dist/js/decanter-no-markup.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/dist/js/decanter.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions core/src/scss/components/accordion/_accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

.su-accordion__collapse-all {
@include modular-spacing('margin', null null 2);
@include responsive-spacing('margin', null null 2);
@include margin(null null null 1.2em);
}

Expand All @@ -51,7 +51,7 @@

> .su-accordion__button {
all: inherit;
@include modular-spacing('padding', 0);
@include responsive-spacing('padding', 0);
@include fancy-hover($su-color-black, $su-color-black, 'left', 6px);
font-weight: $su-font-bold;
position: relative;
Expand Down Expand Up @@ -90,7 +90,7 @@
}

.su-accordion__content {
@include modular-spacing('padding', 0 0 null);
@include responsive-spacing('padding', 0 0 null);
height: auto;

&[aria-hidden="true"] {
Expand All @@ -101,7 +101,7 @@
}

.su-accordion__cta {
@include modular-spacing('margin', 3 null null);
@include responsive-spacing('margin', 3 null null);
@include margin(null auto);
display: block;
width: fit-content;
Expand Down
6 changes: 3 additions & 3 deletions core/src/scss/components/alert/_alert.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// Dismiss close button.
// -----------------------------------------------------------------------------
.su-alert__dismiss {
@include modular-spacing('margin', null null null 1);
@include responsive-spacing('margin', null null null 1);
order: 3;
height: 100%;
align-content: flex-end;
Expand Down Expand Up @@ -71,7 +71,7 @@
// Flex header with the icon and message type label.
// -----------------------------------------------------------------------------
.su-alert__header {
@include modular-spacing('margin', null 1 null null);
@include responsive-spacing('margin', null 1 null null);
order: 1;
flex-shrink: 1;

Expand Down Expand Up @@ -197,7 +197,7 @@
}

.su-alert__text + .su-alert__footer {
@include modular-spacing('margin', 0 null null null);
@include responsive-spacing('margin', 0 null null null);
}

.su-alert__dismiss ~ .su-alert__body {
Expand Down
2 changes: 1 addition & 1 deletion core/src/scss/components/card/_card--horizontal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
&.su-card--link > a {
// Set up the grid for this variant.
@include display-grid;
@include modular-spacing('padding', 2);
@include responsive-spacing('padding', 2);

@each $key, $breakpoint in $su-grid-media {
@include grid-media($key) {
Expand Down
4 changes: 2 additions & 2 deletions core/src/scss/components/card/_card--icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
.su-card--icon {
&,
&-font {
@include modular-spacing('padding', 2 null null);
@include responsive-spacing('padding', 2 null null);
text-align: center;

.su-card__contents {
@include modular-spacing('padding', 0 null null);
@include responsive-spacing('padding', 0 null null);
}

&.su-card--minimal {
Expand Down
2 changes: 1 addition & 1 deletion core/src/scss/components/card/_card--minimal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
&:not(.su-card--icon) {
.su-card__contents {
// Reduce top padding to move the contents closer to the image.
@include modular-spacing('padding', 1 null null);
@include responsive-spacing('padding', 1 null null);

@include grid-media-only(xs) {
@include padding(0 null null);
Expand Down
2 changes: 1 addition & 1 deletion core/src/scss/components/date-stacked/_date-stacked.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// Style guide: Simple.Date Stacked
//
.su-date-stacked {
@include modular-spacing('padding', 0);
@include responsive-spacing('padding', 0);
background: color(bg--reverse);
color: color(text--reverse);
max-width: 87px;
Expand Down
4 changes: 2 additions & 2 deletions core/src/scss/components/global-footer/_global-footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// Global styles for the global footer.
.su-global-footer {
@include font-smoothing;
@include modular-spacing('padding', 1 null);
@include responsive-spacing('padding', 1 null);
background-color: color(brand);
color: color(link--reverse);

Expand Down Expand Up @@ -58,7 +58,7 @@
// The Logo.
.su-global-footer__brand {
@include padding(0.5rem null null);
@include modular-spacing('margin', null null -2);
@include responsive-spacing('margin', null null -2);
text-align: center;

a {
Expand Down
2 changes: 1 addition & 1 deletion core/src/scss/components/hero/_hero--caption.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

.su-hero__content {
@include centered-column;
@include modular-spacing(padding, -1 null null);
@include responsive-spacing(padding, -1 null null);
text-align: right;
display: block;
clear: both;
Expand Down
16 changes: 8 additions & 8 deletions core/src/scss/components/local-footer/_local-footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// Lockup placement.
.su-lockup {
@include grid-media-between('xs', 'md') {
@include modular-spacing('margin-bottom', 2);
@include responsive-spacing('margin-bottom', 2);
}

@include grid-media('lg') {
Expand All @@ -60,7 +60,7 @@
border-radius: 7px;

@include grid-media-between('xs', 'md') {
@include modular-spacing('margin-bottom', 1);
@include responsive-spacing('margin-bottom', 1);
width: auto;
}

Expand All @@ -84,14 +84,14 @@
.su-local-footer__header {
@include centered-column;
@include responsive-grid-gap;
@include modular-spacing('padding-top', 3);
@include responsive-spacing('padding-top', 3);
clear: both;
}

// The resposive behaviour for all contents using grid-area
// --------------------------------------------------------
.su-local-footer__columns {
@include modular-spacing('padding-bottom', 3);
@include responsive-spacing('padding-bottom', 3);
grid-template-rows: auto;
grid-template-columns: 1fr 1fr;
grid-template-areas:
Expand Down Expand Up @@ -135,8 +135,8 @@
grid-area: B;

@include grid-media-between('xs', 'md') {
@include modular-spacing('padding-top', 3);
@include modular-spacing('padding-bottom', 1);
@include responsive-spacing('padding-top', 3);
@include responsive-spacing('padding-bottom', 1);
}

@include grid-media-only('md') {
Expand Down Expand Up @@ -194,7 +194,7 @@
}

&:first-of-type {
@include modular-spacing('padding-bottom', 1);
@include responsive-spacing('padding-bottom', 1);
}
}
}
Expand Down Expand Up @@ -248,7 +248,7 @@
// ------------------------------------------------
.su-local-footer__address,
.su-local-footer__action-links {
@include modular-spacing('padding-bottom', 3);
@include responsive-spacing('padding-bottom', 3);
font-size: 16px;
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/scss/components/masthead/_masthead.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
> section:last-of-type {
@include flex-container;
@include centered-column;
@include modular-spacing('padding', 1 null null);
@include responsive-spacing('padding', 1 null null);
}

.su-lockup {
@include modular-spacing('margin', null null 0);
@include responsive-spacing('margin', null null 0);
max-width: fit-content;

@include grid-media-max('md') {
Expand Down
2 changes: 1 addition & 1 deletion core/src/scss/elements/table/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//
table {
@include margin(null 0);
@include modular-spacing('margin-bottom', 5);
@include responsive-spacing('margin-bottom', 5);
border-collapse: collapse;
border-spacing: 0;
min-width: 100%;
Expand Down
12 changes: 12 additions & 0 deletions core/src/scss/utilities/functions/_map-deep-get.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/// Map deep get
/// @author Hugo Giraudel
/// @access public
/// @param {Map} $map - Map
/// @param {Arglist} $keys - Key chain
/// @return {*} - Desired value
@function map-deep-get($map, $keys...) {
sherakama marked this conversation as resolved.
Show resolved Hide resolved
@each $key in $keys {
$map: map-get($map, $key);
}
@return $map;
}
1 change: 1 addition & 0 deletions core/src/scss/utilities/functions/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'breakpoint/index',
'color',
'flex/index',
'map-deep-get',
'modular-scale/index',
'string/index',
'type-checks/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@charset "UTF-8";

///
/// Get a value out of the $su-responsive-spacing-map
///
/// @name get-responsive-spacing-value
///
/// @param {Integer} $step - Integers from -2 to 10 including 0
/// @param {device} $device - `mobile`, `tablet` or `desktop`
/// @param {Map} $map - $su-responsive-spacing-map normally or equivalent
///
/// @group mixin
@function get-responsive-spacing-value($step: 0, $device: 'desktop', $map: $su-responsive-spacing-map) {
$value: map-deep-get($map, $step, $device);
@if ($step < -2 and $step > 10) {
@error 'Responsive spacing step value must be an integer between -2 and 10.';
}
@if $value == null {
@error 'Could not find this spacing value in the $map. Check the parameters.';
}
@return $value;
}
1 change: 1 addition & 0 deletions core/src/scss/utilities/functions/modular-scale/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
@import
'get-modular-spacing-base',
'get-modular-spacing-multiplier',
'get-responsive-spacing-value',
'calculate-modular-spacing';
20 changes: 20 additions & 0 deletions core/src/scss/utilities/mixins/breakpoint/_grid-media-device.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
@charset "UTF-8";

///
/// A helper to quickly generate a media query
///
/// @name su-grid-media-device
///
/// @param {key code} $breakpoint - The breakpoint shortcode - 'mobile', 'tablet' or 'desktop'
///
/// @group mixin
@mixin grid-media-device($breakpoint: 'tablet') {
sherakama marked this conversation as resolved.
Show resolved Hide resolved
@if $breakpoint == 'mobile' {
@content;
}
@else {
@media #{map-get($su-grid-device, $breakpoint)} {
@content;
}
}
}
1 change: 1 addition & 0 deletions core/src/scss/utilities/mixins/breakpoint/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

@import
'grid-media-between',
'grid-media-device',
'grid-media-max',
'grid-media-min',
'grid-media-only',
Expand Down
Loading