Skip to content

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

✨ Desktop poll improvements (#1638)

Luke Vella1889cffa9194
diff --git a/apps/web/src/components/poll/desktop-poll.tsx b/apps/web/src/components/poll/desktop-poll.tsx
index dc56797e3..51c5c7445 100644
--- a/apps/web/src/components/poll/desktop-poll.tsx
+++ b/apps/web/src/components/poll/desktop-poll.tsx
@@ -15,6 +15,7 @@ import {
import * as React from "react";
import { RemoveScroll } from "react-remove-scroll";
import { useMeasure, useScroll } from "react-use";
+import useClickAway from "react-use/lib/useClickAway";
import { TimesShownIn } from "@/components/clock";
import {
@@ -129,6 +130,12 @@ const DesktopPoll: React.FunctionComponent = () => {
const { x } = useScroll(scrollRef);
+ const containerRef = React.useRef<HTMLDivElement>(null);
+
+ useClickAway(containerRef, () => {
+ collapse();
+ });
+
function TableControls() {
return (
<div className="flex items-center gap-4">
@@ -240,11 +247,12 @@ const DesktopPoll: React.FunctionComponent = () => {
>
<div
className={cn(
- "flex max-h-full max-w-7xl flex-col overflow-hidden rounded-md bg-white",
+ "flex max-h-full flex-col overflow-hidden rounded-md bg-white",
{
- "shadow-huge": expanded,
+ "shadow-huge w-full max-w-7xl": expanded,
},
)}
+ ref={containerRef}
>
<CardHeader className="flex items-center justify-between gap-4">
<div className="flex items-center gap-x-2.5">