| (rest)} />
-
- >
+
+
);
};
diff --git a/hyperglass/ui/components/output/fields.tsx b/hyperglass/ui/components/output/fields.tsx
index be87f3b..cc2a43d 100644
--- a/hyperglass/ui/components/output/fields.tsx
+++ b/hyperglass/ui/components/output/fields.tsx
@@ -3,7 +3,8 @@ import { Text, Box, Tooltip, Menu, MenuButton, MenuList, Link } from '@chakra-ui
import dayjs from 'dayjs';
import relativeTimePlugin from 'dayjs/plugin/relativeTime';
import utcPlugin from 'dayjs/plugin/utc';
-import { If, DynamicIcon } from '~/components';
+import { If, Then, Else } from 'react-if';
+import { DynamicIcon } from '~/components';
import { useConfig, useColorValue } from '~/context';
import { useOpposingColor } from '~/hooks';
@@ -33,14 +34,14 @@ export const Active = (props: TActive): JSX.Element => {
const { isActive } = props;
const color = useColorValue(['gray.500', 'green.500'], ['whiteAlpha.300', 'blackAlpha.500']);
return (
- <>
-
+
+
-
-
+
+
-
- >
+
+
);
};
@@ -113,15 +114,15 @@ export const Communities = (props: TCommunities): JSX.Element => {
const bg = useColorValue('white', 'gray.900');
const color = useOpposingColor(bg);
return (
- <>
-
+
+
-
-
+
+
-
- >
+
+
);
};
diff --git a/hyperglass/ui/components/results/individual.tsx b/hyperglass/ui/components/results/individual.tsx
index 730d4b2..43eb6a9 100644
--- a/hyperglass/ui/components/results/individual.tsx
+++ b/hyperglass/ui/components/results/individual.tsx
@@ -15,7 +15,8 @@ import {
import { motion } from 'framer-motion';
import startCase from 'lodash/startCase';
import isEqual from 'react-fast-compare';
-import { BGPTable, Countdown, DynamicIcon, If, Path, TextOutput } from '~/components';
+import { If, Then, Else } from 'react-if';
+import { BGPTable, Countdown, DynamicIcon, Path, TextOutput } from '~/components';
import { useColorValue, useConfig, useMobile } from '~/context';
import { useStrf, useLGQuery, useTableToString, useFormState, useDevice } from '~/hooks';
import { isStructuredOutput, isStringOutput } from '~/types';
@@ -254,17 +255,24 @@ const _Result: React.ForwardRefRenderFunction = (
flex="1 0 auto"
justifyContent={{ base: 'flex-start', lg: 'flex-end' }}
>
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/hyperglass/ui/components/submit/submit.tsx b/hyperglass/ui/components/submit/submit.tsx
index d5b21cd..0dc5a5f 100644
--- a/hyperglass/ui/components/submit/submit.tsx
+++ b/hyperglass/ui/components/submit/submit.tsx
@@ -14,7 +14,8 @@ import {
PopoverCloseButton,
} from '@chakra-ui/react';
import { useFormContext } from 'react-hook-form';
-import { DynamicIcon, If, ResolvedTarget } from '~/components';
+import { If, Then, Else } from 'react-if';
+import { DynamicIcon, ResolvedTarget } from '~/components';
import { useMobile, useColorValue } from '~/context';
import { useFormState } from '~/hooks';
@@ -113,17 +114,17 @@ export const SubmitButton = (props: SubmitButtonProps): JSX.Element => {
}
return (
- <>
-
+
+
-
-
+
+
-
- >
+
+
);
};
diff --git a/hyperglass/ui/components/table/main.tsx b/hyperglass/ui/components/table/main.tsx
index cafdd0e..5973264 100644
--- a/hyperglass/ui/components/table/main.tsx
+++ b/hyperglass/ui/components/table/main.tsx
@@ -2,8 +2,9 @@
/* eslint react/jsx-key: 0 */
import { Flex, Text } from '@chakra-ui/react';
import { usePagination, useSortBy, useTable } from 'react-table';
+import { If, Then, Else } from 'react-if';
import { useMobile } from '~/context';
-import { CardBody, CardFooter, CardHeader, DynamicIcon, If } from '~/components';
+import { CardBody, CardFooter, CardHeader, DynamicIcon } from '~/components';
import { TableMain } from './table';
import { TableCell } from './cell';
import { TableHead } from './head';
@@ -89,15 +90,19 @@ export const Table = (props: TTable): JSX.Element => {
{column.render('Header')}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ {''}
- {''}
))}
diff --git a/hyperglass/ui/components/util/if.tsx b/hyperglass/ui/components/util/if.tsx
deleted file mode 100644
index f518819..0000000
--- a/hyperglass/ui/components/util/if.tsx
+++ /dev/null
@@ -1,6 +0,0 @@
-import type { TIf } from './types';
-
-export const If: React.FC = (props: TIf) => {
- const { c, children } = props;
- return c ? <>{children}> : null;
-};
diff --git a/hyperglass/ui/components/util/index.ts b/hyperglass/ui/components/util/index.ts
index 56b40ca..c693265 100644
--- a/hyperglass/ui/components/util/index.ts
+++ b/hyperglass/ui/components/util/index.ts
@@ -1,3 +1,2 @@
export * from './animated';
export * from './dynamic-icon';
-export * from './if';
diff --git a/hyperglass/ui/package.json b/hyperglass/ui/package.json
index b32efb5..7969538 100644
--- a/hyperglass/ui/package.json
+++ b/hyperglass/ui/package.json
@@ -39,6 +39,7 @@
"react-ga": "^3.3.0",
"react-hook-form": "^7.21.0",
"react-icons": "^4.3.1",
+ "react-if": "^4.1.1",
"react-markdown": "^5.0.3",
"react-query": "^3.16.0",
"react-select": "^5.2.1",
diff --git a/hyperglass/ui/pages/index.tsx b/hyperglass/ui/pages/index.tsx
index d97c7cf..cf2c192 100644
--- a/hyperglass/ui/pages/index.tsx
+++ b/hyperglass/ui/pages/index.tsx
@@ -1,5 +1,6 @@
import dynamic from 'next/dynamic';
-import { Meta, Loading, If, LoadError } from '~/components';
+import { Switch, Case, Default } from 'react-if';
+import { Meta, Loading, LoadError } from '~/components';
import { HyperglassProvider } from '~/context';
import { useHyperglassConfig } from '~/hooks';
@@ -14,20 +15,23 @@ const Index: NextPage = () => {
useHyperglassConfig();
return (
- <>
-
+
+
-
-
+
+
-
-
+
+
-
- >
+
+
+
+
+
);
};
diff --git a/hyperglass/ui/yarn.lock b/hyperglass/ui/yarn.lock
index 4cf1033..50c2a35 100644
--- a/hyperglass/ui/yarn.lock
+++ b/hyperglass/ui/yarn.lock
@@ -6961,6 +6961,11 @@ react-icons@^4.3.1:
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.3.1.tgz#2fa92aebbbc71f43d2db2ed1aed07361124e91ca"
integrity sha512-cB10MXLTs3gVuXimblAdI71jrJx8njrJZmNMEMC+sQu5B/BIOmlsAjskdqpn81y8UBVEGuHODd7/ci5DvoSzTQ==
+react-if@^4.1.1:
+ version "4.1.1"
+ resolved "https://registry.yarnpkg.com/react-if/-/react-if-4.1.1.tgz#48404d7e7f9ce18ee26b5d80baa6e26883bfb128"
+ integrity sha512-frzHswesRqVVJ2XcGRoLyTvlB2yneib4R/FCqTG8AqBQnFdLNhqNODfzEA84EQZ0XwBAVe82Oe567kxaVmwj5w==
+
react-is@17.0.2, "react-is@^16.12.0 || ^17.0.0", react-is@^17.0.1, react-is@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
|