Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
help-beta: Make icon + `Keyboard Tip:` a prefix instead of header.
Shubham Padiafd81f5f5fde4
diff --git a/eslint.config.js b/eslint.config.jsindex 188f8f07078..adf0391f9ab 100644--- a/eslint.config.js+++ b/eslint.config.js@@ -313,6 +313,7 @@ export default tseslint.config(files: ["help-beta/src/components/ZulipNote.astro","help-beta/src/components/ZulipTip.astro",+ "help-beta/src/components/KeyboardTip.astro",],rules: {"import/unambiguous": "off",diff --git a/help-beta/src/components/KeyboardTip.astro b/help-beta/src/components/KeyboardTip.astroindex 2916a36ad60..c19e4ee7eff 100644--- a/help-beta/src/components/KeyboardTip.astro+++ b/help-beta/src/components/KeyboardTip.astro@@ -1,29 +1,47 @@----/* eslint-disable-next-line import/extensions */-import ZulipIconsKeyboard from "~icons/zulip-icon/keyboard";+import assert from "node:assert/strict";-let {title} = Astro.props;-if (!title) {- title = "Keyboard Shortcut";-}+import type {Element} from "hast";+import {fromHtml} from "hast-util-from-html";+import {toHtml} from "hast-util-to-html";++import keyboard_svg from "../../../web/shared/icons/keyboard.svg?raw";++const keyboard_icon_fragment = fromHtml(keyboard_svg, {fragment: true});+const keyboard_icon_first_child = keyboard_icon_fragment.children[0]!;+assert.ok(+ keyboard_icon_first_child.type === "element" &&+ keyboard_icon_first_child.tagName === "svg",+);+keyboard_icon_first_child.properties.class = "zulip-unplugin-icon";++const prefix_element_list = [+ keyboard_icon_first_child,+ {+ type: "element",+ tagName: "strong",+ properties: {},+ children: [+ {+ type: "text",+ // Whitespace before the text to ensure space between+ // this text and the preceding icon.+ value: " Keyboard tip: ",+ },+ ],+ } as Element,+];++const tree = fromHtml(await Astro.slots.render("default"), {fragment: true});+const first_element = tree.children[0];+assert.ok(first_element?.type === "element");++first_element.children = [...prefix_element_list, ...first_element.children];+tree.children[0] = first_element;----<!---We have an open PR to the upstream starlight repository to add support-for custom icons in the Aside starlight component. The PR is stalled-due to dependency on some of the custom icons work being done on-starlight. We should replace the code below with the Aside starlight-component along with a custom icon (keyboard in out case).-Link: https://github.com/withastro/starlight/pull/2261--->-<aside aria-label={title} class={`starlight-aside starlight-aside--tip`}>- <p class="starlight-aside__title" aria-hidden="true">- <ZulipIconsKeyboard- fill="currentColor"- class="starlight-aside__icon"- />{title}- </p>+<aside aria-label="Keyboard tip" class=`starlight-aside starlight-aside--tip`><div class="starlight-aside__content">- <slot />+ <Fragment set:html={toHtml(tree)} /></div></aside>