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

fix: section sizes (#8423)

This PR fixes issues with section sizes including:
- Jank when they change suddenly
- Overflowing list of admins / events
- Short lists that should stretch to the height of their container.
This commit is contained in:
Thomas Heartman 2024-10-11 09:10:21 +02:00 committed by GitHub
parent 4c8aef58ae
commit 74370468d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 18 additions and 10 deletions

View File

@ -42,7 +42,7 @@ const placeholderData = (theme: Theme, label?: string) => ({
}); });
const ChartWrapper = styled('div')({ const ChartWrapper = styled('div')({
width: '90%', width: '80%',
}); });
export const PlaceholderFlagMetricsChart: React.FC<{ label?: string }> = ({ export const PlaceholderFlagMetricsChart: React.FC<{ label?: string }> = ({

View File

@ -9,7 +9,6 @@ const ContentGrid = styled('article')(({ theme }) => {
return { return {
backgroundColor: theme.palette.divider, backgroundColor: theme.palette.divider,
borderRadius: `${theme.shape.borderRadiusLarge}px`, borderRadius: `${theme.shape.borderRadiusLarge}px`,
overflow: 'hidden',
gap: `1px`, gap: `1px`,
display: 'flex', display: 'flex',
flexFlow: 'column nowrap', flexFlow: 'column nowrap',
@ -38,6 +37,7 @@ const onWideContainer =
export const ProjectGrid = styled(ContentGrid)( export const ProjectGrid = styled(ContentGrid)(
onWideContainer({ onWideContainer({
gridTemplateColumns: '1fr 1fr 1fr', gridTemplateColumns: '1fr 1fr 1fr',
gridTemplateRows: '410px auto',
display: 'grid', display: 'grid',
gridTemplateAreas: ` gridTemplateAreas: `
"projects box1 box2" "projects box1 box2"
@ -49,6 +49,7 @@ export const ProjectGrid = styled(ContentGrid)(
export const FlagGrid = styled(ContentGrid)( export const FlagGrid = styled(ContentGrid)(
onWideContainer({ onWideContainer({
gridTemplateColumns: '1fr 1fr 1fr', gridTemplateColumns: '1fr 1fr 1fr',
gridTemplateRows: '450px',
display: 'grid', display: 'grid',
gridTemplateAreas: ` gridTemplateAreas: `
"flags chart chart" "flags chart chart"
@ -60,6 +61,8 @@ export const GridItem = styled('div', {
shouldForwardProp: (prop) => !['gridArea', 'sx'].includes(prop.toString()), shouldForwardProp: (prop) => !['gridArea', 'sx'].includes(prop.toString()),
})<{ gridArea: string }>(({ theme, gridArea }) => ({ })<{ gridArea: string }>(({ theme, gridArea }) => ({
padding: theme.spacing(2, 4), padding: theme.spacing(2, 4),
maxHeight: '100%',
overflowY: 'auto',
gridArea, gridArea,
})); }));
@ -67,6 +70,8 @@ export const SpacedGridItem = styled('div', {
shouldForwardProp: (prop) => prop !== 'gridArea', shouldForwardProp: (prop) => prop !== 'gridArea',
})<{ gridArea: string }>(({ theme, gridArea }) => ({ })<{ gridArea: string }>(({ theme, gridArea }) => ({
padding: theme.spacing(3, 4), padding: theme.spacing(3, 4),
maxHeight: '100%',
overflowY: 'auto',
gridArea, gridArea,
})); }));

View File

@ -9,6 +9,9 @@ import { useLocationSettings } from 'hooks/useLocationSettings';
const Events = styled('ul')(({ theme }) => ({ const Events = styled('ul')(({ theme }) => ({
padding: 0, padding: 0,
alignItems: 'flex-start', alignItems: 'flex-start',
display: 'flex',
flexFlow: 'column nowrap',
gap: theme.spacing(2),
})); }));
const Event = styled('li')(({ theme }) => ({ const Event = styled('li')(({ theme }) => ({
@ -16,8 +19,7 @@ const Event = styled('li')(({ theme }) => ({
padding: theme.spacing(0), padding: theme.spacing(0),
display: 'inline-flex', display: 'inline-flex',
gap: theme.spacing(2), gap: theme.spacing(2),
alignItems: 'center', fontSize: theme.typography.body2.fontSize,
marginBottom: theme.spacing(4),
'*': { '*': {
fontWeight: 'normal', fontWeight: 'normal',
@ -44,6 +46,10 @@ const Timestamp = styled('time')(({ theme }) => ({
marginBottom: theme.spacing(1), marginBottom: theme.spacing(1),
})); }));
const StyledUserAvatar = styled(UserAvatar)(({ theme }) => ({
marginTop: theme.spacing(0.5),
}));
export const LatestProjectEvents: FC<{ export const LatestProjectEvents: FC<{
latestEvents: PersonalDashboardProjectDetailsSchema['latestEvents']; latestEvents: PersonalDashboardProjectDetailsSchema['latestEvents'];
}> = ({ latestEvents }) => { }> = ({ latestEvents }) => {
@ -64,10 +70,7 @@ export const LatestProjectEvents: FC<{
{latestEvents.map((event) => { {latestEvents.map((event) => {
return ( return (
<Event key={event.id}> <Event key={event.id}>
<UserAvatar <StyledUserAvatar src={event.createdByImageUrl} />
src={event.createdByImageUrl}
sx={{ mt: 1 }}
/>
<div> <div>
<Timestamp dateTime={event.createdAt}> <Timestamp dateTime={event.createdAt}>
{formatDateYMDHM( {formatDateYMDHM(

View File

@ -201,7 +201,7 @@ export const MyProjects = forwardRef<
<SpacedGridItem gridArea='projects'> <SpacedGridItem gridArea='projects'>
<List <List
disablePadding={true} disablePadding={true}
sx={{ maxHeight: '400px', overflow: 'auto' }} sx={{ height: '100%', overflow: 'auto' }}
> >
{projects.map((project) => ( {projects.map((project) => (
<ProjectListItem <ProjectListItem

View File

@ -389,7 +389,7 @@ export const PersonalDashboard = () => {
<List <List
disablePadding={true} disablePadding={true}
sx={{ sx={{
maxHeight: '400px', height: '100%',
overflow: 'auto', overflow: 'auto',
}} }}
> >