Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: [M3-6794] - MUI v5 Migration - Components > Box #9322

Merged
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tech Stories
---

MUI v5 Migration - Components > Box ([#9322](https://github.com/linode/manager/pull/9322))
2 changes: 1 addition & 1 deletion packages/manager/src/MainContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as React from 'react';
import { Redirect, Route, Switch } from 'react-router-dom';
import { compose } from 'recompose';
import Logo from 'src/assets/logo/akamai-logo.svg';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from 'tss-react/mui';
import { Theme } from '@mui/material/styles';
import Grid from '@mui/material/Unstable_Grid2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import RenderGuard from 'src/components/RenderGuard';
import { makeStyles } from 'tss-react/mui';
import { Theme, styled } from '@mui/material/styles';
import Box, { BoxProps } from '../core/Box';
import { Box, BoxProps } from '../Box';

const useStyles = makeStyles()((theme: Theme) => ({
root: {
Expand Down
20 changes: 20 additions & 0 deletions packages/manager/src/components/Box.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import React from 'react';
import { Meta, StoryObj } from '@storybook/react';
import { Box } from './Box';

const meta: Meta<typeof Box> = {
title: 'Components/Box',
component: Box,
};

type Story = StoryObj<typeof Box>;

export const Default: Story = {
render: (args) => <Box {...args} />,
args: {
children: 'This is text within a Box',
border: 1,
},
};

export default meta;
12 changes: 12 additions & 0 deletions packages/manager/src/components/Box.tsx
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to "extend" the box here to get the auto-doc args table to populate with props. I think this is fine because it gave me the opportunity to explain what the <Box /> even is.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { default as _Box, BoxProps } from '@mui/material/Box';

/**
* The Box component serves as a wrapper for creating simple layouts or styles.
* It uses a `<div />` unless unless you change it with the `component` prop
*/
export const Box = (props: BoxProps) => {
return <_Box {...props} />;
};

export type { BoxProps };
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { SxProps } from '@mui/system';
import * as React from 'react';
import type { NoticeProps } from 'src/components/Notice/Notice';
import { Notice } from 'src/components/Notice/Notice';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import useDismissibleNotifications, {
DismissibleNotificationOptions,
} from 'src/hooks/useDismissibleNotifications';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { action } from '@storybook/addon-actions';
import { EntityHeader } from 'src/components/EntityHeader/EntityHeader';
import Button from '../Button';
import Link from '../Link';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Hidden from 'src/components/core/Hidden';
import LinodeActionMenu from 'src/features/Linodes/LinodesLanding/LinodeActionMenu';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import type { ChartData, ChartPoint } from 'chart.js';
import { DateTime } from 'luxon';
import { visuallyHidden } from '@mui/utils';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';

export interface GraphTabledDataProps {
ariaLabel?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/LinkButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import classNames from 'classnames';
import Box from './core/Box';
import { Box } from './Box';
import CircularProgress from './core/CircularProgress';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/MaintenanceScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Link from 'src/components/Link';
import Typography from 'src/components/core/Typography';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Logo from 'src/assets/logo/akamai-logo.svg';
import BuildIcon from '@mui/icons-material/Build';
import Stack from '@mui/material/Stack';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Box from '../core/Box';
import { Box } from '../Box';
import Select from '../EnhancedSelect/Select';
import { PaginationControls } from '../PaginationControls/PaginationControls';
import { styled, useTheme } from '@mui/material/styles';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Paper from 'src/components/core/Paper';
import Typography from 'src/components/core/Typography';
import { CROSS_DATA_CENTER_CLONE_WARNING } from 'src/features/Linodes/LinodesCreate/utilities';
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/src/components/SideMenu.stories.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ArgsTable, Canvas, Meta, Story } from '@storybook/addon-docs';
import { useState } from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import SideMenu from './SideMenu';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { APIError } from '@linode/api-v4/lib/types';
import * as React from 'react';
import ActionsPanel from 'src/components/ActionsPanel';
import Button from 'src/components/Button';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { Notice } from 'src/components/Notice/Notice';
import { TextField, TextFieldProps } from 'src/components/TextField';
import { getAPIErrorOrDefault, getErrorMap } from 'src/utilities/errorUtils';
Expand Down
6 changes: 0 additions & 6 deletions packages/manager/src/components/core/Box.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import CheckBox from 'src/components/CheckBox';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Typography from 'src/components/core/Typography';
import Link from 'src/components/Link';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Hidden from 'src/components/core/Hidden';
import { TableBody } from 'src/components/TableBody';
import { TableHead } from 'src/components/TableHead';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Button from 'src/components/Button';
import { Currency } from 'src/components/Currency';
import Divider from 'src/components/core/Divider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { Currency } from 'src/components/Currency';
import { DateTimeDisplay } from 'src/components/DateTimeDisplay';
import { TooltipIcon } from 'src/components/TooltipIcon/TooltipIcon';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Database, DatabaseInstance } from '@linode/api-v4/lib/databases/types';
import { Theme } from '@mui/material/styles';
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Typography from 'src/components/core/Typography';
import { StatusIcon } from 'src/components/StatusIcon/StatusIcon';
import { useDatabaseTypesQuery } from 'src/queries/databases';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import DownloadIcon from 'src/assets/icons/lke-download.svg';
import Button from 'src/components/Button';
import { CircleProgress } from 'src/components/CircleProgress';
import { CopyTooltip } from 'src/components/CopyTooltip/CopyTooltip';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Typography from 'src/components/core/Typography';
import { TooltipIcon } from 'src/components/TooltipIcon/TooltipIcon';
import { DB_ROOT_USERNAME } from 'src/constants';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { styled } from '@mui/system';
import * as React from 'react';
import Button from 'src/components/Button';
import DismissibleBanner from 'src/components/DismissibleBanner';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Typography from 'src/components/core/Typography';
import { complianceUpdateContext } from 'src/context/complianceUpdateContext';
import { useNotificationsQuery } from 'src/queries/accountNotifications';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import * as React from 'react';
import { useHistory } from 'react-router-dom';
import Button from 'src/components/Button';
import CheckBox from 'src/components/CheckBox';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Paper from 'src/components/core/Paper';
import Typography from 'src/components/core/Typography';
import Link from 'src/components/Link';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import CheckBox from 'src/components/CheckBox';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Typography from 'src/components/core/Typography';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Close from '@mui/icons-material/Close';
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Divider from 'src/components/core/Divider';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import ActionsPanel from 'src/components/ActionsPanel';
import Button from 'src/components/Button';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Typography from 'src/components/core/Typography';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { EntityHeader } from 'src/components/EntityHeader/EntityHeader';
import { TableBody } from 'src/components/TableBody';
import { TableRow } from 'src/components/TableRow';
import { TagCell } from 'src/components/TagCell/TagCell';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { Chip } from 'src/components/core/Chip';
import Hidden from 'src/components/core/Hidden';
import Typography, { TypographyProps } from 'src/components/core/Typography';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import AccessPanel from 'src/components/AccessPanel/AccessPanel';
import Button from 'src/components/Button';
import { CheckoutSummary } from 'src/components/CheckoutSummary/CheckoutSummary';
import { CircleProgress } from 'src/components/CircleProgress';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Paper from 'src/components/core/Paper';
import TabPanels from 'src/components/core/ReachTabPanels';
import Tabs from 'src/components/core/ReachTabs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { filterUDFErrors } from './formUtilities';
import { APP_ROOT } from 'src/constants';
import { DebouncedSearchTextField } from 'src/components/DebouncedSearchTextField';
import Select, { Item } from 'src/components/EnhancedSelect';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Paper from 'src/components/core/Paper';
import Typography from 'src/components/core/Typography';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Accordion from 'src/components/Accordion';
import Link from 'src/components/Link';
import { Notice } from 'src/components/Notice/Notice';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { BetaChip } from 'src/components/BetaChip/BetaChip';
import Link from 'src/components/Link';
import { Notice } from 'src/components/Notice/Notice';
import { TooltipIcon } from 'src/components/TooltipIcon/TooltipIcon';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { CreateTypes } from 'src/store/linodeCreate/linodeCreate.actions';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Theme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import InlineMenuAction from 'src/components/InlineMenuAction';
import { useHistory } from 'react-router-dom';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';

interface Props {
onEdit: () => void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import * as React from 'react';
import { StyledActionPanel } from 'src/components/ActionsPanel/ActionsPanel';
import Button from 'src/components/Button';
import { CircleProgress } from 'src/components/CircleProgress';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Divider from 'src/components/core/Divider';
import FormControl from 'src/components/core/FormControl';
import FormControlLabel from 'src/components/core/FormControlLabel';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ArrowBackIosIcon from '@mui/icons-material/ArrowBackIos';
import { DateTime, Interval } from 'luxon';
import * as React from 'react';
import { CircleProgress } from 'src/components/CircleProgress';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from 'tss-react/mui';
import { Theme } from '@mui/material/styles';
import Typography from 'src/components/core/Typography';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import AccessPanel from 'src/components/AccessPanel/AccessPanel';
import ActionsPanel from 'src/components/ActionsPanel';
import Button from 'src/components/Button';
import CheckBox from 'src/components/CheckBox';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Divider from 'src/components/core/Divider';
import Grid from '@mui/material/Unstable_Grid2';
import ImageSelect from 'src/components/ImageSelect';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { useRegionsQuery } from 'src/queries/regions';
import { useAllTypes } from 'src/queries/types';
import { useGrants } from 'src/queries/profile';
import { usePreferences } from 'src/queries/preferences';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';

const useStyles = makeStyles((theme: Theme) => ({
resizeTitle: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ActionMenu, { Action } from 'src/components/ActionMenu';
import { Theme, useTheme } from '@mui/material/styles';
import useMediaQuery from '@mui/material/useMediaQuery';
import InlineMenuAction from 'src/components/InlineMenuAction';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { sendEvent } from 'src/utilities/analytics';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Typography from 'src/components/core/Typography';
import Grid from '@mui/material/Unstable_Grid2';
import { OrderByProps } from 'src/components/OrderBy';
import Paginate from 'src/components/Paginate';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import {
MIN_PAGE_SIZE,
PaginationFooter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Button from 'src/components/Button';
import { Dialog } from 'src/components/Dialog/Dialog';
import { Notice } from 'src/components/Notice/Notice';
import { TooltipIcon } from 'src/components/TooltipIcon/TooltipIcon';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import Typography from 'src/components/core/Typography';
import { MBpsInterDC } from 'src/constants';
import { resetEventsPolling } from 'src/eventsPolling';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { APIError } from '@linode/api-v4/lib/types';
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Typography from 'src/components/core/Typography';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { APIError } from '@linode/api-v4/lib/types';
import * as React from 'react';
import { compose } from 'recompose';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import { DocumentTitleSegment } from 'src/components/DocumentTitle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { APIError } from '@linode/api-v4/lib/types';
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Typography from 'src/components/core/Typography';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { APIError } from '@linode/api-v4/lib/types';
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Typography from 'src/components/core/Typography';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { APIError } from '@linode/api-v4/lib/types';
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import { DocumentTitleSegment } from 'src/components/DocumentTitle';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { APIError } from '@linode/api-v4/lib/types';
import { prop, sortBy } from 'ramda';
import * as React from 'react';
import Box from 'src/components/core/Box';
import { Box } from 'src/components/Box';
import { makeStyles } from '@mui/styles';
import { Theme } from '@mui/material/styles';
import Grid from 'src/components/Grid';
Expand Down
Loading