Skip to content

Commit

Permalink
feat: remove displaying description above folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ReidyT committed Mar 6, 2024
1 parent 1a4fe1e commit 6324c02
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 35 deletions.
15 changes: 1 addition & 14 deletions src/components/main/ItemsGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { Box, Grid, Pagination } from '@mui/material';

import {
DescriptionPlacement,
DiscriminatedItem,
ItemMembership,
ResultOf,
} from '@graasp/sdk';
import { DiscriminatedItem, ItemMembership, ResultOf } from '@graasp/sdk';

import { hooks } from '@/config/queryClient';
import { ShowOnlyMeChangeType } from '@/config/types';

import { ITEM_PAGE_SIZE } from '../../config/constants';
Expand All @@ -20,8 +14,6 @@ import EmptyItem from './EmptyItem';
import ItemCard from './ItemCard';
import ItemsToolbar from './ItemsToolbar';

const { useItem } = hooks;

type Props = {
id?: string;
items?: DiscriminatedItem[];
Expand Down Expand Up @@ -58,7 +50,6 @@ const ItemsGrid = ({
page = 1,
}: Props): JSX.Element => {
const pagesCount = Math.ceil(Math.max(1, totalCount / ITEM_PAGE_SIZE));
const { data: parentItem } = useItem(parentId);
const renderItems = () => {
if (!items?.length) {
return (
Expand Down Expand Up @@ -88,10 +79,6 @@ const ItemsGrid = ({
<ItemsToolbar
title={title}
subTitleElement={<FolderDescription itemId={parentId} />}
showSubTitleAbove={
parentItem?.settings.descriptionPlacement ===
DescriptionPlacement.ABOVE
}
headerElements={headerElements}
onShowOnlyMeChange={onShowOnlyMeChange}
showOnlyMe={showOnlyMe}
Expand Down
5 changes: 0 additions & 5 deletions src/components/main/ItemsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useCallback } from 'react';
import { useNavigate, useParams } from 'react-router-dom';

import {
DescriptionPlacement,
DiscriminatedItem,
ItemMembership,
ItemType,
Expand Down Expand Up @@ -276,10 +275,6 @@ const ItemsTable = ({
<ItemsToolbar
title={tableTitle}
subTitleElement={itemId ? <FolderDescription itemId={itemId} /> : null}
showSubTitleAbove={
parentItem?.settings.descriptionPlacement ===
DescriptionPlacement.ABOVE
}
headerElements={headerElements}
onShowOnlyMeChange={onShowOnlyMeChange}
showOnlyMe={showOnlyMe}
Expand Down
28 changes: 12 additions & 16 deletions src/components/main/ItemsToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import SelectTypes from '../common/SelectTypes';
type Props = {
title: string;
subTitleElement?: JSX.Element | null;
showSubTitleAbove?: boolean;
headerElements?: JSX.Element[];
onShowOnlyMeChange?: ShowOnlyMeChangeType;
showOnlyMe?: boolean;
Expand All @@ -18,30 +17,27 @@ type Props = {
const ItemsToolbar = ({
title,
subTitleElement,
showSubTitleAbove,
headerElements,
onShowOnlyMeChange,
showOnlyMe,
}: Props): JSX.Element => {
const { t } = useBuilderTranslation();
return (
<>
<Stack direction={showSubTitleAbove ? 'column-reverse' : 'column'}>
<Stack direction="row" justifyContent="space-between" spacing={1}>
<Typography variant="h4" sx={{ wordWrap: 'break-word' }}>
{title}
</Typography>
<Stack
direction="row"
alignItems="center"
justifyContent="flex-end"
spacing={1}
>
{headerElements}
</Stack>
<Stack direction="row" justifyContent="space-between" spacing={1}>
<Typography variant="h4" sx={{ wordWrap: 'break-word' }}>
{title}
</Typography>
<Stack
direction="row"
alignItems="center"
justifyContent="flex-end"
spacing={1}
>
{headerElements}
</Stack>
{subTitleElement}
</Stack>
{subTitleElement}
<Stack direction="column" mt={2} mb={2} spacing={1}>
{onShowOnlyMeChange && (
<FormControlLabel
Expand Down

0 comments on commit 6324c02

Please sign in to comment.