Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

style: Center the ⌘ symbol by replacing it with an icon.

Jitendra Kumarf96484eed55c
diff --git a/web/src/common.ts b/web/src/common.ts
index 491f35cc182..2ad5cfc2463 100644
--- a/web/src/common.ts
+++ b/web/src/common.ts
@@ -58,6 +58,14 @@ export function adjust_mac_kbd_tags(kbd_elem_class: string): void {
const $kbd_elem = $("<kbd>").text(following_key);
$(this).after($("<span>").text(" + ").contents(), $kbd_elem);
}
+
+ // The ⌘ symbol isn't vertically centered, so we use an icon.
+ if (key_text === "⌘") {
+ const $icon = $("<i>")
+ .addClass("zulip-icon zulip-icon-mac-command")
+ .attr("aria-label", key_text);
+ $(this).empty().append($icon); // Use .append() to safely add the icon
+ }
});
}
diff --git a/web/styles/app_components.css b/web/styles/app_components.css
index 9a4b4299736..6cd9083c9b8 100644
--- a/web/styles/app_components.css
+++ b/web/styles/app_components.css
@@ -32,10 +32,20 @@ kbd {
background-color: var(--color-kbd-background);
color: var(--color-kbd-text);
margin: 0.25em 0.1em;
- padding: 0.1em 0.4em;
+ padding: 0.2em 0.4em;
text-shadow: 0 1px 0 hsl(0deg 0% 100%);
/* Prevent selection */
user-select: none;
+ position: relative;
+ min-height: 1em;
+ min-width: 1em;
+
+ .zulip-icon::before {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ }
}
@media (width < $sm_min) {