Library improvements (#1925)

Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
Mohammed Salman 2020-07-20 00:12:56 +03:00 committed by GitHub
parent 29f803e25d
commit cf36cb394b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 18 deletions

View file

@ -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")}