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

VE-221 Migrate deprecated APIs #989

Merged
merged 16 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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 package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ipguk/react-ui",
"version": "9.0.2",
"version": "10.0.0-2",
"description": "React UI component library for IPG web applications",
"author": {
"name": "IPG-Automotive-UK"
Expand Down
43 changes: 31 additions & 12 deletions src/AppHeader/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ function AppHeader({
})}
>
<Toolbar style={{ justifyContent: "space-between" }}>
<Box display="flex" alignItems="center">
<Box
sx={{
alignItems: "center",
display: "flex"
}}
>
<IpgLogo
textColour={mode === "light" ? "white" : "black"}
sx={{
Expand All @@ -31,28 +36,42 @@ function AppHeader({
}}
/>
</Box>
<Box display="flex" alignItems="center">
<Box
sx={{
alignItems: "center",
display: "flex"
}}
>
{appLogo ? (
<span>{appLogo}</span>
) : (
<Typography
variant="h6"
fontSize="20px"
lineHeight="34px"
letterSpacing="0.05em"
fontWeight="600"
sx={theme => ({
color: "white",
...theme.applyStyles("dark", {
color: "#003063"
sx={[
{
fontSize: "20px",
fontWeight: "600",
letterSpacing: "0.05em",
lineHeight: "34px"
},
theme => ({
color: "white",
...theme.applyStyles("dark", {
color: "#003063"
})
})
})}
]}
>
<span>{appName}</span>
</Typography>
)}
</Box>
<Box display="flex" alignItems="center">
<Box
sx={{
alignItems: "center",
display: "flex"
}}
>
{children}
<UserMenu
username={username}
Expand Down
28 changes: 24 additions & 4 deletions src/AppLauncher/AppLauncher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ function AppLauncher({
// header logo
const logoBox = (
<Fragment>
<Box display="flex" justifyContent="center">
<Box
sx={{
display: "flex",
justifyContent: "center"
}}
>
<VirtoLogo
sx={theme => ({
color: theme.palette.primary.main,
Expand All @@ -103,7 +108,12 @@ function AppLauncher({
);

return (
<Box px={2} py={3}>
<Box
sx={{
px: 2,
py: 3
}}
>
{showLogo ? (
<Fragment>
{logoLinkUrl ? (
Expand All @@ -122,7 +132,13 @@ function AppLauncher({
)}
</Fragment>
) : null}
<Box display="flex" flexWrap="wrap" justifyContent="space-between">
<Box
sx={{
display: "flex",
flexWrap: "wrap",
justifyContent: "space-between"
}}
>
{appList.map(app => {
return (
<Paper
Expand Down Expand Up @@ -179,7 +195,11 @@ function AppLauncher({
VIRTO Status
</Link>
</Box>
<Box flexGrow={1} />
<Box
sx={{
flexGrow: 1
}}
/>
</Box>
);
}
Expand Down
90 changes: 41 additions & 49 deletions src/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, CssBaseline, Drawer, Hidden } from "@mui/material";
import { Box, CssBaseline, Drawer, useMediaQuery } from "@mui/material";
import React, { Fragment, useState } from "react";

import AppHeader from "../AppHeader";
Expand Down Expand Up @@ -26,9 +26,17 @@ function Layout({
// define state for managing dynamic sidebar
const [mobileOpen, setMobileOpen] = useState(false);

// check if screen is medium
const isMediumScreen = useMediaQuery(theme => theme.breakpoints.down("md"));

return (
<Fragment>
<Box height="100vh" display="flex">
<Box
sx={{
display: "flex",
height: "100vh"
}}
>
<CssBaseline />
<AppHeader
appName={appName}
Expand All @@ -47,56 +55,40 @@ function Layout({
}
})}
>
<Hidden mdUp>
<Drawer
variant="temporary"
anchor="left"
open={mobileOpen}
onClose={() => setMobileOpen(false)}
sx={{
"& .MuiDrawer-paper": {
height: `calc(100% - 64px)`,
paddingTop: "8px",
top: "64px",
width: sidebarWidth
}
}}
>
<Sidebar showLogo={false} showVersion={false}>
{sidebarContent}
</Sidebar>
</Drawer>
</Hidden>
<Hidden mdDown>
<Drawer
sx={{
"& .MuiDrawer-paper": {
height: `calc(100% - 64px)`,
paddingTop: "8px",
top: "64px",
width: sidebarWidth
}
}}
variant="permanent"
open
<Drawer
variant={isMediumScreen ? "temporary" : "permanent"}
anchor="left"
open={isMediumScreen ? mobileOpen : true}
onClose={isMediumScreen ? () => setMobileOpen(false) : undefined}
sx={theme => ({
"& .MuiDrawer-paper": {
height: `calc(100vh - ${theme.mixins.toolbar.minHeight}px)`,
paddingTop: "8px",
top: theme.mixins.toolbar.minHeight,
width: sidebarWidth
}
})}
>
<Sidebar
showLogo={false}
showVersion={isMediumScreen ? false : appVersion !== undefined}
appVersion={appVersion}
>
<Sidebar
showLogo={false}
showVersion={appVersion !== undefined}
appVersion={appVersion}
>
{sidebarContent}
</Sidebar>
</Drawer>
</Hidden>
{sidebarContent}
</Sidebar>
</Drawer>
</Box>
<Box
flexGrow={1}
display="flex"
flexDirection="column"
sx={theme => ({
background: theme.palette.background.default
})}
sx={[
{
display: "flex",
flexDirection: "column",
flexGrow: 1
},
theme => ({
background: theme.palette.background.default
})
]}
>
<Box sx={theme => theme.mixins.toolbar} />
<Box
Expand Down
18 changes: 11 additions & 7 deletions src/Autocomplete/Autocomplete.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,21 @@ export default function Autocomplete<
label={label}
error={error}
helperText={helperText}
InputProps={{
...params.InputProps,
className: readOnly ? "Mui-disabled label.Mui-disabled" : undefined
}}
InputLabelProps={{
...params.InputLabelProps
}}
name={name}
margin={margin}
required={required}
variant={variant}
slotProps={{
input: {
...params.InputProps,
className: readOnly
? "Mui-disabled label.Mui-disabled"
: undefined
},
inputLabel: {
...params.InputLabelProps
}
}}
/>
)}
renderOption={Option}
Expand Down
22 changes: 16 additions & 6 deletions src/CanvasItem/CanvasItem.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ const Template = args => {
};

return (
<Box width="100%" height="100%" onClick={onCanvasClick}>
<Box
onClick={onCanvasClick}
sx={{
height: "100%",
width: "100%"
}}
>
<CanvasItem
{...args}
{...rectangle}
Expand All @@ -100,11 +106,15 @@ const Template = args => {
onClick={onClick}
>
<Box
sx={theme => ({
background: theme.palette.grey[100]
})}
width="100%"
height="100%"
sx={[
{
height: "100%",
width: "100%"
},
theme => ({
background: theme.palette.grey[100]
})
]}
></Box>
</CanvasItem>
</Box>
Expand Down
29 changes: 21 additions & 8 deletions src/Card/DetailCard/DetailCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ function DetailCard({
return (
<Stack
className="detail-card-container"
mt={1}
mb={3}
sx={{
display: "flex",
flexDirection: "column",
flexGrow: 1,
height: "100%",
mb: 3,
mt: 1,
width
}}
>
Expand All @@ -55,7 +55,11 @@ function DetailCard({
overflow: "auto"
}}
>
<Box ml={0.5}>
<Box
sx={{
ml: 0.5
}}
>
<Card>
<Infographic media={media} />
<FileDetails
Expand All @@ -69,9 +73,14 @@ function DetailCard({
</Card>
</Box>
<Stack
ml={2}
spacing={2}
sx={{ display: "flex", flexGrow: 1, mr: 0.5, width: "100%" }}
sx={{
display: "flex",
flexGrow: 1,
ml: 2,
mr: 0.5,
width: "100%"
}}
>
{content}
</Stack>
Expand Down Expand Up @@ -133,11 +142,11 @@ function DetailCardHeader({
return (
<Fragment>
<Box
m={1}
sx={{
display: "flex",
flexDirection: "row",
justifyContent: "space-between"
justifyContent: "space-between",
m: 1
}}
>
<Box sx={{ width: headerContentWidth }}>
Expand Down Expand Up @@ -170,7 +179,11 @@ function DetailCardHeader({
{buttonsStack}
</Box>
</Box>
<Box mx={1}>
<Box
sx={{
mx: 1
}}
>
{labels && labels.length > 0 && <LabelChipGroup chips={labelChips} />}
</Box>
</Fragment>
Expand Down
6 changes: 5 additions & 1 deletion src/Card/SummaryCard/SummaryCard.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,11 @@ const WithMoreOptionsButtonRef: StoryFn<SummaryCardProps> = args => {
vertical: "bottom"
}}
>
<Box p={2}>
<Box
sx={{
p: 2
}}
>
<Typography>
This popover is anchored to the more options button
</Typography>
Expand Down
Loading
Loading