fix: compact bookmark cards
This commit is contained in:
1 parent
8d8dec5749
commit
eef4c49398
8 files changed
+34
-3
No files matched your search
@@ -6,6 +6,7 @@ import {
|
||||
Box,
|
||||
Card,
|
||||
Center,
|
||||
Grid,
|
||||
Group,
|
||||
ScrollArea,
|
||||
SimpleGrid,
|
||||
@@ -156,6 +157,14 @@ export default function BookmarksWidget({
|
||||
<Group gap={options.spacing} wrap="nowrap" mih="100%" align="stretch">
|
||||
{cards}
|
||||
</Group>
|
||||
) : options.grow ? (
|
||||
<Grid grow columns={plan.columns} gap={options.spacing}>
|
||||
{cards.map((card) => (
|
||||
<Grid.Col key={card.key} span={1}>
|
||||
{card}
|
||||
</Grid.Col>
|
||||
))}
|
||||
</Grid>
|
||||
) : (
|
||||
<SimpleGrid cols={plan.columns} spacing={options.spacing} verticalSpacing={options.spacing}>
|
||||
{cards}
|
||||
|
||||
@@ -49,6 +49,7 @@ export const { definition, componentLoader } = createWidgetDefinition("bookmarks
|
||||
hideHostname: factory.switch({ defaultValue: false }),
|
||||
openNewTab: factory.switch({ defaultValue: true }),
|
||||
withBorder: factory.switch({ defaultValue: false }),
|
||||
grow: factory.switch({ defaultValue: false }),
|
||||
customUrls: factory.internal({ defaultValue: [] as string[] }),
|
||||
items: factory.sortableItemList<BookmarkSelectionItem, string>({
|
||||
ItemComponent: ({ item, handle, removeItem, removeLabel, rootAttributes }) => {
|
||||
|
||||
@@ -240,8 +240,20 @@ export const getBookmarkDisplayPlan = ({
|
||||
};
|
||||
}
|
||||
|
||||
let columns: number = widthSettings.compactColumns;
|
||||
let orientation: BookmarkOrientation = "horizontal";
|
||||
if (layout === "gridHorizontal") {
|
||||
return {
|
||||
columns: Math.min(count, widthSettings.compactColumns),
|
||||
horizontalScroll: false,
|
||||
itemHeight: 56,
|
||||
itemWidth: widthSettings.rowItemWidth,
|
||||
orientation: "horizontal",
|
||||
showHostname: widthSettings.showHostname && heightSettings.showHostname,
|
||||
showTitle: widthSettings.showTitle && heightSettings.showTitle,
|
||||
};
|
||||
}
|
||||
|
||||
let columns: number = widthSettings.adaptiveColumns;
|
||||
let orientation: BookmarkOrientation = widthSettings.adaptiveOrientation;
|
||||
if (layout === "grid") {
|
||||
columns = widthSettings.gridColumns;
|
||||
orientation = "vertical";
|
||||
|
||||
Reference in new issue
Block a user