UNPKG

@codedoc/core

Version:

Create beautiful modern documentation websites.

17 lines 1.15 kB
import { isCountable } from './types'; import { defaults } from './defaults'; function schemeString(options) { return `no-preference: ${options.color === 'Dark' ? 'dark' : 'light'};` + ` light: ${options.colorLight === 'Dark' ? 'dark' : 'light'};` + ` dark: ${options.colorDark === 'Light' ? 'light' : 'dark'};`; } function isTrue(val) { return val === true || val === 'true'; } export function GithubButton(options, renderer) { const _defaults = defaults(options); return renderer.create("fragment", null, renderer.create("script", { async: true, defer: true, src: "https://buttons.github.io/buttons.js" }), renderer.create("a", { class: "github-button", "data-color-scheme": schemeString(options), "data-icon": isTrue(options.standardIcon) ? false : (options.icon || _defaults.icon || false), "data-show-count": isCountable(options) ? (isTrue(options.count) ? 'true' : false) : false, "data-size": isTrue(options.large) ? 'large' : false, href: options.link || _defaults.link }, options.label || _defaults.label)); } export * from './types'; export * from './search'; //# sourceMappingURL=index.js.map