From a02e1a76fbcd22b2671b3a232432dffc5f071450 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Wed, 20 Jul 2022 18:18:48 -0400 Subject: [PATCH] fix(striker-ui): disable add network when limit(s) reached --- striker-ui/components/IconButton/IconButton.tsx | 6 ++++++ striker-ui/components/NetworkInitForm.tsx | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/striker-ui/components/IconButton/IconButton.tsx b/striker-ui/components/IconButton/IconButton.tsx index 298a226a..fb22451a 100644 --- a/striker-ui/components/IconButton/IconButton.tsx +++ b/striker-ui/components/IconButton/IconButton.tsx @@ -2,11 +2,13 @@ import { FC } from 'react'; import { IconButton as MUIIconButton, IconButtonProps as MUIIconButtonProps, + inputClasses as muiInputClasses, } from '@mui/material'; import { BLACK, BORDER_RADIUS, + DISABLED, GREY, TEXT, } from '../../lib/consts/DEFAULT_THEME'; @@ -30,6 +32,10 @@ const IconButton: FC = ({ backgroundColor: TEXT, }, + [`&.${muiInputClasses.disabled}`]: { + backgroundColor: DISABLED, + }, + ...sx, }, }} diff --git a/striker-ui/components/NetworkInitForm.tsx b/striker-ui/components/NetworkInitForm.tsx index 7ac9fe76..fc621480 100644 --- a/striker-ui/components/NetworkInitForm.tsx +++ b/striker-ui/components/NetworkInitForm.tsx @@ -410,7 +410,15 @@ const NetworkInitForm: FC = () => { justifyContent: 'center', }} > - + = networkInterfaces.length || + Object.values(networkInterfaceInputMap).every( + ({ isApplied }) => isApplied, + ) + } + onClick={createNetwork} + >