Skip to content

Commit

Permalink
Add smooth open and close animations
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Leonard authored and Robert Leonard committed Apr 9, 2024
1 parent 16e3d9c commit a2f4098
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions gateway-ui/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { Wallet } from "ethers";
import { Box, Button, Chip, CircularProgress, Container, FormControlLabel, Grid, Stack, TextField, Typography } from '@mui/material';
import { Box, Button, Chip, CircularProgress, Collapse, Container, FormControlLabel, Grid, Stack, TextField, Typography } from '@mui/material';
import ArrowDownwardIcon from '@mui/icons-material/ArrowDownward';
import { GatewayPortalData, useGatewayPortal } from './useGatewayPortal';
import { ArrowUpward } from '@mui/icons-material';
Expand All @@ -22,19 +22,17 @@ export const CollapsableGatewayPortal = (props: CollapsableGatewayProtocolPortal
const isLoading = !gatewayPortalData;
const hasValidToken = gatewayPortalData && gatewayPortalData.hasValidPass;

// Need button to be on both options
if(isCollapsed) {
return(
<CollapsableGatewayButton isCollapsed={isCollapsed} setIsCollapsed={setIsCollapsed} isValid={hasValidToken} isLoading={isLoading}/>
)
} else {
return(
<Stack sx={{alignItems: "center"}}>
<CollapsableGatewayButton isCollapsed={isCollapsed} setIsCollapsed={setIsCollapsed} isValid={hasValidToken} isLoading={isLoading}/>
return(
<Stack sx={{alignItems: "center"}} spacing={0.5}>
<FormControlLabel
control={<CollapsableGatewayButton isCollapsed={isCollapsed} setIsCollapsed={setIsCollapsed} isValid={hasValidToken} isLoading={isLoading}/>}
label=""
/>
<Collapse in={!isCollapsed}>
<GatewayProtocolPortal gatewayPortalData={gatewayPortalData} networkName={networkName}/>
</Stack>
)
}
</Collapse>
</Stack>
)
}

const CollapsableGatewayButton = (props: {isCollapsed: boolean, setIsCollapsed, isValid: boolean, isLoading: boolean}) => {
Expand Down

0 comments on commit a2f4098

Please sign in to comment.