From 61c71cd6f63d52151225e2d65bc7903fe3f3af17 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Jul 2025 16:57:16 +0200 Subject: [PATCH] update: create a Help menu --- .../frontend/src/components/FileBar.tsx | 7 +- .../frontend/src/components/HelpMenu.tsx | 123 ++++++++++++++++++ 2 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 webapp/app.ironcalc.com/frontend/src/components/HelpMenu.tsx diff --git a/webapp/app.ironcalc.com/frontend/src/components/FileBar.tsx b/webapp/app.ironcalc.com/frontend/src/components/FileBar.tsx index 924ca18..742f689 100644 --- a/webapp/app.ironcalc.com/frontend/src/components/FileBar.tsx +++ b/webapp/app.ironcalc.com/frontend/src/components/FileBar.tsx @@ -3,6 +3,7 @@ import type { Model } from "@ironcalc/workbook"; import { IronCalcIcon, IronCalcLogo } from "@ironcalc/workbook"; import { useLayoutEffect, useRef, useState } from "react"; import { FileMenu } from "./FileMenu"; +import { HelpMenu } from "./HelpMenu"; import { ShareButton } from "./ShareButton"; import ShareWorkbookDialog from "./ShareWorkbookDialog"; import { WorkbookTitle } from "./WorkbookTitle"; @@ -61,11 +62,7 @@ export function FileBar(properties: { }} onDelete={properties.onDelete} /> - window.open("https://docs.ironcalc.com", "_blank")} - > - Help - + (null); + + const handleClick = () => { + setMenuOpen(true); + }; + + const handleClose = () => { + setMenuOpen(false); + }; + + return ( +
+ + Help + + + { + handleClose(); + window.open("https://docs.ironcalc.com", "_blank"); + }} + > + + + + Documentation + + { + handleClose(); + window.open( + "https://docs.ironcalc.com/features/keyboard-shortcuts.html", + "_blank", + ); + }} + > + + + + Keyboard Shortcuts + + +
+ ); +} + +const HelpButton = styled.div<{ $isActive?: boolean }>` + display: flex; + align-items: center; + font-size: 12px; + font-family: Inter; + padding: 8px; + border-radius: 4px; + cursor: pointer; + background-color: ${(props) => (props.$isActive ? "#e6e6e6" : "transparent")}; + &:hover { + background-color: #f2f2f2; + } +`; + +const MenuItemWrapper = styled(MenuItem)` + display: flex; + align-items: center; + justify-content: flex-start; + font-size: 14px; + width: calc(100% - 8px); + min-width: 172px; + margin: 0px 4px; + border-radius: 4px; + padding: 8px; + height: 32px; +`; + +const StyledIcon = styled.div` + display: flex; + align-items: center; + svg { + width: 16px; + height: 100%; + color: #757575; + padding-right: 10px; + } +`; + +const MenuItemText = styled.div` + color: #000; + font-size: 12px; +`;