import * as React from "react";
import { Ladle } from "../icons";
import { Modal, Code } from "../ui";
import config from "../get-config";
import type { AddonProps } from "../../../shared/types";
const hotkeyLegends = {
fullscreen: "Toggle fullscreen mode",
search: "Focus search input in the sidebar",
nextStory: "Go to the next story",
previousStory: "Go to the previous story",
nextComponent: "Go to the next component",
previousComponent: "Go to the previous component",
control: "Toggle controls addon",
darkMode: "Toggle dark mode",
width: "Toggle width addon",
rtl: "Toggle right-to-left mode",
a11y: "Toggle accessibility addon",
source: "Toggle story source addon",
};
const FormattedHotkey = ({ children }: { children: string }) => {
if (navigator.platform.toLowerCase().includes("mac")) {
children = children.replace(/alt/g, "⌥ opt").replace(/meta/g, "⌘ cmd");
} else if (navigator.platform.toLowerCase().includes("win")) {
children = children.replace(/meta/g, "⊞ win");
}
children = children.replace(/shift/g, "⇧ shift");
children = children
.replace(/arrowright/g, "→")
.replace(/arrowleft/g, "←")
.replace(/arrowup/g, "↑")
.replace(/arrowdown/g, "↓")
.replace(/\+/g, " + ");
return {children};
};
export const Button = ({ globalState }: AddonProps) => {
const [open, setOpen] = React.useState(false);
const text = "Get more information about Ladle.";
return (