-
-
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.
Browse files
Browse the repository at this point in the history
…query-setup Base Media Query Setup
- Loading branch information
Showing
5 changed files
with
100 additions
and
3 deletions.
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; |
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,35 @@ | ||
/* | ||
* 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 | ||
*/ | ||
|
||
import { css } from "styled-components"; | ||
|
||
/** | ||
* Generates a tag function for the specified media query that can be used to automatically wrap the tagged template | ||
* literal in its media query. | ||
* | ||
* @param {string} query The string or template literal containing the media query features | ||
* @returns {function} The tag function for the specified media query | ||
* @see https://www.styled-components.com/docs/advanced#media-templates | ||
* @see https://www.styled-components.com/docs/api#css | ||
* @since 0.3.0 | ||
*/ | ||
const generateMediaQuery = (...query) => (...rules) => | ||
css` | ||
@media ${css(...query)} { | ||
${css(...rules)}; | ||
} | ||
`; | ||
|
||
export default generateMediaQuery; |
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