1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

improve footer layout [skip ci]

This commit is contained in:
checktheroads
2020-12-29 02:07:42 -07:00
parent 4961d1dd78
commit 7cb445d9e7
8 changed files with 138 additions and 77 deletions

View File

@@ -0,0 +1,39 @@
import dynamic from 'next/dynamic';
import { Box, Flex, Icon, IconButton, Slide } from '@chakra-ui/react';
import { useColorValue } from '~/context';
import { useLGState, useOpposingColor } from '~/hooks';
import type { TResetButton } from './types';
const LeftArrow = dynamic<MeronexIcon>(() => import('@meronex/icons/fa').then(i => i.FaAngleLeft));
export const ResetButton = (props: TResetButton) => {
const { developerMode, resetForm, ...rest } = props;
const { isSubmitting } = useLGState();
const bg = useColorValue('primary.500', 'primary.300');
const color = useOpposingColor(bg);
return (
<Slide direction="left" in={isSubmitting.value} unmountOnExit style={{ width: 'auto' }}>
<Box
bg={bg}
left={0}
zIndex={4}
bottom={24}
boxSize={12}
color={color}
position="fixed"
borderRightRadius="md"
mb={developerMode ? 14 : undefined}>
<Flex boxSize="100%" justifyContent="center" alignItems="center" {...rest}>
<IconButton
color="current"
variant="ghost"
aria-label="Reset"
onClick={resetForm}
icon={<Icon as={LeftArrow} boxSize={8} />}
/>
</Flex>
</Box>
</Slide>
);
};