Skip to content

Commit

Permalink
[ERP-3179] Chakra 3 Upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
ppettitau committed Jan 16, 2025
1 parent f5cb9c6 commit 0654ffd
Show file tree
Hide file tree
Showing 64 changed files with 3,465 additions and 3,318 deletions.
41 changes: 13 additions & 28 deletions frontend/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
{
"plugins": [
"prettier"
],
"extends": [
"next",
"next/core-web-vitals",
"prettier"
],
"plugins": ["prettier"],
"extends": ["next", "next/core-web-vitals", "prettier"],
"rules": {
"prettier/prettier": [
"error",
Expand Down Expand Up @@ -35,39 +29,30 @@
"jsx-a11y/anchor-is-valid": [
"error",
{
"components": [
"Link"
],
"specialLink": [
"hrefLeft",
"hrefRight"
],
"aspects": [
"invalidHref",
"preferButton"
]
"components": ["Link"],
"specialLink": ["hrefLeft", "hrefRight"],
"aspects": ["invalidHref", "preferButton"]
}
]
},
"overrides": [
{
"files": "**/*.+(ts|tsx)",
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint/eslint-plugin"
],
"extends": [
"plugin:@typescript-eslint/recommended",
"prettier"
],
"plugins": ["@typescript-eslint/eslint-plugin"],
"extends": ["plugin:@typescript-eslint/recommended", "prettier"],
"rules": {
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-unused-vars": ["error", { "ignoreRestSiblings": true }],
"@typescript-eslint/no-unused-vars": [
"error",
{ "ignoreRestSiblings": true }
],
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/prefer-as-const": "off"
"@typescript-eslint/prefer-as-const": "off",
"@typescript-eslint/no-empty-object-type": "off"
}
}
]
Expand Down
63 changes: 25 additions & 38 deletions frontend/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,58 +1,45 @@
import { FunctionComponent, PropsWithChildren, Suspense, useEffect } from "react";
import type { Preview } from "@storybook/react";
import { ChakraProvider, useColorMode } from "@chakra-ui/react";
import { theme } from "../theme";
import { ChakraProvider } from "@chakra-ui/react";
import { withThemeByClassName } from "@storybook/addon-themes";
import { system } from "../theme";
import { ColorModeProvider } from "../components/ui/color-mode";
import { AuthProvider } from "../context/auth-context";


interface ColorModeProps {
colorMode: 'light' | 'dark';
}

const ColorMode: FunctionComponent<PropsWithChildren<ColorModeProps>> = ({colorMode, children}) => {
const {setColorMode} = useColorMode();
useEffect(() => {
setColorMode(colorMode);
}, [colorMode]);
return children;
}

export const globalTypes = {
const globalTypes = {
colorMode: {
name: 'Chakra UI Color Mode',
defaultValue: 'dark',
name: "Chakra UI Color Mode",
defaultValue: "dark",
toolbar: {
items: [
{title: 'Light', value: 'light'},
{title: 'Dark', value: 'dark'}
{ title: "Light", value: "light" },
{ title: "Dark", value: "dark" },
],
dynamicTitle: true
}
}
dynamicTitle: true,
},
},
};

const withChakra = (Story, context) => {
return (
<ChakraProvider theme={theme}>
<ColorMode colorMode={context.globals.colorMode}>
<Story/>
</ColorMode>
</ChakraProvider>
<AuthProvider>
<ChakraProvider value={system}>
<ColorModeProvider forcedTheme={context.globals.colorMode}>
<Story />
</ColorModeProvider>
</ChakraProvider>
</AuthProvider>
);
};

const preview: Preview = {
globalTypes,
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
decorators: [
withThemeByClassName({
defaultTheme: "light",
themes: { light: "", dark: "dark" },
}),
withChakra,
]
],
};

export default preview;

This file was deleted.

Loading

0 comments on commit 0654ffd

Please sign in to comment.