mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
fix location card layout
This commit is contained in:
@@ -17,9 +17,8 @@ const LocationCardWrapper = motionChakra('div', {
|
|||||||
baseStyle: {
|
baseStyle: {
|
||||||
py: 4,
|
py: 4,
|
||||||
px: 6,
|
px: 6,
|
||||||
w: '100%',
|
|
||||||
minW: 'xs',
|
minW: 'xs',
|
||||||
maxW: 'sm',
|
maxW: 'md',
|
||||||
mx: 'auto',
|
mx: 'auto',
|
||||||
shadow: 'sm',
|
shadow: 'sm',
|
||||||
rounded: 'lg',
|
rounded: 'lg',
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { Wrap, VStack, Flex, chakra } from '@chakra-ui/react';
|
import { Wrap, Stack, Flex, chakra } from '@chakra-ui/react';
|
||||||
import { useFormContext } from 'react-hook-form';
|
import { useFormContext } from 'react-hook-form';
|
||||||
import { Select, LocationCard } from '~/components';
|
import { Select, LocationCard } from '~/components';
|
||||||
import { useConfig } from '~/context';
|
import { useConfig } from '~/context';
|
||||||
@@ -114,9 +114,31 @@ export const QueryLocation = (props: QueryLocationProps): JSX.Element => {
|
|||||||
|
|
||||||
if (element === 'cards') {
|
if (element === 'cards') {
|
||||||
return (
|
return (
|
||||||
<Wrap align="flex-start" justify={{ base: 'center', lg: 'space-between' }} shouldWrapChildren>
|
<>
|
||||||
|
{options.length === 1 ? (
|
||||||
|
<Wrap
|
||||||
|
p={{ lg: 4 }}
|
||||||
|
align="flex-start"
|
||||||
|
shouldWrapChildren
|
||||||
|
spacing={{ base: 4, lg: 8 }}
|
||||||
|
justify={{ base: 'center', lg: 'flex-start' }}
|
||||||
|
>
|
||||||
|
{options[0].options.map(opt => {
|
||||||
|
return (
|
||||||
|
<LocationCard
|
||||||
|
key={opt.label}
|
||||||
|
option={opt}
|
||||||
|
onChange={handleCardChange}
|
||||||
|
hasError={noOverlap}
|
||||||
|
defaultChecked={form.queryLocation.includes(opt.value)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Wrap>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
{options.map(group => (
|
{options.map(group => (
|
||||||
<VStack key={group.label} align="center">
|
<Stack key={group.label} align="center">
|
||||||
<chakra.h3 fontSize={{ base: 'sm', md: 'md' }} alignSelf="flex-start" opacity={0.5}>
|
<chakra.h3 fontSize={{ base: 'sm', md: 'md' }} alignSelf="flex-start" opacity={0.5}>
|
||||||
{group.label}
|
{group.label}
|
||||||
</chakra.h3>
|
</chakra.h3>
|
||||||
@@ -131,9 +153,11 @@ export const QueryLocation = (props: QueryLocationProps): JSX.Element => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</VStack>
|
</Stack>
|
||||||
))}
|
))}
|
||||||
</Wrap>
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
} else if (element === 'select') {
|
} else if (element === 'select') {
|
||||||
return (
|
return (
|
||||||
|
Reference in New Issue
Block a user