mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-28 16:26:24 +02:00
Make sidebar bigger if possible
This commit is contained in:
parent
6c2ca12786
commit
2810c049c2
1 changed files with 12 additions and 5 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue