mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Library improvements (#1925)
Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
parent
29f803e25d
commit
cf36cb394b
8 changed files with 38 additions and 18 deletions
|
@ -5,6 +5,7 @@ import { close } from "../components/icons";
|
|||
|
||||
import "./LibraryUnit.scss";
|
||||
import { t } from "../i18n";
|
||||
import useIsMobile from "../is-mobile";
|
||||
|
||||
// fa-plus
|
||||
const PLUS_ICON = (
|
||||
|
@ -50,8 +51,9 @@ export const LibraryUnit = ({
|
|||
}, [elements, pendingElements]);
|
||||
|
||||
const [isHovered, setIsHovered] = useState(false);
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
const adder = isHovered && pendingElements && (
|
||||
const adder = (isHovered || isMobile) && pendingElements && (
|
||||
<div className="library-unit__adder">{PLUS_ICON}</div>
|
||||
);
|
||||
|
||||
|
@ -79,7 +81,7 @@ export const LibraryUnit = ({
|
|||
}}
|
||||
/>
|
||||
{adder}
|
||||
{elements && isHovered && (
|
||||
{elements && (isHovered || isMobile) && (
|
||||
<button
|
||||
className="library-unit__removeFromLibrary"
|
||||
aria-label={t("labels.removeFromLibrary")}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue