diff --git a/src/components/LayerUI.scss b/src/components/LayerUI.scss new file mode 100644 index 00000000..b8d2e667 --- /dev/null +++ b/src/components/LayerUI.scss @@ -0,0 +1,49 @@ +@import "open-color/open-color"; + +.layer-ui__wrapper { + .encrypted-icon { + position: relative; + margin-left: 15px; + display: flex; + justify-content: center; + align-items: center; + border-radius: var(--space-factor); + color: $oc-green-9; + + svg { + width: 1.2rem; + height: 1.2rem; + } + + &.tooltip .tooltip-text { + visibility: hidden; + width: 20rem; + bottom: calc(50% + 0.8rem); + left: -5px; + background-color: $oc-black; + color: $oc-white; + text-align: center; + border-radius: 6px; + padding: 5px; + position: absolute; + z-index: 10; + font-size: 13px; + line-height: 1.5; + white-space: pre-wrap; + } + + // the following 3 rules ensure that the tooltip doesn't show (nor affect + // the cursor) when you drag over when you draw on canvas, but at the same + // time it still works when clicking on the link/shield + + body:active &.tooltip:not(:hover) { + pointer-events: none; + } + body:not(:active) &.tooltip:hover .tooltip-text { + visibility: visible; + } + .tooltip-text:hover { + visibility: visible; + } + } +} diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index 38787ed8..30e8a14b 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -25,8 +25,11 @@ import { RoomDialog } from "./RoomDialog"; import { ErrorDialog } from "./ErrorDialog"; import { ShortcutsDialog } from "./ShortcutsDialog"; import { LoadingMessage } from "./LoadingMessage"; -import { GitHubCorner } from "./GitHubCorner"; import { CLASSES } from "../constants"; +import { shield } from "./icons"; +import { GitHubCorner } from "./GitHubCorner"; + +import "./LayerUI.scss"; interface LayerUIProps { actionManager: ActionManager; @@ -53,6 +56,18 @@ const LayerUI = ({ }: LayerUIProps) => { const isMobile = useIsMobile(); + const renderEncryptedIcon = () => ( + + {t("encrypted.tooltip")} + {shield} + + ); + const renderExportDialog = () => { const createExporter = (type: ExportType): ExportCB => ( exportedElements, @@ -178,6 +193,7 @@ const LayerUI = ({ zoom={appState.zoom} /> + {renderEncryptedIcon()} @@ -222,7 +238,7 @@ const LayerUI = ({ onLockToggle={onLockToggle} /> ) : ( - <> +