auto expand first result

This commit is contained in:
checktheroads 2020-03-22 10:04:36 -07:00
parent 9b8fe94482
commit 0525c66ce4
2 changed files with 4 additions and 1 deletions

View file

@ -45,7 +45,7 @@ const AccordionHeaderWrapper = styled(Flex)`
const statusMap = { success: "success", warning: "warning", error: "warning", danger: "error" };
const Result = React.forwardRef(
({ device, timeout, queryLocation, queryType, queryVrf, queryTarget }, ref) => {
({ device, timeout, queryLocation, queryType, queryVrf, queryTarget, index }, ref) => {
const config = useConfig();
const theme = useTheme();
const { colorMode } = useColorMode();
@ -93,6 +93,7 @@ const Result = React.forwardRef(
return (
<AccordionItem
defaultIsOpen={index === 0 ? true : false}
isDisabled={loading}
ref={ref}
css={css({

View file

@ -117,6 +117,7 @@ const Results = ({ queryLocation, queryType, queryVrf, queryTarget, setSubmittin
overflow="hidden"
>
<Accordion
allowMultiple
initial={{ opacity: 1 }}
transition={{ duration: 0.3 }}
animate={{ opacity: 1, y: 0 }}
@ -138,6 +139,7 @@ const Results = ({ queryLocation, queryType, queryVrf, queryTarget, setSubmittin
queryVrf={queryVrf}
queryTarget={queryTarget}
setSubmitting={setSubmitting}
index={i}
/>
))}
</AnimatePresence>