Skip to content

Commit

Permalink
Adjust and improve CSS media query breakpoints
Browse files Browse the repository at this point in the history
Since Nord Docs makes use of the responsive design best practice to set
breakpoints based on the content, this commit updates the currently used
breakpoint upper and lower boundary values to fit the compnents that'll
implement for this feature.

GH-64
  • Loading branch information
arcticicestudio committed Dec 13, 2018
1 parent e599573 commit 1db3a8c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/styles/theme/breakpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
* @type {Object}
* @since 0.3.0
*/
const breakpoints = { minimal: 320 };
const breakpoints = {
phoneLandscapeUpperBoundary: 480,
tabletPortraitLowerBoundary: 600,
tabletLandscapeLowerBoundary: 900,
desktopLowerBoundary: 1200,
desktopPlusLowerBoundary: 1800
};

export default breakpoints;
1 change: 1 addition & 0 deletions src/styles/theme/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export {
colors,
generateMediaQuery,
globals,
media,
motion,
nord,
normalize,
Expand Down
10 changes: 8 additions & 2 deletions src/styles/theme/media.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ import breakpoints from "./breakpoints";
import typography from "./typography";
import { generateMediaQuery } from "./utils";

const query = value => em(value, typography.sizes.root);

/**
* Provides media query template functions based on the configured breakpoints.
*
* @type {Object}
* @since 0.3.0
*/
const media = {
base: generateMediaQuery`(max-width: ${em(breakpoints.minimal - 1, typography.sizes.root)})`,
minimal: generateMediaQuery`(min-width: ${em(breakpoints.minimal, typography.sizes.root)})`,
phonePortrait: generateMediaQuery`(max-width: ${query(breakpoints.phoneLandscapeUpperBoundary - 1)})`,
phoneLandscape: generateMediaQuery`(min-width: ${query(breakpoints.phoneLandscapeUpperBoundary)})`,
tabletPortrait: generateMediaQuery`(min-width: ${query(breakpoints.tabletPortraitLowerBoundary)})`,
tabletLandscape: generateMediaQuery`(min-width: ${query(breakpoints.tabletLandscapeLowerBoundary)})`,
desktop: generateMediaQuery`(min-width: ${query(breakpoints.desktopLowerBoundary)})`,
desktopPlus: generateMediaQuery`(min-width: ${query(breakpoints.desktopPlus)})`,
breakpoints
};

Expand Down

0 comments on commit 1db3a8c

Please sign in to comment.