fix(striker-ui): remove duplicate icon button declaration

main
Tsu-ba-me 3 years ago
parent cef5ae395c
commit 5a3ab20308
  1. 15
      striker-ui/components/Files/Files.tsx
  2. 12
      striker-ui/lib/consts/ICON_BUTTON_STYLE.ts

@ -1,16 +1,14 @@
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Box, IconButton } from '@mui/material'; import { Box } from '@mui/material';
import { import {
Add as AddIcon, Add as AddIcon,
Check as CheckIcon, Check as CheckIcon,
Edit as EditIcon, Edit as EditIcon,
} from '@mui/icons-material'; } from '@mui/icons-material';
import { styled } from '@mui/material/styles';
import EventEmitter from 'events'; import EventEmitter from 'events';
import API_BASE_URL from '../../lib/consts/API_BASE_URL'; import API_BASE_URL from '../../lib/consts/API_BASE_URL';
import { BLUE } from '../../lib/consts/DEFAULT_THEME'; import { BLUE } from '../../lib/consts/DEFAULT_THEME';
import ICON_BUTTON_STYLE from '../../lib/consts/ICON_BUTTON_STYLE';
import FileEditForm from './FileEditForm'; import FileEditForm from './FileEditForm';
import FileList from './FileList'; import FileList from './FileList';
@ -21,8 +19,7 @@ import Spinner from '../Spinner';
import { HeaderText } from '../Text'; import { HeaderText } from '../Text';
import fetchJSON from '../../lib/fetchers/fetchJSON'; import fetchJSON from '../../lib/fetchers/fetchJSON';
import IconButton from '../IconButton';
const StyledIconButton = styled(IconButton)(ICON_BUTTON_STYLE);
const Files = (): JSX.Element => { const Files = (): JSX.Element => {
const [rawFilesOverview, setRawFilesOverview] = useState<string[][]>([]); const [rawFilesOverview, setRawFilesOverview] = useState<string[][]>([]);
@ -108,13 +105,13 @@ const Files = (): JSX.Element => {
> >
<HeaderText text="Files" /> <HeaderText text="Files" />
{!isEditMode && ( {!isEditMode && (
<StyledIconButton onClick={onAddFileButtonClick}> <IconButton onClick={onAddFileButtonClick}>
<AddIcon /> <AddIcon />
</StyledIconButton> </IconButton>
)} )}
<StyledIconButton onClick={onEditFileButtonClick}> <IconButton onClick={onEditFileButtonClick}>
{isEditMode ? <CheckIcon sx={{ color: BLUE }} /> : <EditIcon />} {isEditMode ? <CheckIcon sx={{ color: BLUE }} /> : <EditIcon />}
</StyledIconButton> </IconButton>
</Box> </Box>
{fetchRawFilesError && ( {fetchRawFilesError && (
<MessageBox text={fetchRawFilesError} type="error" /> <MessageBox text={fetchRawFilesError} type="error" />

@ -1,12 +0,0 @@
import { BLACK, BORDER_RADIUS, GREY } from './DEFAULT_THEME';
const ICON_BUTTON_STYLE: Readonly<Record<string, unknown>> = {
borderRadius: BORDER_RADIUS,
backgroundColor: GREY,
'&:hover': {
backgroundColor: GREY,
},
color: BLACK,
};
export default ICON_BUTTON_STYLE;
Loading…
Cancel
Save