-
-
+
{direction === "row" ? (
-
+
) : (
-
+
)}
@@ -117,29 +134,27 @@ const FlexLayout = ({ data, direction, hideIcon, hideHostname, openNewTab, hasIc
interface GridLayoutProps {
data: RouterOutputs["app"]["byIds"];
- width: number;
- height: number;
+ hideTitle: boolean;
hideIcon: boolean;
hideHostname: boolean;
openNewTab: boolean;
+ itemDirection: "horizontal" | "vertical";
hasIconColor: boolean;
}
-const GridLayout = ({ data, width, height, hideIcon, hideHostname, openNewTab, hasIconColor }: GridLayoutProps) => {
- // Calculates the perfect number of columns for the grid layout based on the width and height in pixels and the number of items
- const columns = Math.ceil(Math.sqrt(data.length * (width / height)));
-
+const GridLayout = ({
+ data,
+ hideTitle,
+ hideIcon,
+ hideHostname,
+ openNewTab,
+ itemDirection,
+ hasIconColor,
+}: GridLayoutProps) => {
const board = useRequiredBoard();
return (
-
+
{data.map((app) => (
-
+ {itemDirection === "horizontal" ? (
+
+ ) : (
+
+ )}
))}
-
+
);
};
const VerticalItem = ({
app,
+ hideTitle,
hideIcon,
hideHostname,
hasIconColor,
- size = 30,
}: {
app: RouterOutputs["app"]["byIds"][number];
+ hideTitle: boolean;
hideIcon: boolean;
hideHostname: boolean;
hasIconColor: boolean;
- size?: number;
}) => {
return (
-
- {app.name}
-
+ {!hideTitle && (
+
+ {app.name}
+
+ )}
{!hideIcon && (
)}
{!hideHostname && (
-
+
{app.href ? new URL(app.href).hostname : undefined}
)}
@@ -215,17 +241,19 @@ const VerticalItem = ({
const HorizontalItem = ({
app,
+ hideTitle,
hideIcon,
hideHostname,
hasIconColor,
}: {
app: RouterOutputs["app"]["byIds"][number];
+ hideTitle: boolean;
hideIcon: boolean;
hideHostname: boolean;
hasIconColor: boolean;
}) => {
return (
-
+
{!hideIcon && (
)}
-
-
- {app.name}
-
+ {!(hideTitle && hideHostname) && (
+ <>
+
+ {!hideTitle && (
+
+ {app.name}
+
+ )}
- {!hideHostname && (
-
- {app.href ? new URL(app.href).hostname : undefined}
-
- )}
-
+ {!hideHostname && (
+
+ {app.href ? new URL(app.href).hostname : undefined}
+
+ )}
+
+ >
+ )}
);
};
diff --git a/packages/widgets/src/bookmarks/index.tsx b/packages/widgets/src/bookmarks/index.tsx
index 763b0a3ad..37eaa9450 100644
--- a/packages/widgets/src/bookmarks/index.tsx
+++ b/packages/widgets/src/bookmarks/index.tsx
@@ -14,12 +14,13 @@ export const { definition, componentLoader } = createWidgetDefinition("bookmarks
return optionsBuilder.from((factory) => ({
title: factory.text(),
layout: factory.select({
- options: (["grid", "row", "column"] as const).map((value) => ({
+ options: (["grid", "gridHorizontal", "row", "column"] as const).map((value) => ({
value,
label: (t) => t(`widget.bookmarks.option.layout.option.${value}.label`),
})),
defaultValue: "column",
}),
+ hideTitle: factory.switch({ defaultValue: false }),
hideIcon: factory.switch({ defaultValue: false }),
hideHostname: factory.switch({ defaultValue: false }),
openNewTab: factory.switch({ defaultValue: true }),