Browse Source

Set up basic template

master v0.0.5
F.W. Dekker 1 year ago
commit
d7315ceffe
Signed by: FWDekker GPG Key ID: B1B567AF58D6EE0F
  1. 11
      .editorconfig
  2. 1
      .gitattributes
  3. 120
      .gitignore
  4. 21
      LICENSE
  5. 2
      README.md
  6. 44
      package-lock.json
  7. 19
      package.json
  8. 63
      src/main/js/Template.js

11
.editorconfig

@ -0,0 +1,11 @@
root = true
[*]
charset = utf-8
trim_trailing_whitespace = true
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4

1
.gitattributes

@ -0,0 +1 @@
package-lock.json binary

120
.gitignore

@ -0,0 +1,120 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.*
## Custom
build/

21
LICENSE

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Felix W. Dekker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2
README.md

@ -0,0 +1,2 @@
# FWDekker Template
The template used on many pages on fwdekker.com.

44
package-lock.json

@ -0,0 +1,44 @@
{
"name": "@fwdekker/template",
"version": "0.0.5",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"browser-split": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/browser-split/-/browser-split-0.0.0.tgz",
"integrity": "sha1-QUGcrvdpdVkp3VGJZ9PuwKYmJ3E="
},
"class-list": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/class-list/-/class-list-0.1.1.tgz",
"integrity": "sha1-m5dFGSxBebXaCg12M2WOPHDXlss=",
"requires": {
"indexof": "0.0.1"
}
},
"html-element": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/html-element/-/html-element-2.3.1.tgz",
"integrity": "sha512-xnFt2ZkbFcjc+JoAtg3Hl89VeEZDjododu4VCPkRvFmBTHHA9U1Nt6hLUWfW2O+6Sl/rT1hHK/PivleX3PdBJQ==",
"requires": {
"class-list": "~0.1.1"
}
},
"hyperscript": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hyperscript/-/hyperscript-2.0.2.tgz",
"integrity": "sha1-ODnLpFVUvf4nu4HCFC0WhPgTWvU=",
"requires": {
"browser-split": "0.0.0",
"class-list": "~0.1.0",
"html-element": "^2.0.0"
}
},
"indexof": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz",
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
}
}
}

19
package.json

@ -0,0 +1,19 @@
{
"name": "@fwdekker/template",
"version": "0.0.5",
"description": "The template used on many pages on fwdekker.com.",
"author": "Felix W. Dekker (https://fwdekker.com)",
"license": "MIT",
"homepage": "https://git.fwdekker.com/FWDekker/fwdekker-template",
"repository": {
"type": "git",
"url": "git@git.fwdekker.com:FWDekker/fwdekker-template.git"
},
"bugs": {
"url": "https://git.fwdekker.com/FWDekker/fwdekker-template/issues"
},
"main": "src/main/js/Template.js",
"dependencies": {
"hyperscript": "^2.0.2"
}
}

63
src/main/js/Template.js

@ -0,0 +1,63 @@
const h = require("hyperscript");
/**
* Creates a header element with the given title and description.
*
* @param title {string} the title to display
* @param description {string} the description to display
* @returns {HTMLElement} a header element
*/
exports.header = function ({title, description}) {
return h("header.header",
h("section.container",
h("h1", title),
h("p", h("em", description))
)
);
}
/**
* Creates a footer element with the given data.
*
* @param [author] {string} the author
* @param [authorURL] {string} the URL to link the author's name to
* @param [license] {string} the type of license
* @param [licenseURL] {string} the URL to the license file
* @param [vcs] {string} the type of version control
* @param [vcsURL] {string} the URL to the repository
* @param [version] {string} the page version
* @returns {HTMLElement} a footer element
*/
exports.footer = function ({author, authorURL, license, licenseURL, vcs, vcsURL, version}) {
return h("footer.footer",
h("section.container",
footerLink("Made by ", author, authorURL, ". "),
footerLink("Licensed under the ", license, licenseURL, ". "),
footerLink("Source code available on ", vcs, vcsURL, ". "),
h("div", version || "", {style: {"float": "right"}})
)
);
}
/**
* Constructs a link that is used in footers.
*
* @param prefix {string} the text to display before the text if the text is not undefined
* @param text {string|undefined} the text to display, or `undefined` if the returned element should be empty
* @param url {string|undefined} the URL to link the text to, or `undefined` if the text should not be a link
* @param suffix {string} the text to display after the text if the text is not undefined
* @returns {HTMLElement} a footer link element
*/
const footerLink = function (prefix, text, url, suffix) {
if (text === undefined) return h("span");
return h("span",
h("span", prefix),
url !== undefined
? h("a", text, {href: url})
: h("span", text),
h("span", suffix)
);
}
Loading…
Cancel
Save