Skip to content

Commit

Permalink
chore: Constrains custom strategy titles to a single line (#9469)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman authored Mar 10, 2025
1 parent 51c9617 commit 23852af
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit
import type { PlaygroundStrategySchema } from 'openapi';
import { Badge } from '../Badge/Badge';
import { Link } from 'react-router-dom';
import { Truncator } from '../Truncator/Truncator';

type StrategyItemContainerProps = {
strategyHeaderLevel?: 1 | 2 | 3 | 4 | 5 | 6;
Expand Down Expand Up @@ -46,18 +47,25 @@ const StyledCustomTitle = styled('div')(({ theme }) => ({
}));
const StyledHeaderContainer = styled('hgroup')(({ theme }) => ({
display: 'flex',
flexFlow: 'row',
flexFlow: 'row nowrap',
columnGap: '1ch',
fontSize: theme.typography.body1.fontSize,
'.strategy-name': {
fontWeight: 'bold',
whiteSpace: 'nowrap',
},
}));

const StyledContainer = styled('article')({
background: 'inherit',
});

const StyledTruncator = styled(Truncator)(({ theme }) => ({
fontSize: theme.typography.body1.fontSize,
fontWeight: 'normal',
margin: 0,
}));

const NewStyledHeader = styled('div', {
shouldForwardProp: (prop) => prop !== 'draggable' && prop !== 'disabled',
})<{ draggable: boolean; disabled: boolean }>(
Expand Down Expand Up @@ -124,11 +132,11 @@ export const StrategyItemContainer: FC<StrategyItemContainerProps> = ({
)}
:
</p>
<Typography
<StyledTruncator
component={`h${strategyHeaderLevel}`}
>
{strategy.title}
</Typography>
</StyledTruncator>
</>
) : (
<Typography
Expand Down

0 comments on commit 23852af

Please sign in to comment.