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

feat: add document styles in Builder #562

Merged
merged 9 commits into from
Mar 6, 2023
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"@emotion/react": "11.10.5",
"@emotion/styled": "11.10.5",
"@graasp/chatbox": "1.0.3",
"@graasp/query-client": "0.2.1",
"@graasp/sdk": "0.4.1",
"@graasp/translations": "1.5.0",
"@graasp/ui": "0.13.0",
"@graasp/query-client": "0.3.0",
"@graasp/sdk": "0.6.0",
"@graasp/translations": "1.7.0",
"@graasp/ui": "2.0.0",
"@mui/icons-material": "5.11.0",
"@mui/lab": "5.0.0-alpha.117",
"@mui/material": "5.11.6",
Expand Down
10 changes: 5 additions & 5 deletions src/components/common/CollapseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import { useEffect, useState } from 'react';
import { MUTATION_KEYS } from '@graasp/query-client';
import { Item } from '@graasp/sdk';
import { BUILDER } from '@graasp/translations';
import { ActionButton, ActionButtonVariant } from '@graasp/ui';

import { ButtonType } from '../../config/constants';
import { useBuilderTranslation } from '../../config/i18n';
import { useMutation } from '../../config/queryClient';
import { COLLAPSE_ITEM_BUTTON_CLASS } from '../../config/selectors';

type Props = {
item: Item;
type?: ButtonType;
type?: ActionButtonVariant;
onClick?: () => void;
};

