Skip to content

Commit a4a0d1d

Browse files
authored
PageContentBlockHeader has actions on the same line as title (#5619)
1 parent 630cbd7 commit a4a0d1d

File tree

1 file changed

+23
-37
lines changed

1 file changed

+23
-37
lines changed

src/core/ui/content/PageContentBlockHeader.tsx

+23-37
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Box, SvgIconProps, Theme, useMediaQuery } from '@mui/material';
1+
import { Box, SvgIconProps } from '@mui/material';
22
import { CaptionSmall } from '../typography';
33
import { PropsWithChildren, ReactElement, ReactNode } from 'react';
44
import { Actions } from '../actions/Actions';
@@ -25,50 +25,36 @@ const PageContentBlockHeader = ({
2525
fullWidth,
2626
children,
2727
}: PropsWithChildren<PageContentBlockHeaderProps>) => {
28-
const isSmallScreen = useMediaQuery((theme: Theme) => theme.breakpoints.down('lg'));
29-
const isMobile = useMediaQuery((theme: Theme) => theme.breakpoints.down('sm'));
30-
3128
const nextBlock = useNextBlockAnchor();
3229

3330
return (
34-
<>
31+
<Box
32+
display="flex"
33+
flexDirection="row"
34+
alignItems="center"
35+
gap={gutters(0.5)}
36+
position="relative"
37+
width={fullWidth ? '100%' : undefined}
38+
>
39+
<SkipLink anchor={nextBlock} sx={{ position: 'absolute', right: 0, top: 0 }} />
3540
<Box
41+
flexGrow={1}
42+
minWidth={0}
3643
display="flex"
3744
flexDirection="row"
38-
alignItems={isSmallScreen ? 'start' : 'center'}
39-
gap={gutters(0.5)}
40-
position="relative"
41-
width={fullWidth ? '100%' : undefined}
45+
rowGap={gutters(0.5)}
46+
justifyContent="space-between"
47+
flexWrap="wrap"
4248
>
43-
<SkipLink anchor={nextBlock} sx={{ position: 'absolute', right: 0, top: 0 }} />
44-
<Box
45-
flexGrow={1}
46-
minWidth={0}
47-
display="flex"
48-
flexDirection="row"
49-
rowGap={gutters(0.5)}
50-
justifyContent="space-between"
51-
flexWrap="wrap"
52-
>
53-
<BlockTitleWithIcon title={title} icon={icon} />
54-
{disclaimer && <CaptionSmall>{disclaimer}</CaptionSmall>}
55-
{children}
56-
</Box>
57-
{!isMobile && (
58-
// In desktop the expand button and the actions go in the same row
59-
<Actions>
60-
{actions}
61-
{dialogAction}
62-
</Actions>
63-
)}
64-
{isMobile && <Actions>{dialogAction}</Actions>}
49+
<BlockTitleWithIcon title={title} icon={icon} />
50+
{disclaimer && <CaptionSmall>{disclaimer}</CaptionSmall>}
51+
{children}
6552
</Box>
66-
{isMobile && (
67-
<Actions marginTop={gutters(-0.5)} flexDirection="row">
68-
{actions}
69-
</Actions>
70-
)}
71-
</>
53+
<Actions height={gutters()}>
54+
{actions}
55+
{dialogAction}
56+
</Actions>
57+
</Box>
7258
);
7359
};
7460

0 commit comments

Comments
 (0)