Make header title optional

This commit is contained in:
Florine W. Dekker 2020-05-16 18:13:19 +02:00
parent 50393fe631
commit e094cdcfa6
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
3 changed files with 6 additions and 5 deletions

BIN
package-lock.json generated

Binary file not shown.

View File

@ -1,6 +1,6 @@
{ {
"name": "@fwdekker/template", "name": "@fwdekker/template",
"version": "0.0.13", "version": "0.0.14",
"description": "The base template for pages on fwdekker.com.", "description": "The base template for pages on fwdekker.com.",
"author": "Felix W. Dekker (https://fwdekker.com)", "author": "Felix W. Dekker (https://fwdekker.com)",
"license": "MIT", "license": "MIT",
@ -21,7 +21,8 @@
"dependencies": { "dependencies": {
"hyperscript": "^2.0.2", "hyperscript": "^2.0.2",
"milligram": "^1.3.0", "milligram": "^1.3.0",
"normalize.css": "^8.0.1" "normalize.css": "^8.0.1",
"npm-check-updates": "^6.0.1"
}, },
"devDependencies": { "devDependencies": {
"css-loader": "^3.5.3", "css-loader": "^3.5.3",
@ -31,7 +32,7 @@
"grunt-focus": "^1.0.0", "grunt-focus": "^1.0.0",
"grunt-webpack": "^3.1.3", "grunt-webpack": "^3.1.3",
"style-loader": "^1.2.1", "style-loader": "^1.2.1",
"webpack": "^4.42.1", "webpack": "^4.43.0",
"webpack-cli": "^3.3.11" "webpack-cli": "^3.3.11"
} }
} }

View File

@ -77,14 +77,14 @@ const unpackEntry = function (entry) {
/** /**
* Creates a header element with the given title and description. * Creates a header element with the given title and description.
* *
* @param title {string} the title to display, possibly including HTML * @param [title] {string} the title to display, possibly including HTML
* @param [description] {string} the description to display, possibly including HTML * @param [description] {string} the description to display, possibly including HTML
* @returns {HTMLElement} a header element * @returns {HTMLElement} a header element
*/ */
export const header = function ({title, description}) { export const header = function ({title, description}) {
return h("header.header", return h("header.header",
h("section.container", h("section.container",
h("h1", {innerHTML: title}), title !== undefined ? h("h1", {innerHTML: title}) : undefined,
description !== undefined ? h("p", h("em", {innerHTML: description})) : undefined description !== undefined ? h("p", h("em", {innerHTML: description})) : undefined
) )
); );