Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
777b59359c | ||
|
|
9284949b9a |
No files matched your search
@@ -23,3 +23,15 @@
|
|||||||
.bookmarkButton:focus-visible .bookmarkIcon {
|
.bookmarkButton:focus-visible .bookmarkIcon {
|
||||||
background-color: var(--mantine-color-iconColor-filled-hover);
|
background-color: var(--mantine-color-iconColor-filled-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.compactScrollViewport > div {
|
||||||
|
display: flex !important;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.compactScrollContent {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 100%;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
@@ -2,19 +2,7 @@
|
|||||||
|
|
||||||
import type { CSSProperties } from "react";
|
import type { CSSProperties } from "react";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import {
|
import { Anchor, Card, Flex, Group, ScrollArea, SimpleGrid, Stack, Text, Title, UnstyledButton } from "@mantine/core";
|
||||||
Anchor,
|
|
||||||
Box,
|
|
||||||
Card,
|
|
||||||
Flex,
|
|
||||||
Group,
|
|
||||||
ScrollArea,
|
|
||||||
SimpleGrid,
|
|
||||||
Stack,
|
|
||||||
Text,
|
|
||||||
Title,
|
|
||||||
UnstyledButton,
|
|
||||||
} from "@mantine/core";
|
|
||||||
import { IconLink } from "@tabler/icons-react";
|
import { IconLink } from "@tabler/icons-react";
|
||||||
import combineClasses from "clsx";
|
import combineClasses from "clsx";
|
||||||
|
|
||||||
@@ -42,6 +30,7 @@ export interface CompactBookmarkLayout {
|
|||||||
columns: number;
|
columns: number;
|
||||||
hideHostname: boolean;
|
hideHostname: boolean;
|
||||||
hideTitle: boolean;
|
hideTitle: boolean;
|
||||||
|
minimumItemWidth: number;
|
||||||
minimumItemSize: number;
|
minimumItemSize: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,6 +53,7 @@ export function getCompactBookmarkLayout(
|
|||||||
columns,
|
columns,
|
||||||
hideHostname: cellWidth < 120 || cellHeight < (usesHorizontalItems ? 52 : 96),
|
hideHostname: cellWidth < 120 || cellHeight < (usesHorizontalItems ? 52 : 96),
|
||||||
hideTitle: cellWidth < 64 || cellHeight < 40,
|
hideTitle: cellWidth < 64 || cellHeight < 40,
|
||||||
|
minimumItemWidth: targetWidth,
|
||||||
minimumItemSize: usesHorizontalItems ? 48 : 96,
|
minimumItemSize: usesHorizontalItems ? 48 : 96,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -139,12 +129,17 @@ export default function BookmarksWidget({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{displayMode !== "advanced" && (
|
{displayMode !== "advanced" && (
|
||||||
<ScrollArea type="auto" scrollbarSize={6} offsetScrollbars style={{ flex: 1, minHeight: 0 }}>
|
<ScrollArea
|
||||||
<Box mih="100%">
|
classNames={{ viewport: classes.compactScrollViewport }}
|
||||||
|
type="auto"
|
||||||
|
scrollbarSize={6}
|
||||||
|
style={{ flex: 1, minHeight: 0 }}
|
||||||
|
>
|
||||||
|
<div className={classes.compactScrollContent}>
|
||||||
{options.layout === "grid" || options.layout === "gridHorizontal" ? (
|
{options.layout === "grid" || options.layout === "gridHorizontal" ? (
|
||||||
<GridLayout
|
<GridLayout
|
||||||
data={data}
|
data={data}
|
||||||
columns={compactLayout.columns}
|
minimumItemWidth={compactLayout.minimumItemWidth}
|
||||||
minimumItemHeight={compactLayout.minimumItemSize}
|
minimumItemHeight={compactLayout.minimumItemSize}
|
||||||
itemDirection={options.layout === "gridHorizontal" ? "horizontal" : "vertical"}
|
itemDirection={options.layout === "gridHorizontal" ? "horizontal" : "vertical"}
|
||||||
hideTitle={compactHideTitle}
|
hideTitle={compactHideTitle}
|
||||||
@@ -167,7 +162,7 @@ export default function BookmarksWidget({
|
|||||||
hasIconColor={board.iconColor !== null}
|
hasIconColor={board.iconColor !== null}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
@@ -340,7 +335,7 @@ interface GridLayoutProps {
|
|||||||
withBorder: boolean;
|
withBorder: boolean;
|
||||||
itemDirection: "horizontal" | "vertical";
|
itemDirection: "horizontal" | "vertical";
|
||||||
hasIconColor: boolean;
|
hasIconColor: boolean;
|
||||||
columns: number;
|
minimumItemWidth: number;
|
||||||
minimumItemHeight: number;
|
minimumItemHeight: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,20 +348,13 @@ const GridLayout = ({
|
|||||||
withBorder,
|
withBorder,
|
||||||
itemDirection,
|
itemDirection,
|
||||||
hasIconColor,
|
hasIconColor,
|
||||||
columns,
|
minimumItemWidth,
|
||||||
minimumItemHeight,
|
minimumItemHeight,
|
||||||
}: GridLayoutProps) => {
|
}: GridLayoutProps) => {
|
||||||
const board = useRequiredBoard();
|
const board = useRequiredBoard();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleGrid
|
<Flex gap={4} wrap="wrap" miw="100%" mih="100%" style={{ alignContent: "stretch" }}>
|
||||||
cols={columns}
|
|
||||||
spacing={4}
|
|
||||||
verticalSpacing={4}
|
|
||||||
miw="100%"
|
|
||||||
mih="100%"
|
|
||||||
style={{ gridAutoRows: `minmax(${minimumItemHeight}px, 1fr)` }}
|
|
||||||
>
|
|
||||||
{data.map((app) => {
|
{data.map((app) => {
|
||||||
const href = getSafeAppHref(app.href);
|
const href = getSafeAppHref(app.href);
|
||||||
return (
|
return (
|
||||||
@@ -377,7 +365,11 @@ const GridLayout = ({
|
|||||||
target={href ? (openNewTab ? "_blank" : "_self") : undefined}
|
target={href ? (openNewTab ? "_blank" : "_self") : undefined}
|
||||||
rel={href && openNewTab ? SAFE_NEW_TAB_REL : undefined}
|
rel={href && openNewTab ? SAFE_NEW_TAB_REL : undefined}
|
||||||
key={app.id}
|
key={app.id}
|
||||||
h="100%"
|
style={{
|
||||||
|
flex: `1 0 calc(${minimumItemWidth}px * var(--mantine-scale, 1))`,
|
||||||
|
minWidth: 0,
|
||||||
|
minHeight: `calc(${minimumItemHeight}px * var(--mantine-scale, 1))`,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<Card
|
<Card
|
||||||
h="100%"
|
h="100%"
|
||||||
@@ -407,7 +399,7 @@ const GridLayout = ({
|
|||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</SimpleGrid>
|
</Flex>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user