mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +02:00
chore: Constrains custom strategy titles to a single line (#9469)
Constrains long custom strategy titles to a single line. Before:  After: 
This commit is contained in:
parent
51c9617da8
commit
23852afcdd
@ -8,6 +8,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
|
|||||||
import type { PlaygroundStrategySchema } from 'openapi';
|
import type { PlaygroundStrategySchema } from 'openapi';
|
||||||
import { Badge } from '../Badge/Badge';
|
import { Badge } from '../Badge/Badge';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { Truncator } from '../Truncator/Truncator';
|
||||||
|
|
||||||
type StrategyItemContainerProps = {
|
type StrategyItemContainerProps = {
|
||||||
strategyHeaderLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
strategyHeaderLevel?: 1 | 2 | 3 | 4 | 5 | 6;
|
||||||
@ -46,11 +47,12 @@ const StyledCustomTitle = styled('div')(({ theme }) => ({
|
|||||||
}));
|
}));
|
||||||
const StyledHeaderContainer = styled('hgroup')(({ theme }) => ({
|
const StyledHeaderContainer = styled('hgroup')(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexFlow: 'row',
|
flexFlow: 'row nowrap',
|
||||||
columnGap: '1ch',
|
columnGap: '1ch',
|
||||||
fontSize: theme.typography.body1.fontSize,
|
fontSize: theme.typography.body1.fontSize,
|
||||||
'.strategy-name': {
|
'.strategy-name': {
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -58,6 +60,12 @@ const StyledContainer = styled('article')({
|
|||||||
background: 'inherit',
|
background: 'inherit',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const StyledTruncator = styled(Truncator)(({ theme }) => ({
|
||||||
|
fontSize: theme.typography.body1.fontSize,
|
||||||
|
fontWeight: 'normal',
|
||||||
|
margin: 0,
|
||||||
|
}));
|
||||||
|
|
||||||
const NewStyledHeader = styled('div', {
|
const NewStyledHeader = styled('div', {
|
||||||
shouldForwardProp: (prop) => prop !== 'draggable' && prop !== 'disabled',
|
shouldForwardProp: (prop) => prop !== 'draggable' && prop !== 'disabled',
|
||||||
})<{ draggable: boolean; disabled: boolean }>(
|
})<{ draggable: boolean; disabled: boolean }>(
|
||||||
@ -124,11 +132,11 @@ export const StrategyItemContainer: FC<StrategyItemContainerProps> = ({
|
|||||||
)}
|
)}
|
||||||
:
|
:
|
||||||
</p>
|
</p>
|
||||||
<Typography
|
<StyledTruncator
|
||||||
component={`h${strategyHeaderLevel}`}
|
component={`h${strategyHeaderLevel}`}
|
||||||
>
|
>
|
||||||
{strategy.title}
|
{strategy.title}
|
||||||
</Typography>
|
</StyledTruncator>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Typography
|
<Typography
|
||||||
|
Loading…
Reference in New Issue
Block a user