1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00

fix: wrap env data before truncating env name. (#9733)

Solves an issue where the new buttons would potentially obscure the
entire name of the env:


![image](https://github.com/user-attachments/assets/0bb1e7e9-90da-414e-bd70-eef264ac1867)

 
Now, instead of using grid and container queries to find the right point
to break, we're using flex to always wrap before needing to truncate the
environment name. The name will still truncate if necessary.

Why didn't we do this originally? I ... couldn't think of a way to make
flex work in a 2D layout, but the `width: 100%` property seems to do the
trick 😄


![image](https://github.com/user-attachments/assets/fa81bf5b-3be0-4afa-8fc3-7a5b5ffeeefc)

PS: the buttons only stack when they have to. They stay single-line for
as long as possible. (just in case you were wondering).
<img width="711" alt="image"
src="https://github.com/user-attachments/assets/a9f85118-5b72-4618-a91b-f05c9d520663"
/>
This commit is contained in:
Thomas Heartman 2025-04-09 14:24:37 +02:00 committed by GitHub
parent 8da5fe6811
commit d5af58ce0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -37,24 +37,19 @@ const StyledHeader = styled('header')(({ theme }) => ({
color: theme.palette.text.primary,
alignItems: 'center',
minHeight: theme.spacing(8),
containerType: 'inline-size',
}));
const StyledHeaderTitle = styled('hgroup')(({ theme }) => ({
display: 'grid',
gridTemplateColumns: 'auto 1fr',
flexDirection: 'column',
display: 'flex',
flexFlow: 'row wrap',
flex: 1,
columnGap: theme.spacing(1),
'@container (max-width: 500px)': {
gridTemplateColumns: '1fr',
},
}));
const StyledHeaderTitleLabel = styled('p')(({ theme }) => ({
width: '100%',
fontSize: theme.fontSizes.smallerBody,
color: theme.palette.text.secondary,
gridColumn: '1/-1',
}));
const StyledTruncator = styled(Truncator)(({ theme }) => ({