;
const LinkComponent = ({ children }: { children: ReactNode }): JSX.Element => (
{children}
@@ -53,7 +52,11 @@ const mainContent = (
imperdiet. Semp risus in hendrerit gravida rutrum quisque non tellus.
Convallis co
-
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Rhoncus dolor purus
@@ -86,7 +89,7 @@ const mainContent = (
);
const headerLeftContent = (
-
+
Header
);
@@ -94,15 +97,15 @@ const headerLeftContent = (
const defaultArgs = {
drawerOpenAriaLabel: 'open drawer',
headerLeftContent: (
-
+
Header
),
drawerContent: (
- } />
- } />
- } />
+ } />
+ } />
+ } />
),
children: mainContent,
@@ -125,12 +128,11 @@ export const WithFooter = {
footerContent: (
Footer
-
),
},
@@ -158,7 +160,7 @@ export const Desktop = {
args: {
...defaultArgs,
headerLeftContent: (
-
+
Header with a quite long text is in the header
),
diff --git a/src/ui/MainMenu/MenuItem/MenuItem.tsx b/src/ui/MainMenu/MenuItem/MenuItem.tsx
index 0bd9c0f3b..192fdbd7b 100644
--- a/src/ui/MainMenu/MenuItem/MenuItem.tsx
+++ b/src/ui/MainMenu/MenuItem/MenuItem.tsx
@@ -1,3 +1,5 @@
+import { ReactElement, SyntheticEvent } from 'react';
+
import {
ListItem,
ListItemButton,
@@ -5,9 +7,7 @@ import {
ListItemText,
} from '@mui/material';
-import { ReactElement, SyntheticEvent } from 'react';
-
-import { useMobileView } from '@/hooks/useMobileView.js';
+import { useMobileView } from '@/ui/hooks/useMobileView.js';
import { useMainMenuOpenContext } from '../hooks.js';
diff --git a/src/ui/Navigation/CurrentItemNavigation.tsx b/src/ui/Navigation/CurrentItemNavigation.tsx
index 090aa3320..9baf0d60e 100644
--- a/src/ui/Navigation/CurrentItemNavigation.tsx
+++ b/src/ui/Navigation/CurrentItemNavigation.tsx
@@ -1,11 +1,9 @@
-import truncate from 'lodash.truncate';
-
import { Typography } from '@mui/material';
-import { LinkProps } from 'react-router-dom';
-
import { DiscriminatedItem, ItemType } from '@graasp/sdk';
+import truncate from 'lodash.truncate';
+
import ItemMenu, { ItemMenuProps } from './ItemMenu.js';
import CenterAlignWrapper from './common/CenterAlignWrapper.js';
import NavigationLink from './common/NavigationLink.js';
@@ -18,7 +16,7 @@ export type CurrentItemProps = {
buildMenuId?: (id: string) => string;
buildMenuItemId?: (id: string) => string;
useChildren: ItemMenuProps['useChildren'];
- buildToItemPath: (id: string) => LinkProps['to'];
+ buildToItemPath: (id: string) => string;
showArrow: boolean;
};
const CurrentItemNavigation = ({
diff --git a/src/ui/Navigation/ExtraItemsMenu.tsx b/src/ui/Navigation/ExtraItemsMenu.tsx
index 1e6e91a8e..e0c5dae30 100644
--- a/src/ui/Navigation/ExtraItemsMenu.tsx
+++ b/src/ui/Navigation/ExtraItemsMenu.tsx
@@ -1,15 +1,10 @@
-import { ChevronRightIcon } from 'lucide-react';
+import { useState } from 'react';
-import {
- IconButton,
- IconButtonProps,
- Menu,
- MenuItem,
- Typography,
-} from '@mui/material';
+import { IconButton, IconButtonProps, Menu, Typography } from '@mui/material';
-import { useState } from 'react';
-import { Link } from 'react-router-dom';
+import { ChevronRightIcon } from 'lucide-react';
+
+import { MenuItemLink } from '@/components/ui/MenuItemLink.js';
import { MenuItemType } from './Navigation.js';
@@ -21,7 +16,7 @@ export type ExtraItemsMenuProps = {
name: string;
};
-const Separator = ;
+const Separator = ;
const ExtraItemsMenu = ({
icon = Separator,
@@ -44,7 +39,7 @@ const ExtraItemsMenu = ({
<>
@@ -66,9 +61,9 @@ const ExtraItemsMenu = ({
}}
>
{menuItems?.map(({ name, path }) => (
-
+
))}
>
diff --git a/src/ui/Navigation/HomeMenu.tsx b/src/ui/Navigation/HomeMenu.tsx
index 933c8d7d3..18ddd61ae 100644
--- a/src/ui/Navigation/HomeMenu.tsx
+++ b/src/ui/Navigation/HomeMenu.tsx
@@ -1,20 +1,20 @@
-import { ChevronRightIcon, HomeIcon } from 'lucide-react';
+import React from 'react';
import {
IconButton,
IconButtonProps,
Menu,
- MenuItem,
MenuProps,
Typography,
} from '@mui/material';
-import React from 'react';
-import { Link } from 'react-router-dom';
+import { ChevronRightIcon, HomeIcon } from 'lucide-react';
+
+import { MenuItemLink } from '@/components/ui/MenuItemLink.js';
import NavigationLink from './common/NavigationLink.js';
-const Separator = ;
+const Separator = ;
type Props = {
selected: { name: string; id: string; to: string };
@@ -57,7 +57,7 @@ const HomeMenu = ({
onClick={handleClick}
id={homeDropdownId}
aria-controls={open ? 'root' : undefined}
- aria-haspopup='true'
+ aria-haspopup="true"
aria-expanded={open ? true : undefined}
>
{Separator}
@@ -78,14 +78,9 @@ const HomeMenu = ({
}}
>
{elements.map(({ name, id, to }) => (
-
+
))}
diff --git a/src/ui/Navigation/ItemMenu.tsx b/src/ui/Navigation/ItemMenu.tsx
index f6a1405f5..0aab4d997 100644
--- a/src/ui/Navigation/ItemMenu.tsx
+++ b/src/ui/Navigation/ItemMenu.tsx
@@ -1,26 +1,21 @@
-import type { UseQueryResult } from '@tanstack/react-query';
-import { ChevronRightIcon } from 'lucide-react';
-
-import {
- IconButton,
- IconButtonProps,
- Menu,
- MenuItem,
- Typography,
-} from '@mui/material';
-
import { useState } from 'react';
-import { Link, LinkProps } from 'react-router-dom';
+
+import { IconButton, IconButtonProps, Menu, Typography } from '@mui/material';
import { DiscriminatedItem } from '@graasp/sdk';
-export const Separator = ;
+import type { UseQueryResult } from '@tanstack/react-query';
+import { ChevronRightIcon } from 'lucide-react';
+
+import { MenuItemLink } from '@/components/ui/MenuItemLink';
+
+export const Separator = ;
export type ItemMenuProps = {
buildIconId?: (id: string) => string;
buildMenuId?: (itemId: string) => string;
buildMenuItemId?: (itemId: string) => string;
- buildToItemPath: (itemId: string) => LinkProps['to'];
+ buildToItemPath: (itemId: string) => string;
icon?: JSX.Element;
itemId: string;
useChildren: (...args: unknown[]) => UseQueryResult;
@@ -63,7 +58,7 @@ const ItemMenu = ({
onClick={handleClick}
id={buildIconId?.(itemId)}
aria-controls={open ? buildMenuId?.(itemId) : undefined}
- aria-haspopup='true'
+ aria-haspopup="true"
aria-expanded={open ? true : undefined}
>
{icon}
@@ -84,14 +79,13 @@ const ItemMenu = ({
}}
>
{items?.map(({ name, id }) => (
-
+
))}
>
diff --git a/src/ui/Navigation/Navigation.stories.tsx b/src/ui/Navigation/Navigation.stories.tsx
index 9e0ef2bc0..72c17108b 100644
--- a/src/ui/Navigation/Navigation.stories.tsx
+++ b/src/ui/Navigation/Navigation.stories.tsx
@@ -1,9 +1,3 @@
-import type { Meta, StoryObj } from '@storybook/react';
-import { expect, within } from '@storybook/test';
-import { CogIcon } from 'lucide-react';
-
-import { BrowserRouter } from 'react-router-dom';
-
import {
FolderItemFactory,
ItemType,
@@ -12,6 +6,10 @@ import {
MimeTypes,
} from '@graasp/sdk';
+import type { Meta, StoryObj } from '@storybook/react';
+import { expect, within } from '@storybook/test';
+import { CogIcon } from 'lucide-react';
+
import { MOCK_MEMBER } from '../utils/fixtures.js';
import HomeMenu from './HomeMenu.js';
import ItemMenu, { ItemMenuProps } from './ItemMenu.js';
@@ -43,11 +41,6 @@ const meta = {
},
},
},
- decorators: [
- (story) => {
- return {story()};
- },
- ],
render: (args) => {
return ;
diff --git a/src/ui/Navigation/common/NavigationLink.tsx b/src/ui/Navigation/common/NavigationLink.tsx
index f81402711..91d6bfde1 100644
--- a/src/ui/Navigation/common/NavigationLink.tsx
+++ b/src/ui/Navigation/common/NavigationLink.tsx
@@ -1,12 +1,13 @@
+import { ReactNode } from 'react';
+
import { styled } from '@mui/material';
-import { ReactNode } from 'react';
-import { Link, LinkProps } from 'react-router-dom';
+import { Link } from '@tanstack/react-router';
const NavigationLink: (props: {
id?: string;
children: ReactNode;
- to: LinkProps['to'];
+ to: string;
}) => ReactNode = styled(Link)(({ theme }) => ({
textDecoration: 'none',
color: theme.palette.text.primary,
diff --git a/src/ui/Sidebar/Sidebar.stories.tsx b/src/ui/Sidebar/Sidebar.stories.tsx
index deb5acfda..685574886 100644
--- a/src/ui/Sidebar/Sidebar.stories.tsx
+++ b/src/ui/Sidebar/Sidebar.stories.tsx
@@ -1,9 +1,9 @@
+import { Typography } from '@mui/material';
+
import type { Meta, StoryObj } from '@storybook/react';
import { CirclePlus, Snowflake, Sparkles } from 'lucide-react';
-import { Typography } from '@mui/material';
-
-import { MenuItem } from '@/MainMenu/MenuItem/MenuItem.js';
+import { MenuItem } from '@/ui/MainMenu/MenuItem/MenuItem.js';
import { TABLE_CATEGORIES } from '../utils/storybook.js';
import Sidebar from './Sidebar.js';
@@ -17,7 +17,7 @@ const meta: Meta = {
return (
<>
{story()}
-
+
>
);
},
@@ -48,9 +48,9 @@ export const Default: Story = {
drawerHeaderContent: My Title,
children: (
<>
- } />
- } />
- } />
+ } />
+ } />
+ } />
>
),
},
diff --git a/src/ui/TextEditor/TextEditor.tsx b/src/ui/TextEditor/TextEditor.tsx
index f746f07ea..a9ca07e9a 100644
--- a/src/ui/TextEditor/TextEditor.tsx
+++ b/src/ui/TextEditor/TextEditor.tsx
@@ -13,6 +13,8 @@ declare const window: Window &
katex: typeof katex;
};
+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
+// @ts-expect-error
window.katex = katex;
const TEXT_EDITOR_TOOLBAR = [
diff --git a/src/ui/buttons/SaveButton/SaveButton.stories.tsx b/src/ui/buttons/SaveButton/SaveButton.stories.tsx
index 49f2c8f25..569d0096d 100644
--- a/src/ui/buttons/SaveButton/SaveButton.stories.tsx
+++ b/src/ui/buttons/SaveButton/SaveButton.stories.tsx
@@ -1,7 +1,7 @@
import type { Meta, StoryObj } from '@storybook/react';
import { fn } from '@storybook/test';
-import { TABLE_CATEGORIES } from '@/utils/storybook.js';
+import { TABLE_CATEGORIES } from '@/ui/utils/storybook.js';
import SaveButton from './SaveButton.js';
diff --git a/src/ui/draggable/DraggingWrapper.stories.tsx b/src/ui/draggable/DraggingWrapper.stories.tsx
index 081dfb194..a0ad16129 100644
--- a/src/ui/draggable/DraggingWrapper.stories.tsx
+++ b/src/ui/draggable/DraggingWrapper.stories.tsx
@@ -1,14 +1,12 @@
-import { type Meta, type StoryObj } from '@storybook/react';
-
import { Box } from '@mui/material';
-import { BrowserRouter } from 'react-router-dom';
-
import { FolderItemFactory, FolderItemType } from '@graasp/sdk';
-import Card from '@/Card/Card.js';
-import ItemBadges from '@/ItemBadges/ItemBadges.js';
-import { TABLE_CATEGORIES } from '@/utils/storybook.js';
+import { type Meta, type StoryObj } from '@storybook/react';
+
+import Card from '@/ui/Card/Card.js';
+import ItemBadges from '@/ui/ItemBadges/ItemBadges.js';
+import { TABLE_CATEGORIES } from '@/ui/utils/storybook.js';
import DraggingWrapper from './DraggingWrapper.js';
@@ -19,11 +17,6 @@ const makeData = (len: number): FolderItemType[] => {
const meta: Meta = {
title: 'Common/Draggable',
component: DraggingWrapper,
- decorators: [
- (story) => {
- return {story()};
- },
- ],
argTypes: {
onDropInRow: {
diff --git a/src/ui/itemLogin/ItemLoginWrapper.stories.tsx b/src/ui/itemLogin/ItemLoginWrapper.stories.tsx
index c113cbe8b..df2c4adde 100644
--- a/src/ui/itemLogin/ItemLoginWrapper.stories.tsx
+++ b/src/ui/itemLogin/ItemLoginWrapper.stories.tsx
@@ -1,8 +1,3 @@
-import type { Meta, StoryObj } from '@storybook/react';
-import { expect, fn, within } from '@storybook/test';
-import { StatusCodes } from 'http-status-codes';
-import { v4 } from 'uuid';
-
import {
AccountType,
CompleteMember,
@@ -10,7 +5,12 @@ import {
PackedDocumentItemFactory,
} from '@graasp/sdk';
-import Card from '@/Card/Card.js';
+import type { Meta, StoryObj } from '@storybook/react';
+import { expect, fn, within } from '@storybook/test';
+import { StatusCodes } from 'http-status-codes';
+import { v4 } from 'uuid';
+
+import Card from '@/ui/Card/Card.js';
import ItemLoginWrapper from './ItemLoginWrapper.js';
import { FORBIDDEN_TEXT } from './constants.js';
@@ -33,7 +33,7 @@ const meta = {
signIn: fn(),
itemId: item.id,
itemErrorStatusCode: null,
- children: ,
+ children: ,
},
} satisfies Meta;
@@ -81,7 +81,7 @@ export const Enroll = {
itemId: v4(),
itemLoginSchemaType: ItemLoginSchemaType.Username,
enrollContent: (
-
+
Enroll Content
),
@@ -99,7 +99,7 @@ export const RequestAccess = {
itemId: v4(),
itemErrorStatusCode: StatusCodes.FORBIDDEN,
requestAccessContent: (
-
+
Request Access
),
diff --git a/src/ui/items/LinkItem.stories.tsx b/src/ui/items/LinkItem.stories.tsx
index d8a36dadc..fd325dcb6 100644
--- a/src/ui/items/LinkItem.stories.tsx
+++ b/src/ui/items/LinkItem.stories.tsx
@@ -1,10 +1,8 @@
+import { ItemType, LinkItemFactory } from '@graasp/sdk';
+
import type { Meta, StoryObj } from '@storybook/react';
import { expect, fn, userEvent, within } from '@storybook/test';
-import { BrowserRouter } from 'react-router-dom';
-
-import { ItemType, LinkItemFactory } from '@graasp/sdk';
-
import { MOCK_MEMBER } from '../utils/fixtures.js';
import LinkItem from './LinkItem.js';
@@ -69,11 +67,6 @@ const meta = {
},
},
},
- decorators: [
- (story) => {
- return
{story()};
- },
- ],
args: {
onClick: fn(),
},