1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00

update styles in playground popoup

This commit is contained in:
Tymoteusz Czech 2022-07-29 12:34:46 +02:00
parent 95e55bc8ca
commit d31a5df321
7 changed files with 34 additions and 38 deletions

View File

@ -5,8 +5,7 @@ export const useStyles = makeStyles()(theme => ({
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
alignItems: 'flex-start', alignItems: 'flex-start',
padding: '48px', padding: theme.spacing(6),
gap: '24px',
width: '728px', width: '728px',
height: 'auto', height: 'auto',
overflowY: 'scroll', overflowY: 'scroll',

View File

@ -1,7 +1,7 @@
import { import {
PlaygroundFeatureSchema, PlaygroundFeatureSchema,
PlaygroundFeatureStrategyResult, PlaygroundFeatureStrategyResult,
} from '../../../../../hooks/api/actions/usePlayground/playground.model'; } from 'hooks/api/actions/usePlayground/playground.model';
import { IconButton, Popover, styled, Typography } from '@mui/material'; import { IconButton, Popover, styled, Typography } from '@mui/material';
import { InfoOutlined } from '@mui/icons-material'; import { InfoOutlined } from '@mui/icons-material';
import React, { useRef, useState } from 'react'; import React, { useRef, useState } from 'react';
@ -138,6 +138,7 @@ export const FeatureResultInfoPopoverCell = ({
<> <>
<Typography <Typography
variant={'subtitle1'} variant={'subtitle1'}
sx={{ mb: 2, color: 'text.secondary' }}
>{`Strategies (${strategies.length})`}</Typography> >{`Strategies (${strategies.length})`}</Typography>
{strategies.map((strategy, index) => ( {strategies.map((strategy, index) => (
<PlaygroundResultFeatureStrategyItem <PlaygroundResultFeatureStrategyItem

View File

@ -13,12 +13,7 @@ export const useStyles = makeStyles()(theme => ({
gap: '12px', gap: '12px',
}, },
descriptionRow: { descriptionRow: {
flexDirection: 'row', marginBottom: theme.spacing(2),
display: 'inline-flex',
alignItems: 'flex-start',
justifyItems: 'center',
marginTop: '-24px',
gap: '6px',
}, },
name: { name: {
fontWeight: 600, fontWeight: 600,

View File

@ -48,8 +48,10 @@ export const PlaygroundResultFeatureDetails = ({
</IconButton> </IconButton>
</div> </div>
<div className={styles.descriptionRow}> <div className={styles.descriptionRow}>
<Typography variant={'body1'}>{description}</Typography> <Typography variant="body1" component="span">
<Typography variant={'subtitle1'} color={color}> {description}
</Typography>
<Typography variant="subtitle1" color={color} component="span">
{reason} {reason}
</Typography> </Typography>
</div> </div>

View File

@ -28,5 +28,8 @@ export const useStyles = makeStyles()(theme => ({
[theme.breakpoints.down(400)]: { [theme.breakpoints.down(400)]: {
padding: '0.5rem', padding: '0.5rem',
}, },
paddingBottom: '1rem',
borderRadius: theme.shape.borderRadiusMedium,
background: theme.palette.background.default,
}, },
})); }));

View File

@ -1,32 +1,21 @@
import { ConditionallyRender } from '../../../../../common/ConditionallyRender/ConditionallyRender'; import { Box, useTheme } from '@mui/material';
import { StrategySeparator } from '../../../../../common/StrategySeparator/StrategySeparator'; import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import { styled, useTheme } from '@mui/material'; import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator';
import { useStyles } from './PlaygroundResultFeatureStrategyItem.styles';
import { import {
formatStrategyName, formatStrategyName,
getFeatureStrategyIcon, getFeatureStrategyIcon,
} from '../../../../../../utils/strategyNames'; } from 'utils/strategyNames';
import StringTruncator from '../../../../../common/StringTruncator/StringTruncator'; import StringTruncator from 'component/common/StringTruncator/StringTruncator';
import { PlaygroundResultChip } from '../../PlaygroundResultChip/PlaygroundResultChip'; import { PlaygroundResultChip } from '../../PlaygroundResultChip/PlaygroundResultChip';
import { PlaygroundFeatureStrategyResult } from 'hooks/api/actions/usePlayground/playground.model'; import { PlaygroundFeatureStrategyResult } from 'hooks/api/actions/usePlayground/playground.model';
import { PlaygroundResultStrategyExecution } from '../PlaygroundResultStrategyExecution/PlaygroundResultStrategyExecution'; import { PlaygroundResultStrategyExecution } from '../PlaygroundResultStrategyExecution/PlaygroundResultStrategyExecution';
import { useStyles } from './PlaygroundResultFeatureStrategyItem.styles';
interface IPlaygroundResultFeatureStrategyItemProps { interface IPlaygroundResultFeatureStrategyItemProps {
strategy: PlaygroundFeatureStrategyResult; strategy: PlaygroundFeatureStrategyResult;
index: number; index: number;
} }
const StyledStrategyResultBox = styled('div')(({ theme }) => ({
width: '100%',
position: 'relative',
paddingBottom: '1rem',
borderRadius: theme.shape.borderRadiusMedium,
'& + &': {
marginTop: theme.spacing(2),
},
background: theme.palette.background.default,
}));
export const PlaygroundResultFeatureStrategyItem = ({ export const PlaygroundResultFeatureStrategyItem = ({
strategy, strategy,
index, index,
@ -42,12 +31,12 @@ export const PlaygroundResultFeatureStrategyItem = ({
: `1px solid ${theme.palette.divider}`; : `1px solid ${theme.palette.divider}`;
return ( return (
<StyledStrategyResultBox key={strategy.id} sx={{ border }}> <Box key={strategy.id} sx={{ width: '100%', position: 'relative' }}>
<ConditionallyRender <ConditionallyRender
condition={index > 0} condition={index > 0}
show={<StrategySeparator text="OR" />} show={<StrategySeparator text="OR" />}
/> />
<div className={styles.innerContainer}> <Box className={styles.innerContainer} sx={{ border }}>
<div className={styles.header}> <div className={styles.header}>
<div className={styles.headerName}> <div className={styles.headerName}>
<Icon className={styles.icon} /> <Icon className={styles.icon} />
@ -69,7 +58,7 @@ export const PlaygroundResultFeatureStrategyItem = ({
percentageFill={theme.palette.tertiary.light} percentageFill={theme.palette.tertiary.light}
/> />
</div> </div>
</div> </Box>
</StyledStrategyResultBox> </Box>
); );
}; };

View File

@ -12,9 +12,18 @@ interface IResultChipProps {
label?: string; label?: string;
} }
export const StyledFalseChip = styled(Chip)(({ theme }) => ({ export const StyledChip = styled(Chip)(({ theme }) => ({
width: 80, width: 60,
borderRadius: '5px', height: 24,
borderRadius: theme.shape.borderRadius,
fontWeight: theme.typography.fontWeightMedium,
['& .MuiChip-label']: {
padding: 0,
paddingLeft: theme.spacing(0.5),
},
}));
export const StyledFalseChip = styled(StyledChip)(({ theme }) => ({
border: `1px solid ${theme.palette.error.main}`, border: `1px solid ${theme.palette.error.main}`,
backgroundColor: colors.red['200'], backgroundColor: colors.red['200'],
['& .MuiChip-label']: { ['& .MuiChip-label']: {
@ -25,9 +34,7 @@ export const StyledFalseChip = styled(Chip)(({ theme }) => ({
}, },
})); }));
export const StyledTrueChip = styled(Chip)(({ theme }) => ({ export const StyledTrueChip = styled(StyledChip)(({ theme }) => ({
width: 80,
borderRadius: '5px',
border: `1px solid ${theme.palette.success.main}`, border: `1px solid ${theme.palette.success.main}`,
backgroundColor: colors.green['100'], backgroundColor: colors.green['100'],
['& .MuiChip-label']: { ['& .MuiChip-label']: {