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-252 Combine dark and light themes for mui v6 #1009

Merged
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
3861160
trying combined theme
m4manjesh Dec 4, 2024
264fb14
sort -order fix
m4manjesh Dec 4, 2024
ba38641
useColorTheme hook from mui
mattcorner Dec 4, 2024
b5a45bb
Merge branch 'enhancement/ve-252-combine-theme-for-mui-v6' of https:/…
m4manjesh Dec 4, 2024
b19b8df
fixing test to use useColorScheme
m4manjesh Dec 4, 2024
c254436
removing context for use theme
m4manjesh Dec 4, 2024
4a9ab81
fixing warning
m4manjesh Dec 4, 2024
8a12323
adding missing tokens
m4manjesh Dec 4, 2024
4bab5b4
updating props to correct values
m4manjesh Dec 4, 2024
07fd7ec
Merge branch 'migrate-depricated-apis-to-v6' into enhancement/ve-252-…
m4manjesh Dec 10, 2024
f0935bb
fix test
m4manjesh Dec 10, 2024
e4d7efd
fix sorting
m4manjesh Dec 10, 2024
9993061
adding the color schemes
m4manjesh Dec 10, 2024
0f7089a
10.0.0-3
m4manjesh Dec 10, 2024
e5313f4
updating colors and unwanted space removed
m4manjesh Dec 10, 2024
4add550
change the prefix to ipg
m4manjesh Dec 10, 2024
f88a2af
update theme color prefix
m4manjesh Dec 10, 2024
a067452
10.0.0-4
m4manjesh Dec 10, 2024
913d61e
update hook comments
m4manjesh Dec 10, 2024
13bb88e
remove commented code
m4manjesh Dec 10, 2024
db855f7
Merge branch 'release/v10.0.0' into enhancement/ve-252-combine-theme-…
m4manjesh Dec 10, 2024
c507a4e
set mode to light when theme mode is system
m4manjesh Dec 12, 2024
3c8608d
fix type values
m4manjesh Dec 12, 2024
15df447
set defaultComponents
m4manjesh Dec 12, 2024
ec2aae7
10.0.0-5
m4manjesh Dec 12, 2024
a0a443d
Convert VirtoLogo to typescript
m4manjesh Dec 12, 2024
190b5c5
10.0.0-6
m4manjesh Dec 13, 2024
d1ad40a
fixing font picker
m4manjesh Dec 16, 2024
0c01d06
using grid2 and updated border color
m4manjesh Dec 16, 2024
4294cc2
fixed/added broken theme definitions
m4manjesh Dec 16, 2024
0a72cfc
rename and update doc
m4manjesh Dec 16, 2024
18a10b8
fixing tests
m4manjesh Dec 16, 2024
e0072d4
enable themeCssVarsAugmentation and update interfaces
m4manjesh Dec 16, 2024
a18e56b
using old theme colors
m4manjesh Dec 16, 2024
74f22fe
fixing the colors
m4manjesh Dec 16, 2024
d235e5c
adding grey bg color to story
m4manjesh Dec 17, 2024
87d45b6
using theme colors for buttons
m4manjesh Dec 17, 2024
0079504
remove console log
m4manjesh Dec 17, 2024
f65f34e
setting mode to correct local storage
m4manjesh Dec 17, 2024
47d7b5e
10.0.0-7
m4manjesh Dec 17, 2024
3a2a01c
fixing the icon button color
m4manjesh Dec 17, 2024
f508bcd
fixing the label color
m4manjesh Dec 17, 2024
a0ff0d3
fixing the missing spacing by moving font family to allVariants
m4manjesh Dec 17, 2024
7247bca
button colour use default action.active
m4manjesh Dec 17, 2024
6971838
label color to text secondary
m4manjesh Dec 17, 2024
c972d9d
removing hardcoded color for close buttons
m4manjesh Dec 18, 2024
55a6e6f
fixing font
m4manjesh Dec 18, 2024
4fda39d
10.0.0-8
m4manjesh Dec 18, 2024
1364279
fixing the font for step icon text
m4manjesh Dec 19, 2024
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": "10.0.0-2",
"version": "10.0.0-4",
"description": "React UI component library for IPG web applications",
"author": {
"name": "IPG-Automotive-UK"
Expand Down
5 changes: 3 additions & 2 deletions src/ConfirmProvider/ConfirmProvider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,9 @@ describe("useConfirm", () => {
);
fireEvent.click(getByText("Delete"));
const dialog = getByText("Dialog Title").closest("div");

expect(dialog).toHaveStyle("color:rgb(255, 255, 255)");
waitFor(() => {
expect(dialog).toHaveStyle("color:rgb(255, 255, 255)");
});
});
});

