1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-04 01:18:20 +02:00

Fix/cr UI fixes (#2675)

This PR contains multiple UI fixes for the change request. It changes
font sizes, icon colors, margins and paddings to be more consistent.
This commit is contained in:
Fredrik Strand Oseberg 2022-12-12 16:32:38 +01:00 committed by GitHub
parent 5086ec7921
commit cef4181f11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 67 additions and 35 deletions

View File

@ -87,7 +87,7 @@ export const Change: FC<{
</StyledAlert> </StyledAlert>
} }
/> />
<Box sx={{ p: 2 }}> <Box sx={theme => ({ padding: theme.spacing(3) })}>
{change.action === 'updateEnabled' && ( {change.action === 'updateEnabled' && (
<ToggleStatusChange <ToggleStatusChange
enabled={change.payload.enabled} enabled={change.payload.enabled}

View File

@ -1,14 +1,22 @@
import { Box, Link, styled, Typography } from '@mui/material'; import { Box, styled, Typography } from '@mui/material';
import { FC, ReactNode } from 'react'; import { FC, ReactNode } from 'react';
export const ChangeItemWrapper = styled(Box)(({ theme }) => ({ export const ChangeItemWrapper = styled(Box)({
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
padding: theme.spacing(1), alignItems: 'center',
});
export const ChangeItemCreateEditWrapper = styled(Box)(({ theme }) => ({
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
marginBottom: theme.spacing(2),
})); }));
const ChangeItemInfo: FC = styled(Box)(({ theme }) => ({ const ChangeItemInfo: FC = styled(Box)(({ theme }) => ({
display: 'flex', display: 'flex',
alignItems: 'center',
gap: theme.spacing(1), gap: theme.spacing(1),
})); }));
@ -17,17 +25,19 @@ export const StrategyAddedChange: FC<{ discard?: ReactNode }> = ({
discard, discard,
}) => { }) => {
return ( return (
<ChangeItemWrapper> <ChangeItemCreateEditWrapper>
<ChangeItemInfo> <ChangeItemInfo>
<Typography <Typography
sx={theme => ({ color: theme.palette.success.dark })} sx={theme => ({
color: theme.palette.success.dark,
})}
> >
+ Adding strategy: + Adding strategy:
</Typography> </Typography>
{children} {children}
</ChangeItemInfo> </ChangeItemInfo>
{discard} {discard}
</ChangeItemWrapper> </ChangeItemCreateEditWrapper>
); );
}; };
@ -36,13 +46,13 @@ export const StrategyEditedChange: FC<{ discard?: ReactNode }> = ({
discard, discard,
}) => { }) => {
return ( return (
<ChangeItemWrapper> <ChangeItemCreateEditWrapper>
<ChangeItemInfo> <ChangeItemInfo>
<Typography>Editing strategy:</Typography> <Typography>Editing strategy:</Typography>
{children} {children}
</ChangeItemInfo> </ChangeItemInfo>
{discard} {discard}
</ChangeItemWrapper> </ChangeItemCreateEditWrapper>
); );
}; };

View File

