From 5b8fc12163615879ba9fd9a5e14f37e62546fff9 Mon Sep 17 00:00:00 2001 From: Sinclair Chen Date: Fri, 16 Sep 2022 15:21:07 -0700 Subject: [PATCH] Make add group button same height as group names (#890) --- web/components/contract/contract-details.tsx | 74 ++++++-------------- web/hooks/use-is-mobile.ts | 3 +- 2 files changed, 22 insertions(+), 55 deletions(-) diff --git a/web/components/contract/contract-details.tsx b/web/components/contract/contract-details.tsx index 06aeeb10..6dbbd2d2 100644 --- a/web/components/contract/contract-details.tsx +++ b/web/components/contract/contract-details.tsx @@ -127,11 +127,7 @@ export function ContractDetails(props: { {/* GROUPS */} {isMobile && (
- +
)} @@ -182,11 +178,7 @@ export function MarketSubheader(props: { isCreator={isCreator} /> {!isMobile && ( - + )} @@ -233,29 +225,24 @@ export function CloseOrResolveTime(props: { export function MarketGroups(props: { contract: Contract - isMobile: boolean | undefined - disabled: boolean | undefined + disabled?: boolean }) { const [open, setOpen] = useState(false) const user = useUser() - const { contract, isMobile, disabled } = props + const { contract, disabled } = props const groupToDisplay = getGroupLinkToDisplay(contract) return ( <> - - - {!disabled && ( - - {user && ( - - )} - + + + {!disabled && user && ( + )} @@ -333,42 +320,21 @@ export function ExtraMobileContractDetails(props: { ) } -export function GroupDisplay(props: { - groupToDisplay?: GroupLink | null - isMobile?: boolean -}) { - const { groupToDisplay, isMobile } = props +export function GroupDisplay(props: { groupToDisplay?: GroupLink | null }) { + const { groupToDisplay } = props if (groupToDisplay) { return ( - -
- {groupToDisplay.name} -
+
+ {groupToDisplay.name} ) } else return ( - -
- No Group -
-
+
+ No Group +
) } diff --git a/web/hooks/use-is-mobile.ts b/web/hooks/use-is-mobile.ts index 5754a589..9ce0133c 100644 --- a/web/hooks/use-is-mobile.ts +++ b/web/hooks/use-is-mobile.ts @@ -1,6 +1,7 @@ import { useWindowSize } from 'web/hooks/use-window-size' +// matches talwind sm breakpoint export function useIsMobile() { const { width } = useWindowSize() - return (width ?? 0) < 600 + return (width ?? 0) < 640 }