const CollapseButton = ({
item,
type = ButtonType.ICON_BUTTON,
type = ActionButton.ICON_BUTTON,
onClick,
}: Props): JSX.Element => {
const { t: translateBuilder } = useBuilderTranslation();
Expand Down Expand Up @@ -57,7 +57,7 @@ const CollapseButton = ({
: translateBuilder(BUILDER.COLLAPSE_ITEM_COLLAPSE_TEXT);

switch (type) {
case ButtonType.MENU_ITEM:
case ActionButton.MENU_ITEM:
return (
<MenuItem
key={text}
Expand All @@ -68,7 +68,7 @@ const CollapseButton = ({
{text}
</MenuItem>
);
case ButtonType.ICON_BUTTON:
case ActionButton.ICON_BUTTON:
default:
return (
<Tooltip title={text}>
Expand Down
7 changes: 5 additions & 2 deletions src/components/common/DeleteButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ import { IconButtonProps } from '@mui/material/IconButton';
import { FC, useState } from 'react';

import { BUILDER } from '@graasp/translations';
import { DeleteButton as GraaspDeleteButton } from '@graasp/ui';
import {
ActionButtonVariant,
DeleteButton as GraaspDeleteButton,
} from '@graasp/ui';

import { useBuilderTranslation } from '../../config/i18n';
import { ITEM_DELETE_BUTTON_CLASS } from '../../config/selectors';
Expand All @@ -13,7 +16,7 @@ type Props = {
itemIds: string[];
color?: IconButtonProps['color'];
id?: string;
type?: string;
type?: ActionButtonVariant;
onClick?: () => void;
};

Expand Down
7 changes: 5 additions & 2 deletions src/components/common/FavoriteButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { FC } from 'react';
import { MUTATION_KEYS } from '@graasp/query-client';
import { ItemRecord, MemberRecord } from '@graasp/sdk/frontend';
import { BUILDER } from '@graasp/translations';
import { FavoriteButton as GraaspFavoriteButton } from '@graasp/ui';
import {
ActionButtonVariant,
FavoriteButton as GraaspFavoriteButton,
} from '@graasp/ui';

import { useBuilderTranslation } from '../../config/i18n';
import { useMutation } from '../../config/queryClient';
Expand All @@ -14,7 +17,7 @@ import { useCurrentUserContext } from '../context/CurrentUserContext';

type Props = {
item: ItemRecord;
type?: string;
type?: ActionButtonVariant;
onClick?: () => void;
size?: IconButtonProps['size'];
};
Expand Down
11 changes: 6 additions & 5 deletions src/components/common/HideButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ import Tooltip from '@mui/material/Tooltip';
import { MUTATION_KEYS } from '@graasp/query-client';
import { Item } from '@graasp/sdk';
import { BUILDER } from '@graasp/translations';
import { ActionButton, ActionButtonVariant } from '@graasp/ui';

import { ButtonType, HIDDEN_ITEM_TAG_ID } from '../../config/constants';
import { HIDDEN_ITEM_TAG_ID } from '../../config/constants';
import { useBuilderTranslation } from '../../config/i18n';
import { hooks, useMutation } from '../../config/queryClient';
import { HIDDEN_ITEM_BUTTON_CLASS } from '../../config/selectors';

type Props = {
item: Item;
type?: ButtonType;
type?: ActionButtonVariant;
onClick?: () => void;
};

const HideButton = ({
item,
type = ButtonType.ICON_BUTTON,
type = ActionButton.ICON_BUTTON,
onClick,
}: Props): JSX.Element => {
const { t: translateBuilder } = useBuilderTranslation();
Expand Down Expand Up @@ -69,7 +70,7 @@ const HideButton = ({
const icon = hiddenTag ? <VisibilityOff /> : <Visibility />;

switch (type) {
case ButtonType.MENU_ITEM: {
case ActionButton.MENU_ITEM: {
const menuItem = (
<MenuItem
key={text}
Expand All @@ -92,7 +93,7 @@ const HideButton = ({
</Tooltip>
);
}
case ButtonType.ICON_BUTTON:
case ActionButton.ICON_BUTTON:
default:
return (
<Tooltip title={tooltip}>
Expand Down
11 changes: 7 additions & 4 deletions src/components/common/MoveButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { IconButtonProps } from '@mui/material/IconButton';
import { FC, useContext } from 'react';

import { BUILDER } from '@graasp/translations';
import { MoveButton as GraaspMoveButton } from '@graasp/ui';
import {
ActionButton,
ActionButtonVariant,
MoveButton as GraaspMoveButton,
} from '@graasp/ui';

import { ButtonType } from '../../config/constants';
import { useBuilderTranslation } from '../../config/i18n';
import {
ITEM_MENU_MOVE_BUTTON_CLASS,
Expand All @@ -17,15 +20,15 @@ type MoveButtonProps = {
itemIds: string[];
color?: IconButtonProps['color'];
id?: string;
type?: ButtonType;
type?: ActionButtonVariant;
onClick?: () => void;
};

const MoveButton: FC<MoveButtonProps> = ({
itemIds,
color = 'default',
id,
type = ButtonType.ICON_BUTTON,
type = ActionButton.ICON_BUTTON,
onClick,
}) => {
const { t: translateBuilder } = useBuilderTranslation();
Expand Down
4 changes: 2 additions & 2 deletions src/components/common/PinButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { useState } from 'react';
import { MUTATION_KEYS } from '@graasp/query-client';
import { Item } from '@graasp/sdk';
import { BUILDER } from '@graasp/translations';
import { PinButton as GraaspPinButton } from '@graasp/ui';
import { ActionButtonVariant, PinButton as GraaspPinButton } from '@graasp/ui';

import { useBuilderTranslation } from '../../config/i18n';
import { useMutation } from '../../config/queryClient';
import { PIN_ITEM_BUTTON_CLASS } from '../../config/selectors';

type Props = {
type?: string;
type?: ActionButtonVariant;
item: Item;
onClick?: () => void;
};
Expand Down
10 changes: 5 additions & 5 deletions src/components/common/RecycleButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { FC } from 'react';

import { MUTATION_KEYS } from '@graasp/query-client';
import { BUILDER } from '@graasp/translations';
import { ActionButton, ActionButtonVariant } from '@graasp/ui';

import { ButtonType } from '../../config/constants';
import { useBuilderTranslation } from '../../config/i18n';
import { useMutation } from '../../config/queryClient';
import {
Expand All @@ -21,15 +21,15 @@ type Props = {
itemIds: string[];
color?: IconButtonProps['color'];
id?: string;
type?: ButtonType;
type?: ActionButtonVariant;
onClick?: () => void;
};

const RecycleButton: FC<Props> = ({
itemIds,
color = 'default',
id,
type = ButtonType.ICON_BUTTON,
type = ActionButton.ICON_BUTTON,
onClick,
}) => {
const { t: translateBuilder } = useBuilderTranslation();
Expand All @@ -45,7 +45,7 @@ const RecycleButton: FC<Props> = ({
const text = translateBuilder(BUILDER.RECYCLE_ITEM_BUTTON);

switch (type) {
case ButtonType.MENU_ITEM:
case ActionButton.MENU_ITEM:
return (
<MenuItem
key={text}
Expand All @@ -58,7 +58,7 @@ const RecycleButton: FC<Props> = ({
{text}
</MenuItem>
);
case ButtonType.ICON_BUTTON:
case ActionButton.ICON_BUTTON:
default:
return (
<Tooltip title={text}>
Expand Down
Loading