@ -14,9 +14,12 @@ export const ToggleStatusChange: VFC<IToggleStatusChange> = ({
}) => { }) => {
return ( return (
<ChangeItemWrapper> <ChangeItemWrapper>
<Box> <Box sx={{ display: 'flex', alignItems: 'center' }}>
New status:{' '} New status:{' '}
<Badge color={enabled ? 'success' : 'error'}> <Badge
sx={theme => ({ marginLeft: theme.spacing(1) })}
color={enabled ? 'success' : 'error'}
>
{enabled ? ' Enabled' : 'Disabled'} {enabled ? ' Enabled' : 'Disabled'}
</Badge> </Badge>
</Box> </Box>

View File

@ -1,6 +1,6 @@
import { FC } from 'react'; import { FC } from 'react';
import { Link } from 'react-router-dom'; import { Link as RouterLink } from 'react-router-dom';
import { Alert, Box, Card, Typography } from '@mui/material'; import { Alert, Box, Card, Typography, Link } from '@mui/material';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
interface IFeatureToggleChanges { interface IFeatureToggleChanges {
@ -28,14 +28,14 @@ export const FeatureToggleChanges: FC<IFeatureToggleChanges> = ({
sx={theme => ({ sx={theme => ({
backgroundColor: Boolean(conflict) backgroundColor: Boolean(conflict)
? theme.palette.neutral.light ? theme.palette.neutral.light
: theme.palette.tableHeaderBackground, : theme.palette.neutral.light,
borderRadius: theme => borderRadius: theme =>
`${theme.shape.borderRadiusLarge}px ${theme.shape.borderRadiusLarge}px 0 0`, `${theme.shape.borderRadiusLarge}px ${theme.shape.borderRadiusLarge}px 0 0`,
border: '1px solid', border: '1px solid',
borderColor: theme => borderColor: theme =>
conflict conflict
? theme.palette.warning.border ? theme.palette.warning.border
: theme.palette.divider, : theme.palette.tertiary.main,
borderBottom: 'none', borderBottom: 'none',
overflow: 'hidden', overflow: 'hidden',
})} })}
@ -65,15 +65,22 @@ export const FeatureToggleChanges: FC<IFeatureToggleChanges> = ({
}} }}
> >
<Typography>Feature toggle name: </Typography> <Typography>Feature toggle name: </Typography>
<Typography
component={Link} <Link
component={RouterLink}
to={`/projects/${projectId}/features/${featureName}`} to={`/projects/${projectId}/features/${featureName}`}
color="primary" color="primary"
sx={{ textDecoration: 'none', marginLeft: 1 }} underline="hover"
sx={{
marginLeft: 1,
'& :hover': {
textDecoration: 'underline',
},
}}
onClick={onNavigate} onClick={onNavigate}
> >
<strong>{featureName}</strong> <strong>{featureName}</strong>
</Typography> </Link>
</Box> </Box>
</Box> </Box>
<Box>{children}</Box> <Box>{children}</Box>

View File

@ -30,8 +30,6 @@ export const StyledCard = styled(Card)(({ theme }) => ({
})); }));
export const StyledAvatar = styled(Avatar)(({ theme }) => ({ export const StyledAvatar = styled(Avatar)(({ theme }) => ({
marginLeft: theme.spacing(1),
marginRight: theme.spacing(1),
height: '24px', height: '24px',
width: '24px', width: '24px',
})); }));

View File

@ -30,9 +30,17 @@ export const ChangeRequestHeader: FC<{ changeRequest: IChangeRequest }> = ({
Created <TimeAgo date={new Date(changeRequest.createdAt)} />{' '} Created <TimeAgo date={new Date(changeRequest.createdAt)} />{' '}
by by
</Typography> </Typography>
<Tooltip title={changeRequest?.createdBy?.username}> <Box
<StyledAvatar src={changeRequest?.createdBy?.imageUrl} /> sx={theme => ({
</Tooltip> marginLeft: theme.spacing(1),
})}
>
<Tooltip title={changeRequest?.createdBy?.username}>
<StyledAvatar
src={changeRequest?.createdBy?.imageUrl}
/>
</Tooltip>
</Box>
<Box sx={{ ml: 1.5 }}> <Box sx={{ ml: 1.5 }}>
<StyledCard variant="outlined"> <StyledCard variant="outlined">
<Typography variant="body2"> <Typography variant="body2">

View File

@ -18,9 +18,6 @@ const StyledBox = styled(Box)(({ theme }) => ({
export const StyledSuccessIcon = styled(CheckCircle)(({ theme }) => ({ export const StyledSuccessIcon = styled(CheckCircle)(({ theme }) => ({
color: theme.palette.success.main, color: theme.palette.success.main,
height: '25px',
width: '25px',
marginRight: theme.spacing(1),
marginLeft: 'auto', marginLeft: 'auto',
})); }));
@ -31,7 +28,16 @@ export const ChangeRequestReviewer: FC<IChangeRequestReviewerProps> = ({
return ( return (
<StyledBox> <StyledBox>
<StyledAvatar src={imageUrl} /> <StyledAvatar src={imageUrl} />
<Typography variant="body1" color="text.secondary"> <Typography
variant="body1"
color="text.primary"
sx={{
maxWidth: '170px',
textOverflow: 'ellipsis',
overflow: 'hidden',
whiteSpace: 'nowrap',
}}
>
{name} {name}
</Typography> </Typography>
<StyledSuccessIcon /> <StyledSuccessIcon />

View File

@ -22,7 +22,7 @@ const StyledPageContent = styled(PageContent)(({ theme }) => ({
height: '100vh', height: '100vh',
overflow: 'auto', overflow: 'auto',
minWidth: '50vw', minWidth: '50vw',
padding: theme.spacing(4, 6), padding: theme.spacing(6),
[theme.breakpoints.down('md')]: { [theme.breakpoints.down('md')]: {
padding: theme.spacing(4, 2), padding: theme.spacing(4, 2),
}, },
@ -42,8 +42,8 @@ const BackButton = styled(Button)(({ theme }) => ({
export const StyledSuccessIcon = styled(CheckCircle)(({ theme }) => ({ export const StyledSuccessIcon = styled(CheckCircle)(({ theme }) => ({
color: theme.palette.success.main, color: theme.palette.success.main,
height: '25px', height: '32px',
width: '25px', width: '32px',
marginRight: theme.spacing(1), marginRight: theme.spacing(1),
})); }));

View File

@ -11,7 +11,6 @@ const StyledHelpOutline = styled(HelpOutline)(({ theme }) => ({
})); }));
const StyledHeaderHint = styled('div')(({ theme }) => ({ const StyledHeaderHint = styled('div')(({ theme }) => ({
marginTop: theme.spacing(0.5),
color: theme.palette.text.secondary, color: theme.palette.text.secondary,
fontSize: theme.fontSizes.smallBody, fontSize: theme.fontSizes.smallBody,
})); }));

View File

@ -38,7 +38,7 @@ export const useStyles = makeStyles()(theme => ({
marginBottom: '8px', marginBottom: '8px',
}, },
title: { title: {
marginBottom: '1.5rem', marginBottom: theme.fontSizes.mainHeader,
fontWeight: 'normal', fontWeight: 'normal',
}, },
subtitle: { subtitle: {

View File

@ -1,5 +1,5 @@
import { FC, ElementType } from 'react'; import { FC, ElementType } from 'react';
import { SvgIcon } from '@mui/material'; import { SvgIcon, useTheme } from '@mui/material';
import LocationOnIcon from '@mui/icons-material/LocationOn'; import LocationOnIcon from '@mui/icons-material/LocationOn';
import PeopleIcon from '@mui/icons-material/People'; import PeopleIcon from '@mui/icons-material/People';
import LanguageIcon from '@mui/icons-material/Language'; import LanguageIcon from '@mui/icons-material/Language';
@ -39,8 +39,9 @@ export const getFeatureStrategyIcon = (strategyName: string): ElementType => {
export const GetFeatureStrategyIcon: FC<{ strategyName: string }> = ({ export const GetFeatureStrategyIcon: FC<{ strategyName: string }> = ({
strategyName, strategyName,
}) => { }) => {
const theme = useTheme();
const Icon = getFeatureStrategyIcon(strategyName); const Icon = getFeatureStrategyIcon(strategyName);
return <Icon />; return <Icon style={{ color: theme.palette.neutral.main }} />;
}; };
export const formattedStrategyNames: Record<string, string> = { export const formattedStrategyNames: Record<string, string> = {