fix(striker-ui): adjust file list style; extend body text

main
Tsu-ba-me 3 years ago
parent 98fbb793a5
commit 74cd20dc7d
  1. 27
      striker-ui/components/Files/FileList.tsx
  2. 13
      striker-ui/components/Text/BodyText.tsx

@ -2,6 +2,7 @@ import { Box, Divider, List, ListItem } from '@mui/material';
import * as prettyBytes from 'pretty-bytes'; import * as prettyBytes from 'pretty-bytes';
import { DIVIDER } from '../../lib/consts/DEFAULT_THEME'; import { DIVIDER } from '../../lib/consts/DEFAULT_THEME';
import { UPLOAD_FILE_TYPES } from '../../lib/consts/UPLOAD_FILE_TYPES';
import { BodyText } from '../Text'; import { BodyText } from '../Text';
@ -19,22 +20,28 @@ const FileList = ({ filesOverview }: FileListProps): JSX.Element => {
}); });
return ( return (
<ListItem button key={fileUUID}> <ListItem key={fileUUID} sx={{ padding: '.6em 0' }}>
<Box <Box
sx={{ sx={{
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: { xs: 'column', md: 'row' },
width: '100%', width: '100%',
}} }}
> >
<Box sx={{ p: 1, flexGrow: 1 }}> <Box sx={{ flexGrow: 1 }}>
<Box <Box
sx={{ sx={{
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: 'row',
}} }}
> >
<BodyText text={fileName} /> <BodyText
sx={{
fontFamily: 'Source Code Pro',
fontWeight: 400,
}}
text={fileName}
/>
<Divider <Divider
flexItem flexItem
orientation="vertical" orientation="vertical"
@ -44,7 +51,9 @@ const FileList = ({ filesOverview }: FileListProps): JSX.Element => {
marginRight: '.5em', marginRight: '.5em',
}} }}
/> />
<BodyText text={fileType} /> <BodyText
text={UPLOAD_FILE_TYPES.get(fileType)?.[1] ?? ''}
/>
</Box> </Box>
<BodyText text={fileSize} /> <BodyText text={fileSize} />
</Box> </Box>
@ -55,7 +64,13 @@ const FileList = ({ filesOverview }: FileListProps): JSX.Element => {
flexDirection: 'row', flexDirection: 'row',
}} }}
> >
<BodyText text={fileChecksum} /> <BodyText
sx={{
fontFamily: 'Source Code Pro',
fontWeight: 400,
}}
text={fileChecksum}
/>
</Box> </Box>
</Box> </Box>
</ListItem> </ListItem>

@ -1,5 +1,5 @@
import { Typography } from '@mui/material'; import { styled, Typography, TypographyProps } from '@mui/material';
import { styled } from '@mui/material/styles';
import { TEXT, UNSELECTED } from '../../lib/consts/DEFAULT_THEME'; import { TEXT, UNSELECTED } from '../../lib/consts/DEFAULT_THEME';
const PREFIX = 'BodyText'; const PREFIX = 'BodyText';
@ -19,16 +19,17 @@ const StyledTypography = styled(Typography)(() => ({
}, },
})); }));
interface TextProps { type BodyTextProps = TypographyProps & {
text: string; text: string;
selected?: boolean; selected?: boolean;
} };
const BodyText = ({ text, selected }: TextProps): JSX.Element => { const BodyText = ({ sx, text, selected }: BodyTextProps): JSX.Element => {
return ( return (
<StyledTypography <StyledTypography
variant="subtitle1" {...{ sx }}
className={selected ? classes.selected : classes.unselected} className={selected ? classes.selected : classes.unselected}
variant="subtitle1"
> >
{text} {text}
</StyledTypography> </StyledTypography>

Loading…
Cancel
Save