From 949eeff400864201ff3312ac888ba5d8ccaa1c70 Mon Sep 17 00:00:00 2001 From: Apoorva2696 Date: Thu, 6 Oct 2022 20:41:25 +0530 Subject: [PATCH 1/3] smart context removed --- templates/common/package.json | 1 - templates/common/packages/utils/package.json | 3 +-- .../utils/testUtils/test/SmartContextDemo.tsx | 11 -------- .../test/SmartContextProviderDemo.tsx | 23 ---------------- .../utils/testUtils/test/testUtils.test.js | 20 +++----------- .../packages/utils/testUtils/testUtils.tsx | 10 +------ .../packages/utils/testUtils/types/index.ts | 5 ---- templates/common/src/package.json | 3 +-- .../src/stores/global/smart-context.d.ts | 1 - .../common/src/stores/globalContext/index.tsx | 27 ------------------- 10 files changed, 7 insertions(+), 97 deletions(-) delete mode 100644 templates/common/packages/utils/testUtils/test/SmartContextDemo.tsx delete mode 100644 templates/common/packages/utils/testUtils/test/SmartContextProviderDemo.tsx delete mode 100644 templates/common/src/stores/global/smart-context.d.ts delete mode 100644 templates/common/src/stores/globalContext/index.tsx diff --git a/templates/common/package.json b/templates/common/package.json index 0b1f6ef8..913698c0 100644 --- a/templates/common/package.json +++ b/templates/common/package.json @@ -16,7 +16,6 @@ "themes": "{workspacePrefix}", "services": "{workspacePrefix}", "ui": "{workspacePrefix}", - "smart-context": "^2.1.2", "@nextui-org/react": "^1.0.0-beta.6" }, "devDependencies": { diff --git a/templates/common/packages/utils/package.json b/templates/common/packages/utils/package.json index 58be9bc5..53554a39 100644 --- a/templates/common/packages/utils/package.json +++ b/templates/common/packages/utils/package.json @@ -12,7 +12,6 @@ ], "dependencies": { "fetch-mock": "9.11.0", - "smart-context": "^2.1.0", "ua-parser-js": "^0.7.28" }, "devDependencies": { @@ -22,4 +21,4 @@ "jest": "27.2.3", "jest-mock-console": "1.1.0" } -} +} \ No newline at end of file diff --git a/templates/common/packages/utils/testUtils/test/SmartContextDemo.tsx b/templates/common/packages/utils/testUtils/test/SmartContextDemo.tsx deleted file mode 100644 index 273ae99a..00000000 --- a/templates/common/packages/utils/testUtils/test/SmartContextDemo.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { useContext } from 'react'; -import { getContext } from 'smart-context'; - -const SmartContextDemo = () => { - const { - state: { name }, - actions: { setName } - } = useContext(getContext('nameContext')); - return

{name}

; -}; -export default SmartContextDemo; diff --git a/templates/common/packages/utils/testUtils/test/SmartContextProviderDemo.tsx b/templates/common/packages/utils/testUtils/test/SmartContextProviderDemo.tsx deleted file mode 100644 index dd1920b5..00000000 --- a/templates/common/packages/utils/testUtils/test/SmartContextProviderDemo.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { WithContextProvider } from 'smart-context'; -const initialState = { - name: 'Smart Context' -}; - -const actionsConfig = { - setName: ['name'] -}; - -const displayName = 'nameContext'; - -/* Configuration */ -const config = { - initialState, - actionsConfig, - displayName, - debug: true -}; - -const NameContextProvider: React.FunctionComponent = ({ children }) => { - return <>{children}; -}; -export default WithContextProvider(NameContextProvider, [config]); diff --git a/templates/common/packages/utils/testUtils/test/testUtils.test.js b/templates/common/packages/utils/testUtils/test/testUtils.test.js index 5aa9edc0..615c294b 100644 --- a/templates/common/packages/utils/testUtils/test/testUtils.test.js +++ b/templates/common/packages/utils/testUtils/test/testUtils.test.js @@ -1,15 +1,13 @@ -import { render, fireEvent } from '@testing-library/react'; -import { Context, ContextDemo } from './ContextDemo'; +import { render } from '@testing-library/react'; +import { Context } from './ContextDemo.tsx' import { assertByTestId, assertProperty, assertByTextContent, renderWithContext, - renderWithSmartContext, assertMockFunctionArg -} from '../testUtils'; -import SmartContextDemo from './SmartContextDemo'; -import SmartContextProvider from './SmartContextProviderDemo'; +} from '../testUtils.tsx'; + describe('assertByTestId', () => { const renderCom = render(

Hello

); @@ -42,16 +40,6 @@ describe('asserByTextContent', () => { }); }); -describe('renderWithSmartContext', () => { - test('assert context state', () => { - const props = {}; - const Comp = ; - const obj = { SmartContextProviderRef: SmartContextProvider, children: Comp }; - const renderedComp = renderWithSmartContext(obj); - assertByTextContent(renderedComp, 'Smart Context', true); - }); -}); - describe('renderWithContext', () => { test('assert context state', () => { const contextData = { diff --git a/templates/common/packages/utils/testUtils/testUtils.tsx b/templates/common/packages/utils/testUtils/testUtils.tsx index 9683a484..d7142d54 100644 --- a/templates/common/packages/utils/testUtils/testUtils.tsx +++ b/templates/common/packages/utils/testUtils/testUtils.tsx @@ -1,8 +1,7 @@ import { render, RenderResult } from '@testing-library/react'; import { AssertMockFunctionParams, - ContextRenderParams, - SmartContextRenderParams + ContextRenderParams } from './types'; export const assertByTestId = ( @@ -31,13 +30,6 @@ export const assertProperty = (obj: Object, key: string, val: any) => { return expect(obj).toHaveProperty(key, val); }; -export const renderWithSmartContext = ({ - SmartContextProviderRef, - children -}: SmartContextRenderParams) => { - return render({children}); -}; - export const renderWithContext = ({ Comp, ContextProviderRef, diff --git a/templates/common/packages/utils/testUtils/types/index.ts b/templates/common/packages/utils/testUtils/types/index.ts index 755e9714..d81c21cb 100644 --- a/templates/common/packages/utils/testUtils/types/index.ts +++ b/templates/common/packages/utils/testUtils/types/index.ts @@ -7,11 +7,6 @@ export declare type AssertMockFunctionParams = { argument: any; }; -export declare type SmartContextRenderParams = { - SmartContextProviderRef: React.FunctionComponent; - children: React.FunctionComponent; -}; - export declare type ContextRenderParams = { ContextProviderRef: React.FunctionComponent; Comp: React.FunctionComponent; diff --git a/templates/common/src/package.json b/templates/common/src/package.json index af7a4caf..e8a3f6a5 100644 --- a/templates/common/src/package.json +++ b/templates/common/src/package.json @@ -4,7 +4,6 @@ "private": true, "dependencies": { "fetch-mock": "9.11.0", - "smart-context": "^2.1.0", "ua-parser-js": "^0.7.28" }, "devDependencies": { @@ -14,4 +13,4 @@ "jest": "27.2.3", "jest-mock-console": "1.1.0" } -} +} \ No newline at end of file diff --git a/templates/common/src/stores/global/smart-context.d.ts b/templates/common/src/stores/global/smart-context.d.ts deleted file mode 100644 index 340d3053..00000000 --- a/templates/common/src/stores/global/smart-context.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module 'smart-context'; diff --git a/templates/common/src/stores/globalContext/index.tsx b/templates/common/src/stores/globalContext/index.tsx deleted file mode 100644 index 511a1948..00000000 --- a/templates/common/src/stores/globalContext/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -/* eslint-disable */ -import React from 'react'; -import { WithContextProvider } from 'smart-context'; - -const initialState = { - welcomeText: 'Universal React' -}; - -const actionsConfig = { - updateWelcomeText: ['welcomeText'] -}; - -export const displayName = 'globalContext'; - -/* Configuration */ -const config = { - initialState, - actionsConfig, - displayName, - debug: true -}; - -const GlobalContextProvider = ({ children }) => { - return <>{children}; -}; - -export default WithContextProvider(GlobalContextProvider, [config]); From 8bbf85199914bfb2b1af255c913ad81138595d45 Mon Sep 17 00:00:00 2001 From: Apoorva2696 Date: Tue, 11 Oct 2022 17:38:16 +0530 Subject: [PATCH 2/3] changes --- .../components/atoms/Button/Button.style.ts | 23 ------------------- .../src/components/atoms/Button/Button.tsx | 9 ++++---- 2 files changed, 4 insertions(+), 28 deletions(-) delete mode 100644 templates/common/src/components/atoms/Button/Button.style.ts diff --git a/templates/common/src/components/atoms/Button/Button.style.ts b/templates/common/src/components/atoms/Button/Button.style.ts deleted file mode 100644 index fad9b1e6..00000000 --- a/templates/common/src/components/atoms/Button/Button.style.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { styled } from '@nextui-org/react'; - -const CompRoot = styled('button', { - fontSize: '$3', - color: '$fontColor', - margin: '1em', - padding: '0.25em 1em', - border: '2px solid black', - borderRadius: '$1', - display: 'block', - variants: { - variation: { - primary: { - color: '$fontColor' - }, - secondary: { - background: 'green' - } - } - } -}); - -export default CompRoot; diff --git a/templates/common/src/components/atoms/Button/Button.tsx b/templates/common/src/components/atoms/Button/Button.tsx index e0d6840d..87eeb7ae 100644 --- a/templates/common/src/components/atoms/Button/Button.tsx +++ b/templates/common/src/components/atoms/Button/Button.tsx @@ -6,20 +6,19 @@ // @flow // Node_Module Imports -import React from "react"; +import React from 'react'; // Relative imports -import CompRoot from "./Button.style"; -import { ButtonProps } from "./types"; +import { ButtonProps } from './types'; const Button: React.FunctionComponent = ({ className, children, ...otherProps }) => ( - + ); Button.defaultProps = {}; From 0d44fab8fe6d36e92fb6ee0be3fa1525bf87102b Mon Sep 17 00:00:00 2001 From: Apoorva2696 Date: Thu, 20 Oct 2022 16:14:36 +0530 Subject: [PATCH 3/3] next-ui removed --- templates/base/src/pages/_app.tsx | 15 ++--- templates/common/package.json | 3 +- templates/common/packages/themes/package.json | 7 -- templates/common/packages/themes/theme.ts | 65 ------------------- .../components/atoms/Button/types/index.ts | 1 - templates/common/storybook/package.json | 3 +- 6 files changed, 6 insertions(+), 88 deletions(-) delete mode 100644 templates/common/packages/themes/package.json delete mode 100644 templates/common/packages/themes/theme.ts diff --git a/templates/base/src/pages/_app.tsx b/templates/base/src/pages/_app.tsx index 3b399196..ac800c46 100644 --- a/templates/base/src/pages/_app.tsx +++ b/templates/base/src/pages/_app.tsx @@ -1,7 +1,6 @@ // node modules import React from 'react'; import type { AppProps } from 'next/app'; -import { NextUIProvider, globalCss } from '@nextui-org/react'; // packages import WithReactQuery from 'services'; @@ -15,20 +14,14 @@ import globalStyle from '../styles/cssIncludes'; // console.log(metric); // } -const globalStyles = globalCss(globalStyle); function MyApp({ Component, pageProps }: AppProps) { - globalStyles(); return ( - <> + {/*@ts-ignore*/} - - - {/*@ts-ignore*/} - - - - + + + ); } diff --git a/templates/common/package.json b/templates/common/package.json index 913698c0..a8b5d808 100644 --- a/templates/common/package.json +++ b/templates/common/package.json @@ -15,8 +15,7 @@ "react-dom": "{reactVersion}", "themes": "{workspacePrefix}", "services": "{workspacePrefix}", - "ui": "{workspacePrefix}", - "@nextui-org/react": "^1.0.0-beta.6" + "ui": "{workspacePrefix}" }, "devDependencies": { "@types/react": "^17.0.39", diff --git a/templates/common/packages/themes/package.json b/templates/common/packages/themes/package.json deleted file mode 100644 index 77d59cab..00000000 --- a/templates/common/packages/themes/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "themes", - "version": "0.1.0", - "private": true, - "main": "./theme.ts", - "license": "MIT" -} \ No newline at end of file diff --git a/templates/common/packages/themes/theme.ts b/templates/common/packages/themes/theme.ts deleted file mode 100644 index 2dba45bd..00000000 --- a/templates/common/packages/themes/theme.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { createTheme } from "@nextui-org/react"; - -export const theme = createTheme({ - type: 'light', - theme: { - colors: { - white: 'white', - black: '#1c1c1c', - red: '#ff414d', - gray: '#b5b5b5', - cyan: '#00e6c3', - yellow: '#ffe63b', - fontColor: '$black', - overlays: 'rgba(255,255,255,0.9)' - }, - lineHeights: { - solid: 1, - body: 1.5, - heading: 1.25 - }, - fonts: { - fontExtraBold: '"FuturaNextW05-ExtraBold","Helvetica","Arial",sans-serif', - fontBold: '"FuturaNextW05-Bold","Helvetica","Arial",sans-serif', - fontLight: '"FuturaNextW05-Light","Helvetica","Arial",sans-serif', - monospace: 'monospace', - minionPro: '"minion-pro",serif', - fontAwesome: "'Font Awesome 5 Free'" - }, - radii: { - 1: '3px', - 2: '12px', - 3: '16px' - }, - space: { - 1: '1px', - 2: '2px', - 3: '5px', - 4: '20px', - 5: '50px', - 6: '70px', - 7: '80px', - 8: '100px', - 9: '180px', - 10: '200px' - }, - fontSizes: { - 1: '12px', - 2: '14px', - 3: '16px', - 4: '18px', - 5: '20px' - }, - fontWeights: { - 1: 100, - 2: 200, - 3: 300 - }, - transitions: { - 1: 'all 1s cubic-bezier(0.32, 0.01, 0, 1)', - 2: 'all 0.5s cubic-bezier(0.39, 0.575, 0.565, 1)', - 3: 'all 0.3s cubic-bezier(0.32, 0.01, 0, 1)', - 4: 'all .25s linear' - } - } -}); diff --git a/templates/common/src/components/atoms/Button/types/index.ts b/templates/common/src/components/atoms/Button/types/index.ts index 538730c4..5ba046e4 100644 --- a/templates/common/src/components/atoms/Button/types/index.ts +++ b/templates/common/src/components/atoms/Button/types/index.ts @@ -1,5 +1,4 @@ // @flow - import type { ReactNode } from 'react'; export type ButtonProps = { diff --git a/templates/common/storybook/package.json b/templates/common/storybook/package.json index a61e38a3..171afed1 100644 --- a/templates/common/storybook/package.json +++ b/templates/common/storybook/package.json @@ -10,7 +10,6 @@ "dependencies": { "@babel/core": "^7.15.5", "@babel/preset-react": "^7.12.10", - "@nextui-org/react": "^1.0.5-beta.5", "@storybook/addon-a11y": "^6.4.18", "@storybook/addon-actions": "^6.4.18", "@storybook/addon-docs": "^6.4.18", @@ -30,4 +29,4 @@ "devDependencies": { "tsconfig": "*" } -} +} \ No newline at end of file