Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

style: wrapping long item name #786

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<title>Graasp Builder</title>
</head>
<body>
<div id="root"></div>
<div id="root" style="width: 100%;"></div>
<script type="module" src="./src/main.tsx"></script>
</body>
</html>
11 changes: 8 additions & 3 deletions src/components/item/ItemMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box, Divider, Typography, styled } from '@mui/material';
import { ItemRecord } from '@graasp/sdk/frontend';
import { DrawerHeader } from '@graasp/ui';

import { RIGHT_MENU_WIDTH } from '../../config/constants';
import { DRAWER_WIDTH, RIGHT_MENU_WIDTH } from '../../config/constants';
import { useBuilderTranslation } from '../../config/i18n';
import { ITEM_MAIN_CLASS } from '../../config/selectors';
import { BUILDER } from '../../langs/constants';
Expand All @@ -13,6 +13,10 @@ import ItemMetadataContent from './ItemMetadataContent';
import ItemPanel from './ItemPanel';
import ItemHeader from './header/ItemHeader';

const Container = styled(Box)<{ open: boolean }>(({ open }) => ({
width: open ? `calc(100vw - ${DRAWER_WIDTH})` : '100vw',
}));

const StyledContainer = styled(Box)<{ open: boolean }>(({ theme, open }) => {
const openStyles = open
? {
Expand Down Expand Up @@ -58,10 +62,11 @@ const ItemMain = ({ id, children, item }: Props): JSX.Element => {
setIsItemMetadataMenuOpen,
isChatboxMenuOpen,
setIsChatboxMenuOpen,
isMainMenuOpen,
} = useLayoutContext();

return (
<div id={id} className={ITEM_MAIN_CLASS}>
<Container id={id} className={ITEM_MAIN_CLASS} open={isMainMenuOpen}>
{isChatboxMenuOpen && (
<ItemPanel open={isChatboxMenuOpen}>
<DrawerHeader
Expand Down Expand Up @@ -100,7 +105,7 @@ const ItemMain = ({ id, children, item }: Props): JSX.Element => {

{children}
</StyledContainer>
</div>
</Container>
);
};

Expand Down
20 changes: 11 additions & 9 deletions src/components/main/ItemsToolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
import { Box, Stack, Typography } from '@mui/material';
import { Grid, Stack, Typography } from '@mui/material';

type Props = {
title: string;
headerElements?: JSX.Element[];
};

const ItemsToolbar = ({ title, headerElements }: Props): JSX.Element => (
<Stack direction="row" justifyContent="space-between" spacing={1}>
<Box>
<Typography variant="h4" noWrap>
<Grid container spacing={2}>
<Grid item xs={6}>
<Typography variant="h4" sx={{ wordWrap: 'break-word' }}>
{title}
</Typography>
</Box>
<Stack direction="row" alignItems="center" justifyContent="flex-end">
{headerElements}
</Stack>
</Stack>
</Grid>
<Grid item xs={6}>
<Stack direction="row" alignItems="center" justifyContent="flex-end">
{headerElements}
</Stack>
</Grid>
</Grid>
);

export default ItemsToolbar;