diff --git a/app/components/Icon.tsx b/app/components/Icon.tsx
index ef47f0c389..0c04b45b44 100644
--- a/app/components/Icon.tsx
+++ b/app/components/Icon.tsx
@@ -1,6 +1,8 @@
import { observer } from "mobx-react";
import { getLuminance } from "polished";
import * as React from "react";
+import styled from "styled-components";
+import breakpoint from "styled-components-breakpoint";
import { randomElement } from "@shared/random";
import { IconType } from "@shared/types";
import { IconLibrary } from "@shared/utils/IconLibrary";
@@ -9,6 +11,7 @@ import { determineIconType } from "@shared/utils/icon";
import EmojiIcon from "~/components/Icons/EmojiIcon";
import useStores from "~/hooks/useStores";
import Logger from "~/utils/Logger";
+import Flex from "./Flex";
export type Props = {
/** The icon to render */
@@ -104,4 +107,24 @@ const SVGIcon = observer(
}
);
+export const IconTitleWrapper = styled(Flex)<{ dir?: string }>`
+ align-items: center;
+ justify-content: center;
+ position: absolute;
+ top: 3px;
+ height: 40px;
+ width: 40px;
+
+ // Always move above TOC
+ z-index: 1;
+
+ ${(props: { dir?: string }) =>
+ props.dir === "rtl" ? "right: -40px" : "left: -40px"};
+
+ ${breakpoint("desktop")`
+ ${(props: { dir?: string }) =>
+ props.dir === "rtl" ? "right: -44px" : "left: -44px"};
+ `}
+`;
+
export default Icon;
diff --git a/app/scenes/Collection/index.tsx b/app/scenes/Collection/index.tsx
index 0e38afe03d..1893f352d0 100644
--- a/app/scenes/Collection/index.tsx
+++ b/app/scenes/Collection/index.tsx
@@ -21,6 +21,7 @@ import Badge from "~/components/Badge";
import CenteredContent from "~/components/CenteredContent";
import CollectionDescription from "~/components/CollectionDescription";
import Heading from "~/components/Heading";
+import Icon, { IconTitleWrapper } from "~/components/Icon";
import CollectionIcon from "~/components/Icons/CollectionIcon";
import InputSearchPage from "~/components/InputSearchPage";
import PlaceholderList from "~/components/List/Placeholder";
@@ -130,7 +131,11 @@ function CollectionScene() {
}
const fallbackIcon = collection ? (
-
+
) : null;
return collection ? (
@@ -177,22 +182,24 @@ function CollectionScene() {
) : (
<>
-
- {can.update ? (
-
-
-
- ) : (
- fallbackIcon
- )}
+
+
+ {can.update ? (
+
+
+
+ ) : (
+ fallbackIcon
+ )}
+
{collection.name}
{collection.isPrivate &&
!FeatureFlags.isEnabled(Feature.newCollectionSharing) && (
@@ -205,7 +212,7 @@ function CollectionScene() {
{t("Private")}
)}
-
+
{can.update && !readOnly ? (
-
+
-
+
) : icon ? (
-
- {fallbackIcon}
-
+ {fallbackIcon}
) : null}
);
@@ -355,17 +352,4 @@ const Title = styled(ContentEditable)`
}
`;
-const IconWrapper = styled(Flex)<{ dir?: string }>`
- position: absolute;
- top: 3px;
- height: 40px;
- width: 40px;
-
- // Always move above TOC
- z-index: 1;
-
- ${(props: { dir?: string }) =>
- props.dir === "rtl" ? "right: -48px" : "left: -48px"};
-`;
-
export default observer(DocumentTitle);