From 38f59bab31489300088b702c876d01fdbf4fe6cb Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sat, 28 Jan 2023 18:34:26 +1100 Subject: [PATCH] style(menu): add welcome banner --- src/core/menu/islands/Banner.mjs | 97 ++++++++++++++++++++++++++++++++ src/core/menu/menu.mjs | 6 +- 2 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 src/core/menu/islands/Banner.mjs diff --git a/src/core/menu/islands/Banner.mjs b/src/core/menu/islands/Banner.mjs new file mode 100644 index 0000000..4180889 --- /dev/null +++ b/src/core/menu/islands/Banner.mjs @@ -0,0 +1,97 @@ +/** + * notion-enhancer + * (c) 2023 dragonwocky (https://dragonwocky.me/) + * (https://notion-enhancer.github.io/) under the MIT license + */ + +import { setState, useState } from "../state.mjs"; + +const rectToStyle = (rect) => + ["width", "height", "top", "bottom", "left", "right"] + .filter((prop) => rect[prop]) + .map((prop) => `${prop}: ${rect[prop]};`) + .join(""); + +function Star(rect) { + const { html } = globalThis.__enhancerApi; + return html` + + + + + + + + + + `; +} + +function Circle(rect) { + const { html } = globalThis.__enhancerApi; + return html`
`; +} + +function Banner({ version }) { + const { html } = globalThis.__enhancerApi; + // gradient bg? + // brand font? links? + return html`
+ <${Circle} width="128px" height="128px" bottom="-64px" left="-64px" /> + <${Circle} width="144px" height="144px" top="-108px" left="80px" /> + <${Circle} width="208px" height="208px" bottom="-64px" right="-16px" /> + <${Circle} width="144px" height="144px" bottom="-72px" right="144px" /> + <${Star} width="36px" height="36px" top="136px" left="190px" /> + <${Star} width="48px" height="48px" top="32px" left="336px" /> + <${Star} width="64px" height="64px" top="90px" left="448px" /> + +

+ Welcome to
+ the notion-enhancer +

+ +
+ + v${version} + +
+
`; +} + +export { Banner }; diff --git a/src/core/menu/menu.mjs b/src/core/menu/menu.mjs index cf22a09..0bd6dab 100644 --- a/src/core/menu/menu.mjs +++ b/src/core/menu/menu.mjs @@ -7,6 +7,7 @@ import { setState, useState } from "./state.mjs"; import { Sidebar } from "./islands/Sidebar.mjs"; import { Footer } from "./islands/Footer.mjs"; +import { Banner } from "./islands/Banner.mjs"; import { View } from "./islands/View.mjs"; import { List } from "./islands/List.mjs"; import { Mod } from "./islands/Mod.mjs"; @@ -81,7 +82,8 @@ const categories = [ ]; const render = async () => { - const { html, getMods, isEnabled, setEnabled } = globalThis.__enhancerApi, + const { html, enhancerVersion } = globalThis.__enhancerApi, + { getMods, isEnabled, setEnabled } = globalThis.__enhancerApi, [icon, renderStarted] = useState(["icon", "renderStarted"]); if (!html || !getMods || !icon || renderStarted) return; if (icon === "Monochrome") sidebar[1].icon += "?mask"; @@ -118,7 +120,7 @@ const render = async () => {
- <${View} id="welcome">welcome + <${View} id="welcome"><${Banner} version=${enhancerVersion} /> <${View} id="core"> <${Options} mod=${mods.find(({ _src }) => _src === "core")} /> <${Profiles} />