Skip to content

Feature/minimal templates for arch types #224

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
15 changes: 4 additions & 11 deletions templates/base/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -15,20 +14,14 @@ import globalStyle from '../styles/cssIncludes';
// console.log(metric);
// }

const globalStyles = globalCss(globalStyle);

function MyApp({ Component, pageProps }: AppProps) {
globalStyles();
return (
<>
<GlobalContextProvider>
{/*@ts-ignore*/}
<NextUIProvider theme={theme}>
<GlobalContextProvider>
{/*@ts-ignore*/}
<Component {...pageProps} />
</GlobalContextProvider>
</NextUIProvider>
</>
<Component {...pageProps} />
</GlobalContextProvider>

);
}

Expand Down
4 changes: 1 addition & 3 deletions templates/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
"react-dom": "{reactVersion}",
"themes": "{workspacePrefix}",
"services": "{workspacePrefix}",
"ui": "{workspacePrefix}",
"smart-context": "^2.1.2",
"@nextui-org/react": "^1.0.0-beta.6"
"ui": "{workspacePrefix}"
},
"devDependencies": {
"@types/react": "^17.0.39",
Expand Down
7 changes: 0 additions & 7 deletions templates/common/packages/themes/package.json

This file was deleted.

65 changes: 0 additions & 65 deletions templates/common/packages/themes/theme.ts

This file was deleted.

3 changes: 1 addition & 2 deletions templates/common/packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
],
"dependencies": {
"fetch-mock": "9.11.0",
"smart-context": "^2.1.0",
"ua-parser-js": "^0.7.28"
},
"devDependencies": {
Expand All @@ -22,4 +21,4 @@
"jest": "27.2.3",
"jest-mock-console": "1.1.0"
}
}
}

This file was deleted.

This file was deleted.

20 changes: 4 additions & 16 deletions templates/common/packages/utils/testUtils/test/testUtils.test.js
Original file line number Diff line number Diff line change
@@ -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(<h1 data-testid="hello">Hello</h1>);
Expand Down Expand Up @@ -42,16 +40,6 @@ describe('asserByTextContent', () => {
});
});

describe('renderWithSmartContext', () => {
test('assert context state', () => {
const props = {};
const Comp = <SmartContextDemo {...props} />;
const obj = { SmartContextProviderRef: SmartContextProvider, children: Comp };
const renderedComp = renderWithSmartContext(obj);
assertByTextContent(renderedComp, 'Smart Context', true);
});
});

describe('renderWithContext', () => {
test('assert context state', () => {
const contextData = {
Expand Down
10 changes: 1 addition & 9 deletions templates/common/packages/utils/testUtils/testUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { render, RenderResult } from '@testing-library/react';
import {
AssertMockFunctionParams,
ContextRenderParams,
SmartContextRenderParams
ContextRenderParams
} from './types';

export const assertByTestId = (
Expand Down Expand Up @@ -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(<SmartContextProviderRef>{children}</SmartContextProviderRef>);
};

export const renderWithContext = ({
Comp,
ContextProviderRef,
Expand Down
5 changes: 0 additions & 5 deletions templates/common/packages/utils/testUtils/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ export declare type AssertMockFunctionParams = {
argument: any;
};

export declare type SmartContextRenderParams = {
SmartContextProviderRef: React.FunctionComponent<any>;
children: React.FunctionComponent<any>;
};

export declare type ContextRenderParams = {
ContextProviderRef: React.FunctionComponent<any>;
Comp: React.FunctionComponent<any>;
Expand Down
23 changes: 0 additions & 23 deletions templates/common/src/components/atoms/Button/Button.style.ts

This file was deleted.

9 changes: 4 additions & 5 deletions templates/common/src/components/atoms/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ButtonProps> = ({
className,
children,
...otherProps
}) => (
<CompRoot className={className} data-testid="CompRoot" {...otherProps}>
<Button className={className} data-testid="CompRoot" {...otherProps}>
{children}
</CompRoot>
</Button>
);

Button.defaultProps = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// @flow

import type { ReactNode } from 'react';

export type ButtonProps = {
Expand Down
3 changes: 1 addition & 2 deletions templates/common/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"dependencies": {
"fetch-mock": "9.11.0",
"smart-context": "^2.1.0",
"ua-parser-js": "^0.7.28"
},
"devDependencies": {
Expand All @@ -14,4 +13,4 @@
"jest": "27.2.3",
"jest-mock-console": "1.1.0"
}
}
}
1 change: 0 additions & 1 deletion templates/common/src/stores/global/smart-context.d.ts

This file was deleted.

27 changes: 0 additions & 27 deletions templates/common/src/stores/globalContext/index.tsx

This file was deleted.

3 changes: 1 addition & 2 deletions templates/common/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -30,4 +29,4 @@
"devDependencies": {
"tsconfig": "*"
}
}
}