From 81caaa2ebed066f80939b04f565b307ec0dd2d61 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 10 Sep 2020 16:12:09 +0300 Subject: Split web things into subdirectories --- web/src/spinner.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 web/src/spinner.js (limited to 'web/src/spinner.js') diff --git a/web/src/spinner.js b/web/src/spinner.js new file mode 100644 index 0000000..b44740e --- /dev/null +++ b/web/src/spinner.js @@ -0,0 +1,31 @@ +// Copyright (c) 2020 Tulir Asokan +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at http://mozilla.org/MPL/2.0/. +import { html } from "../lib/htm/preact.js" + +export const Spinner = ({ size = 40, noCenter = false, noMargin = false, green = false }) => { + let margin = 0 + if (!isNaN(+size)) { + size = +size + margin = noMargin ? 0 : `${Math.round(size / 6)}px` + size = `${size}px` + } + const noInnerMargin = !noCenter || !margin + const comp = html` +
+
+
+
+
+
+
+
+ ` + if (!noCenter) { + return html`
${comp}
` + } + return comp +} -- cgit v1.2.3