forked from expressjs/generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request expressjs#77 from jessestuart/jesse/add_line_heigh…
…t_options [feat] Add module to configure `line-height`.
- Loading branch information
Showing
9 changed files
with
148 additions
and
11 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
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,33 @@ | ||
const { step, mqSteps } = require('./docs-helper') | ||
|
||
const docs = (_, mqs) => ` | ||
/* | ||
LINE HEIGHT / Leading | ||
Docs: http://tachyons.io/docs/typography/line-height/ | ||
Base: | ||
lh = line-height | ||
Media Query Extensions: | ||
${mqSteps(mqs)} | ||
*/ | ||
` | ||
|
||
const indexLabelMapping = { | ||
0: 'solid', | ||
1: 'title', | ||
2: 'copy', | ||
} | ||
|
||
const css = lineHeights => | ||
lineHeights | ||
.map( | ||
(lineHeight, idx) => | ||
`.lh-${indexLabelMapping[idx]} { line-height: ${lineHeight} }` | ||
) | ||
.join('\n') | ||
|
||
module.exports = { | ||
css, | ||
docs, | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,20 @@ | ||
import test from 'ava' | ||
import fs from 'fs' | ||
import path from 'path' | ||
|
||
import config from '../config' | ||
import tachyonsGenerator from '../' | ||
|
||
test('Line heights fall back to default values when not included.', async t => { | ||
const tachy = tachyonsGenerator() | ||
const { modules: { lineHeight } } = await tachy.generate() | ||
|
||
t.snapshot(lineHeight) | ||
}) | ||
|
||
test('Line heights are generated when included in config.', async t => { | ||
const tachy = tachyonsGenerator({ lineHeight: [1.3, 1.5, 1.7] }) | ||
const { modules: { lineHeight } } = await tachy.generate() | ||
|
||
t.snapshot(lineHeight) | ||
}) |
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
Binary file not shown.
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,75 @@ | ||
# Snapshot report for `test/line-height-test.js` | ||
|
||
The actual snapshot is saved in `line-height-test.js.snap`. | ||
|
||
Generated by [AVA](https://ava.li). | ||
|
||
## Line heights are generated when included in config. | ||
|
||
> Snapshot 1 | ||
`␊ | ||
/*␊ | ||
LINE HEIGHT / Leading␊ | ||
Docs: http://tachyons.io/docs/typography/line-height/␊ | ||
␊ | ||
Base:␊ | ||
lh = line-height␊ | ||
␊ | ||
Media Query Extensions:␊ | ||
-m = 48em␊ | ||
-l = 64em␊ | ||
*/␊ | ||
␊ | ||
.lh-solid { line-height: 1.3 }␊ | ||
.lh-title { line-height: 1.5 }␊ | ||
.lh-copy { line-height: 1.7 }␊ | ||
␊ | ||
@media screen and (min-width: 48em) and (max-width: 64em) {␊ | ||
.lh-solid-m { line-height: 1.3 }␊ | ||
.lh-title-m { line-height: 1.5 }␊ | ||
.lh-copy-m { line-height: 1.7 }␊ | ||
}␊ | ||
␊ | ||
␊ | ||
@media screen and (min-width: 64em) {␊ | ||
.lh-solid-l { line-height: 1.3 }␊ | ||
.lh-title-l { line-height: 1.5 }␊ | ||
.lh-copy-l { line-height: 1.7 }␊ | ||
}␊ | ||
` | ||
|
||
## Line heights fall back to default values when not included. | ||
|
||
> Snapshot 1 | ||
`␊ | ||
/*␊ | ||
LINE HEIGHT / Leading␊ | ||
Docs: http://tachyons.io/docs/typography/line-height/␊ | ||
␊ | ||
Base:␊ | ||
lh = line-height␊ | ||
␊ | ||
Media Query Extensions:␊ | ||
-m = 48em␊ | ||
-l = 64em␊ | ||
*/␊ | ||
␊ | ||
.lh-solid { line-height: 1 }␊ | ||
.lh-title { line-height: 1.25 }␊ | ||
.lh-copy { line-height: 1.5 }␊ | ||
␊ | ||
@media screen and (min-width: 48em) and (max-width: 64em) {␊ | ||
.lh-solid-m { line-height: 1 }␊ | ||
.lh-title-m { line-height: 1.25 }␊ | ||
.lh-copy-m { line-height: 1.5 }␊ | ||
}␊ | ||
␊ | ||
␊ | ||
@media screen and (min-width: 64em) {␊ | ||
.lh-solid-l { line-height: 1 }␊ | ||
.lh-title-l { line-height: 1.25 }␊ | ||
.lh-copy-l { line-height: 1.5 }␊ | ||
}␊ | ||
` |
Binary file not shown.