-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement initial media query template functions
| Always adjust media queries to the content individually and not vice-versa. | The design supports the content. Not the other way around. Like documented in the GH-52, Nord Docs uses the mobile-first pattern and follows the great "Google Developer Responsive Web Design guidelines (1). The recommended way is to create media queries not based on any device sizes but individually based on the content which is unique for each project. This is the best practice and, contrary to most popular CSS framework like Bootstrap, the correct way since each site is different and there are thousands of devices and in the future new sizes will appear. Therefore, this commit includes the initial media query template functions that define the smallest `min-width` query `base` (`<320px`) and `minimal` (`>=320px`). References: (1) https://developers.google.com/web/fundamentals/design-and-ux/responsive Associated epic: GH-52 GH-61
- Loading branch information
1 parent
1924af4
commit b209edb
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]> | ||
* Copyright (C) 2018-present Sven Greb <[email protected]> | ||
* | ||
* Project: Nord Docs | ||
* Repository: https://github.com/arcticicestudio/nord-docs | ||
* License: MIT | ||
*/ | ||
|
||
/** | ||
* @author Arctic Ice Studio <[email protected]> | ||
* @author Sven Greb <[email protected]> | ||
* @since 0.3.0 | ||
*/ | ||
|
||
/** | ||
* Breakpoints for the "mobile-first" pattern based on and adjusted to the site content. | ||
* | ||
* @type {Object} | ||
* @since 0.3.0 | ||
*/ | ||
const breakpoints = { minimal: 320 }; | ||
|
||
export default breakpoints; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]> | ||
* Copyright (C) 2018-present Sven Greb <[email protected]> | ||
* | ||
* Project: Nord Docs | ||
* Repository: https://github.com/arcticicestudio/nord-docs | ||
* License: MIT | ||
*/ | ||
|
||
/** | ||
* @author Arctic Ice Studio <[email protected]> | ||
* @author Sven Greb <[email protected]> | ||
* @since 0.2.0 | ||
*/ | ||
|
||
import { em } from "polished"; | ||
|
||
import breakpoints from "./breakpoints"; | ||
import typography from "./typography"; | ||
import { generateMediaQuery } from "./utils"; | ||
|
||
/** | ||
* 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)})`, | ||
breakpoints | ||
}; | ||
|
||
export default media; |