From 73a89f9783ef52d496ef11fe4892b00f6b9d0c09 Mon Sep 17 00:00:00 2001 From: znaim Date: Mon, 28 Oct 2024 09:36:20 -0400 Subject: [PATCH] added a csstransition to fade the components in and out --- .../src/organisms/UpdateProtocol/index.tsx | 120 ++++++++++++------ 1 file changed, 79 insertions(+), 41 deletions(-) diff --git a/opentrons-ai-client/src/organisms/UpdateProtocol/index.tsx b/opentrons-ai-client/src/organisms/UpdateProtocol/index.tsx index 2a3da608c28..458dda3b9e6 100644 --- a/opentrons-ai-client/src/organisms/UpdateProtocol/index.tsx +++ b/opentrons-ai-client/src/organisms/UpdateProtocol/index.tsx @@ -1,4 +1,4 @@ -import styled from 'styled-components' +import styled, { css } from 'styled-components' import { COLORS, DIRECTION_COLUMN, @@ -20,6 +20,7 @@ import { Trans, useTranslation } from 'react-i18next' import { FileUpload } from '../../molecules/FileUpload' import { useNavigate } from 'react-router-dom' import { chatDataAtom, headerWithMeterAtom } from '../../resources/atoms' +import { CSSTransition } from 'react-transition-group' import type { ChatData } from '../../resources/types' import { useAtom } from 'jotai' @@ -33,6 +34,25 @@ const updateOptions: DropdownOption[] = [ { name: 'Other', value: 'other' }, ] +const FadeWrapper = styled.div` + &.fade-enter { + opacity: 0; + } + &.fade-enter-active { + opacity: 1; + transition: opacity 1000ms; + } + &.fade-exit { + height: 100%; + opacity: 1; + } + &.fade-exit-active { + opacity: 0; + height: 0%; + transition: opacity 1000ms; + } +` + const Container = styled(Flex)` width: 100%; flex-direction: ${DIRECTION_COLUMN}; @@ -170,50 +190,68 @@ export function UpdateProtocol(): JSX.Element { - {fileValue !== null ? ( - - - - ) : ( - - - ), + + + {fileValue !== null ? ( + + - - } - onUpload={async function (file: File) { - try { - await handleFileUpload(file) - } catch (error) { - // todo perhaps make this a toast? - console.error('Error uploading file:', error) + > + + ) : null} + + + + + + + + ), + }} + /> + } - }} - /> - )} + onUpload={async function (file: File) { + try { + await handleFileUpload(file) + } catch (error) { + // todo perhaps make this a toast? + console.error('Error uploading file:', error) + } + }} + /> + +