Desktop poll code clean up and refinements (#120)

This commit is contained in:
Luke Vella 2022-04-21 13:01:29 +01:00 committed by GitHub
parent 8cd1db41db
commit 00b72d01bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 160 additions and 146 deletions

View file

@ -0,0 +1,30 @@
import noop from "lodash/noop";
import React from "react";
export const PollContext = React.createContext<{
activeOptionId: string | null;
setActiveOptionId: (optionId: string | null) => void;
scrollPosition: number;
setScrollPosition: (position: number) => void;
columnWidth: number;
sidebarWidth: number;
numberOfColumns: number;
availableSpace: number;
actionColumnWidth: number;
goToNextPage: () => void;
goToPreviousPage: () => void;
}>({
activeOptionId: null,
setActiveOptionId: noop,
scrollPosition: 0,
setScrollPosition: noop,
columnWidth: 100,
sidebarWidth: 200,
numberOfColumns: 0,
availableSpace: 0,
goToNextPage: noop,
goToPreviousPage: noop,
actionColumnWidth: 0,
});
export const usePollContext = () => React.useContext(PollContext);