diff --git a/hyperglass/ui/components/Footer/button.tsx b/hyperglass/ui/components/Footer/button.tsx index 2dd8d40..42b0948 100644 --- a/hyperglass/ui/components/Footer/button.tsx +++ b/hyperglass/ui/components/Footer/button.tsx @@ -1,30 +1,29 @@ -import { Button } from '@chakra-ui/react'; -import { AnimatedDiv } from '~/components'; +import { Button, Menu, MenuButton, MenuList } from '@chakra-ui/react'; +import { Markdown } from '~/components'; import type { TFooterButton } from './types'; export const FooterButton = (props: TFooterButton) => { - const { side, href, ...rest } = props; - - let buttonProps = Object(); - if (typeof href !== 'undefined') { - buttonProps = { href, as: 'a', target: '_blank', rel: 'noopener noreferrer' }; - } - + const { content, title, side, ...rest } = props; + const placement = side === 'left' ? 'top-end' : side === 'right' ? 'top-start' : undefined; return ( - - + + ); }; diff --git a/hyperglass/ui/components/Footer/types.ts b/hyperglass/ui/components/Footer/types.ts index 5f9fabc..4695ed7 100644 --- a/hyperglass/ui/components/Footer/types.ts +++ b/hyperglass/ui/components/Footer/types.ts @@ -1,16 +1,11 @@ -import type { ButtonProps, DrawerProps, DrawerContentProps } from '@chakra-ui/react'; +import type { MenuListProps } from '@chakra-ui/react'; type TFooterSide = 'left' | 'right'; -export interface TFooterButton extends ButtonProps { +export interface TFooterButton extends Omit { side: TFooterSide; - href?: string; -} - -export interface TFooterContent extends Omit, DrawerContentProps { - isOpen: boolean; + title?: MenuListProps['children']; content: string; - side: TFooterSide; } export type TFooterItems = 'help' | 'credit' | 'terms'; diff --git a/hyperglass/ui/components/Util/animated.ts b/hyperglass/ui/components/Util/animated.ts index 8c4b41a..43d29ed 100644 --- a/hyperglass/ui/components/Util/animated.ts +++ b/hyperglass/ui/components/Util/animated.ts @@ -1,4 +1,5 @@ import { chakra } from '@chakra-ui/react'; import { motion } from 'framer-motion'; -export const AnimatedDiv = chakra(motion.div); +export const AnimatedDiv = motion.custom(chakra.div); +export const AnimatedForm = motion.custom(chakra.form); diff --git a/hyperglass/ui/components/buttons/submit.tsx b/hyperglass/ui/components/buttons/submit.tsx index 16cb819..56ee636 100644 --- a/hyperglass/ui/components/buttons/submit.tsx +++ b/hyperglass/ui/components/buttons/submit.tsx @@ -46,9 +46,9 @@ export const SubmitButton = forwardRef((props, re } = props; const _isDisabled = isDisabled || isLoading; - const bg = useColorValue('primary.500', 'primary.300'); - const bgActive = useColorValue('primary.600', 'primary.400'); - const bgHover = useColorValue('primary.400', 'primary.200'); + const bg = useColorValue('primary.400', 'primary.500'); + const bgActive = useColorValue('primary.500', 'primary.600'); + const bgHover = useColorValue('primary.300', 'primary.400'); const color = useOpposingColor(bg); const colorActive = useOpposingColor(bgActive); const colorHover = useOpposingColor(bgHover); diff --git a/hyperglass/ui/components/debugger.tsx b/hyperglass/ui/components/debugger.tsx index 52732e7..17125ec 100644 --- a/hyperglass/ui/components/debugger.tsx +++ b/hyperglass/ui/components/debugger.tsx @@ -41,12 +41,12 @@ export const Debugger = () => { position="relative" justifyContent="center" borderColor={borderColor}> - {colorMode.toUpperCase()} - {mediaSize} - - diff --git a/hyperglass/ui/components/form/communitySelect.tsx b/hyperglass/ui/components/form/communitySelect.tsx index 489a6b0..c1cfe37 100644 --- a/hyperglass/ui/components/form/communitySelect.tsx +++ b/hyperglass/ui/components/form/communitySelect.tsx @@ -33,7 +33,7 @@ export const CommunitySelect = (props: TCommunitySelect) => { const options = useMemo(() => buildOptions(communities), [communities.length]); function handleChange(e: TSelectOption | TSelectOption[]): void { - if (!Array.isArray(e)) { + if (!Array.isArray(e) && e !== null) { onChange({ field: name, value: e.value }); } } diff --git a/hyperglass/ui/components/form/queryLocation.tsx b/hyperglass/ui/components/form/queryLocation.tsx index abb2a2d..5c64a4d 100644 --- a/hyperglass/ui/components/form/queryLocation.tsx +++ b/hyperglass/ui/components/form/queryLocation.tsx @@ -24,7 +24,7 @@ export const QueryLocation = (props: TQuerySelectField) => { const options = useMemo(() => buildOptions(networks), [networks.length]); function handleChange(e: TSelectOption): void { - if (Array.isArray(e.value)) { + if (Array.isArray(e?.value) && e !== null) { const value = e.value.map(sel => sel); onChange({ field: 'query_location', value }); } diff --git a/hyperglass/ui/components/form/queryTarget.tsx b/hyperglass/ui/components/form/queryTarget.tsx index 680a6c2..2a90222 100644 --- a/hyperglass/ui/components/form/queryTarget.tsx +++ b/hyperglass/ui/components/form/queryTarget.tsx @@ -56,11 +56,11 @@ export const QueryTarget = (props: TQueryTarget) => { bg={bg} size="lg" color={color} + borderRadius="md" onBlur={handleBlur} onFocus={handleBlur} value={displayValue} borderColor={border} - borderRadius="0.25rem" onChange={handleChange} aria-label={placeholder} onKeyDown={handleKeyDown} diff --git a/hyperglass/ui/components/form/queryType.tsx b/hyperglass/ui/components/form/queryType.tsx index 9a02c35..42418f3 100644 --- a/hyperglass/ui/components/form/queryType.tsx +++ b/hyperglass/ui/components/form/queryType.tsx @@ -18,7 +18,9 @@ export const QueryType = (props: TQuerySelectField) => { const options = useMemo(() => buildOptions(queries.list), [queries.list.length]); function handleChange(e: TSelectOption): void { - onChange({ field: 'query_type', value: e.value }); + if (e !== null) { + onChange({ field: 'query_type', value: e.value }); + } } return ( diff --git a/hyperglass/ui/components/form/queryVrf.tsx b/hyperglass/ui/components/form/queryVrf.tsx index 2a35bb6..c82ddab 100644 --- a/hyperglass/ui/components/form/queryVrf.tsx +++ b/hyperglass/ui/components/form/queryVrf.tsx @@ -14,7 +14,9 @@ export const QueryVrf = (props: TQueryVrf) => { const options = useMemo(() => buildOptions(vrfs), [vrfs.length]); function handleChange(e: TSelectOption): void { - onChange({ field: 'query_vrf', value: e.value }); + if (e !== null) { + onChange({ field: 'query_vrf', value: e.value }); + } } return ( diff --git a/hyperglass/ui/components/layout/frame.tsx b/hyperglass/ui/components/layout/frame.tsx index 846ebed..9e4dad9 100644 --- a/hyperglass/ui/components/layout/frame.tsx +++ b/hyperglass/ui/components/layout/frame.tsx @@ -25,14 +25,7 @@ export const Frame = (props: TFrame) => { return ( <> - +
@@ -49,9 +42,9 @@ export const Frame = (props: TFrame) => { {...props} />