diff --git a/src/components/Actions.tsx b/src/components/Actions.tsx
index e7ced60c..63d2ce03 100644
--- a/src/components/Actions.tsx
+++ b/src/components/Actions.tsx
@@ -151,23 +151,14 @@ export const SelectedShapeActions = ({
);
};
-const LIBRARY_ICON = (
- // fa-th-large
-
-);
-
export const ShapesSwitcher = ({
canvas,
elementType,
setAppState,
- isLibraryOpen,
}: {
canvas: HTMLCanvasElement | null;
elementType: ExcalidrawElement["type"];
setAppState: React.Component["setState"];
- isLibraryOpen: boolean;
}) => (
<>
{SHAPES.map(({ value, icon, key }, index) => {
@@ -201,19 +192,6 @@ export const ShapesSwitcher = ({
/>
);
})}
- {
- setAppState({ isLibraryOpen: !isLibraryOpen });
- }}
- />
>
);
diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx
index dc245fc2..2fe07896 100644
--- a/src/components/LayerUI.tsx
+++ b/src/components/LayerUI.tsx
@@ -36,7 +36,7 @@ import { Island } from "./Island";
import "./LayerUI.scss";
import { LibraryUnit } from "./LibraryUnit";
import { LoadingMessage } from "./LoadingMessage";
-import { LockIcon } from "./LockIcon";
+import { LockButton } from "./LockButton";
import { MobileMenu } from "./MobileMenu";
import { PasteChartDialog } from "./PasteChartDialog";
import { Section } from "./Section";
@@ -47,6 +47,7 @@ import { Tooltip } from "./Tooltip";
import { UserList } from "./UserList";
import Library from "../data/library";
import { JSONExportDialog } from "./JSONExportDialog";
+import { LibraryButton } from "./LibraryButton";
interface LayerUIProps {
actionManager: ActionManager;
@@ -570,6 +571,12 @@ const LayerUI = ({
{(heading) => (
+
-
{libraryMenu}
diff --git a/src/components/LibraryButton.tsx b/src/components/LibraryButton.tsx
new file mode 100644
index 00000000..570f61a9
--- /dev/null
+++ b/src/components/LibraryButton.tsx
@@ -0,0 +1,45 @@
+import clsx from "clsx";
+import { t } from "../i18n";
+import { AppState } from "../types";
+import { capitalizeString } from "../utils";
+
+const LIBRARY_ICON = (
+
+);
+
+export const LibraryButton: React.FC<{
+ appState: AppState;
+ setAppState: React.Component["setState"];
+}> = ({ appState, setAppState }) => {
+ return (
+
+ );
+};
diff --git a/src/components/LockIcon.tsx b/src/components/LockButton.tsx
similarity index 93%
rename from src/components/LockIcon.tsx
rename to src/components/LockButton.tsx
index eaae9aa9..e4691fad 100644
--- a/src/components/LockIcon.tsx
+++ b/src/components/LockButton.tsx
@@ -10,7 +10,6 @@ type LockIconProps = {
name?: string;
checked: boolean;
onChange?(): void;
- size?: LockIconSize;
zenModeEnabled?: boolean;
};
@@ -40,12 +39,12 @@ const ICONS = {
),
};
-export const LockIcon = (props: LockIconProps) => {
+export const LockButton = (props: LockIconProps) => {
return (
-
+
{libraryMenu}
diff --git a/src/components/ToolIcon.scss b/src/components/ToolIcon.scss
index faecf65f..5aa90395 100644
--- a/src/components/ToolIcon.scss
+++ b/src/components/ToolIcon.scss
@@ -8,10 +8,18 @@
position: relative;
font-family: Cascadia;
cursor: pointer;
- background-color: var(--button-gray-1);
-webkit-tap-highlight-color: transparent;
border-radius: var(--space-factor);
user-select: none;
+
+ background-color: var(--button-gray-1);
+
+ &:hover {
+ background-color: var(--button-gray-2);
+ }
+ &:active {
+ background-color: var(--button-gray-3);
+ }
}
.ToolIcon--plain {
@@ -66,14 +74,6 @@
margin: 0;
font-size: inherit;
- &:hover {
- background-color: var(--button-gray-1);
- }
-
- &:active {
- background-color: var(--button-gray-2);
- }
-
&:focus {
box-shadow: 0 0 0 2px var(--focus-highlight-color);
}
@@ -86,6 +86,14 @@
}
}
+ &:hover {
+ background-color: var(--button-gray-2);
+ }
+
+ &:active {
+ background-color: var(--button-gray-3);
+ }
+
&--show {
visibility: visible;
}
@@ -103,6 +111,9 @@
&:not(.ToolIcon_toggle_opaque):checked + .ToolIcon__icon {
background-color: var(--button-gray-2);
+ &:active {
+ background-color: var(--button-gray-3);
+ }
}
&:focus + .ToolIcon__icon {
@@ -130,12 +141,21 @@
}
.ToolIcon__icon {
+ background-color: var(--button-gray-1);
+ &:hover {
+ background-color: var(--button-gray-2);
+ }
+ &:active {
+ background-color: var(--button-gray-3);
+ }
+
width: 2rem;
height: 2em;
}
}
.ToolIcon.ToolIcon__lock {
+ margin-inline-end: var(--space-factor);
&.ToolIcon_type_floating {
margin-left: 0.1rem;
}
@@ -166,10 +186,9 @@
// move the lock button out of the way on small viewports
// it begins to collide with the GitHub icon before we switch to mobile mode
@media (max-width: 760px) {
- .ToolIcon.ToolIcon__lock {
+ .ToolIcon.ToolIcon_type_floating {
display: inline-block;
position: absolute;
- top: 60px;
right: -8px;
margin-left: 0;
@@ -194,6 +213,14 @@
position: static;
}
}
+ .ToolIcon.ToolIcon__library {
+ top: 100px;
+ }
+
+ .ToolIcon.ToolIcon__lock {
+ margin-inline-end: 0;
+ top: 60px;
+ }
}
.unlocked-icon {