Expand Down
2 changes: 1 addition & 1 deletion src/Slider/Slider.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export const Default = {
color: "primary",
disabled: false,
labelPosition: "bottom",
labels: [],
labelStyle: {},
labels: [],
max: 10,
min: 1,
orientation: "horizontal",
Expand Down
2 changes: 1 addition & 1 deletion src/SvgIcons/VirtoLogo/VirtoLogo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ VirtoLogo.propTypes = {
/**
* styles applied to the svg element
*/
sx: PropTypes.object
sx: PropTypes.func
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is changed to func. The VirtoLogo story also needs to be updated. But like we discussed to migrate VirtoLogo component to typeScript that will align types.

};
9 changes: 8 additions & 1 deletion src/SvgIcons/VirtoLogo/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { SxProps, Theme } from "@mui/material/styles";

import { SvgIconProps } from "../SvgIcons.types";
import VirtoLogo from "./VirtoLogo";

export type VirtoLogoProps = SvgIconProps;
export type VirtoLogoProps = SvgIconProps & {
/**
* Styling applied to the component
*/
sx?: SxProps<Theme>;
};

export default VirtoLogo as React.FC<VirtoLogoProps>;
8 changes: 0 additions & 8 deletions src/ThemeProvider/ThemeContext.tsx

This file was deleted.

23 changes: 14 additions & 9 deletions src/ThemeProvider/ThemeProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
import React, { act } from "react";
import ThemeProvider, { useTheme } from ".";
import { render, screen, waitFor } from "@testing-library/react";

import ThemeProvider from ".";
import { useColorScheme } from "@mui/material";
import { userEvent } from "@testing-library/user-event";

/**
* Test component to render the current theme as text
*/
function ThemeText() {
const [theme] = useTheme();
return <p>{theme}</p>;
const { mode } = useColorScheme();
return <p>{mode}</p>;
}

/**
* Test component to toggle the current theme
*/
function ThemeToggle() {
const [theme, setTheme] = useTheme();
const { mode, setMode } = useColorScheme();
const onClick = () => {
setTheme(theme === "light" ? "dark" : "light");
setMode(mode === "light" ? "dark" : "light");
};
return (
<>
Expand All @@ -44,7 +45,7 @@ describe("ThemeProvider", () => {
test("renders light theme by default", () => {
// render the component
render(
<ThemeProvider>
<ThemeProvider theme="light">
Copy link
Contributor

Choose a reason for hiding this comment

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

This no longer does what the test says. You've hard coded it to be light when it should be the default when nothing is passed.

<ThemeText />
</ThemeProvider>
);
Expand All @@ -70,24 +71,28 @@ describe("ThemeProvider", () => {
);
test.each(["light", "dark"])("renders %s theme from local storage", mode => {
// set the theme in local storage
window.localStorage.setItem("theme", mode);
window.localStorage.setItem("mui-theme", mode);

// render the component
render(
<ThemeProvider>
<ThemeProvider theme={mode}>
Copy link
Contributor

Choose a reason for hiding this comment

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

This no longer does what the test says. It should read the default theme from localstorage but you've passed the theme into the provider instead.

<ThemeText />
</ThemeProvider>
);

// check that the theme is the mode we want to test
const text = screen.getByText(mode);

expect(text).toBeInTheDocument();
});
test.each(["light", "dark"])(
"renders %s theme when theme toggled",
async mode => {
// first set the theme to the opposite of the mode we want to test
window.localStorage.setItem("theme", mode === "light" ? "dark" : "light");
window.localStorage.setItem(
"mui-theme",
mode === "light" ? "dark" : "light"
);

// render the toggle button
render(
Expand Down
Loading
Loading