Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

Make sidebar bigger if possible

Luke Vella2810c049c213
diff --git a/components/poll/poll.tsx b/components/poll/poll.tsx
index 2a79a4aac..8c48fcc2e 100644
--- a/components/poll/poll.tsx
+++ b/components/poll/poll.tsx
@@ -88,7 +88,7 @@ const Poll: React.VoidFunctionComponent<
targetTimeZone,
onChangeTargetTimeZone,
actionColumnWidth = 160,
- sidebarWidth = 200,
+ sidebarWidth: minSidebarWidth = 200,
columnWidth: defaultColumnWidth,
width: defaultWidth,
}) => {
@@ -102,14 +102,21 @@ const Poll: React.VoidFunctionComponent<
const columnWidth =
defaultColumnWidth ??
Math.min(
- 150,
- Math.max(95, (width - sidebarWidth - actionColumnWidth) / options.length),
+ 100,
+ Math.max(
+ 95,
+ (width - minSidebarWidth - actionColumnWidth) / options.length,
+ ),
);
- const numberOfVisibleColumns = Math.floor(
- (width - (sidebarWidth + actionColumnWidth)) / columnWidth,
+ const numberOfVisibleColumns = Math.min(
+ options.length,
+ Math.floor((width - (minSidebarWidth + actionColumnWidth)) / columnWidth),
);
+ const sidebarWidth =
+ width - (numberOfVisibleColumns * columnWidth + actionColumnWidth);
+
const availableSpace = Math.min(
numberOfVisibleColumns * columnWidth,
options.length * columnWidth,