Skip to content

Commit

Permalink
Merge pull request #102 from Orfium/fix/table-performance
Browse files Browse the repository at this point in the history
Fix/table performance
  • Loading branch information
panvourtsis committed Nov 2, 2020
2 parents 8cb7bc5 + 7c61de6 commit d31c9b4
Show file tree
Hide file tree
Showing 26 changed files with 6,880 additions and 683 deletions.
4 changes: 0 additions & 4 deletions __mocks__/fileMock.ts

This file was deleted.

10 changes: 10 additions & 0 deletions __mocks__/fileMock.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';

// eslint-disable-next-line react/display-name
const SvgrMock = React.forwardRef((props, ref) => {
// @ts-ignore
return <span ref={ref} {...props} />;
});

export const ReactComponent = SvgrMock;
export default SvgrMock;
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
testRegex: '(/test/.*|\\.(test|spec))\\.(ts|tsx|js)$',
testRegex: '(\\.(test|spec))\\.(ts|tsx|js)$',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
'^.+\\.mdx?$': '@storybook/addon-docs/jest-transform-mdx',
Expand All @@ -10,6 +10,6 @@ module.exports = {
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'mdx'],
moduleDirectories: ['<rootDir>/src', 'node_modules'],
moduleNameMapper: {
'\\.svg$': '<rootDir>/__mocks__/fileMock.ts',
'\\.svg$': '<rootDir>/__mocks__/fileMock.tsx',
},
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
"@types/react-router-dom": "^5.1.5",
"@types/react-select": "^3.0.10",
"@types/react-test-renderer": "^16.9.3",
"@typescript-eslint/eslint-plugin": "^4.1.0",
"@typescript-eslint/parser": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"babel-loader": "^8.0.6",
"babel-plugin-inline-import-data-uri": "^1.0.1",
"babel-plugin-inline-react-svg": "^1.1.1",
Expand Down Expand Up @@ -71,7 +71,7 @@
"styled-components": "^5.2.0",
"ts-jest": "^25.1.0",
"ts-loader": "^6.2.1",
"typescript": "3.7.5",
"typescript": "3.9.7",
"url-loader": "^4.1.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exports[`Storyshots Design System/Breadcrumb Advanced Breadcrumbs with options p
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand All @@ -88,7 +88,7 @@ exports[`Storyshots Design System/Breadcrumb Advanced Breadcrumbs with options p
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-ist487-Icon"
/>
</span>
Expand All @@ -99,7 +99,7 @@ exports[`Storyshots Design System/Breadcrumb Advanced Breadcrumbs with options p
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand All @@ -123,7 +123,7 @@ exports[`Storyshots Design System/Breadcrumb Advanced Breadcrumbs with options p
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand Down Expand Up @@ -155,7 +155,7 @@ exports[`Storyshots Design System/Breadcrumb Advanced Breadcrumbs with options p
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1b2voc8-Icon"
/>
</span>
Expand Down Expand Up @@ -245,7 +245,7 @@ exports[`Storyshots Design System/Breadcrumb Breadcrumb showcase 1`] = `
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand All @@ -270,7 +270,7 @@ exports[`Storyshots Design System/Breadcrumb Breadcrumb showcase 1`] = `
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-ist487-Icon"
/>
</span>
Expand All @@ -281,7 +281,7 @@ exports[`Storyshots Design System/Breadcrumb Breadcrumb showcase 1`] = `
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand All @@ -305,7 +305,7 @@ exports[`Storyshots Design System/Breadcrumb Breadcrumb showcase 1`] = `
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand Down Expand Up @@ -337,7 +337,7 @@ exports[`Storyshots Design System/Breadcrumb Breadcrumb showcase 1`] = `
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1b2voc8-Icon"
/>
</span>
Expand Down Expand Up @@ -417,7 +417,7 @@ exports[`Storyshots Design System/Breadcrumb Simple Breadcrumbs 1`] = `
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand All @@ -437,7 +437,7 @@ exports[`Storyshots Design System/Breadcrumb Simple Breadcrumbs 1`] = `
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand Down Expand Up @@ -522,7 +522,7 @@ exports[`Storyshots Design System/Breadcrumb Simple Breadcrumbs with options 1`]
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand All @@ -547,7 +547,7 @@ exports[`Storyshots Design System/Breadcrumb Simple Breadcrumbs with options 1`]
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-ist487-Icon"
/>
</span>
Expand All @@ -558,7 +558,7 @@ exports[`Storyshots Design System/Breadcrumb Simple Breadcrumbs with options 1`]
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand All @@ -582,7 +582,7 @@ exports[`Storyshots Design System/Breadcrumb Simple Breadcrumbs with options 1`]
<span
className="css-1gnbc76-Icon"
>
<SvgrURL
<span
className="css-1r0bq2o-Icon"
/>
</span>
Expand Down
7 changes: 6 additions & 1 deletion src/components/CheckBox/CheckBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import { jsx } from '@emotion/core';
import * as React from 'react';
import { ChangeEvent } from 'react';
import { generateUniqueID } from '../../utils/helpers';
import { generateTestDataId, generateUniqueID } from '../../utils/helpers';
import { checkboxStyle, checkboxWrapperStyle, labelStyle, wrapperStyle } from './CheckBox.style';
import { TestId } from '../../utils/types';

export type Props = {
/** The label of the checkbox. */
Expand All @@ -16,6 +17,8 @@ export type Props = {
disabled?: boolean;
/** Boolean defining if the checkbox is in intermediate state when checked ( - instead of ✓ ). Defaults to false */
intermediate?: boolean;
/** The data test id if needed */
dataTestId?: TestId;
};

const CheckBox: React.FC<Props> = ({
Expand All @@ -24,6 +27,7 @@ const CheckBox: React.FC<Props> = ({
onClick,
disabled = false,
intermediate = false,
dataTestId,
}) => {
const [isChecked, setIsChecked] = React.useState(checked);
const id = generateUniqueID();
Expand All @@ -44,6 +48,7 @@ const CheckBox: React.FC<Props> = ({
<span css={wrapperStyle({ disabled })}>
<span css={checkboxWrapperStyle()}>
<input
data-testid={generateTestDataId('checkbox', dataTestId)}
css={checkboxStyle({ intermediate, checked })}
id={`styled-checkbox-${id}`}
type="checkbox"
Expand Down
11 changes: 11 additions & 0 deletions src/components/CheckBox/__snapshots__/CheckBox.stories.storyshot
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ exports[`Storyshots Design System/CheckBox CheckBox with Label 1`] = `
<input
checked={false}
className="css-tpx4o9-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -83,6 +84,7 @@ exports[`Storyshots Design System/CheckBox CheckBox with Label 1`] = `
<input
checked={true}
className="css-1fdnkzr-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -115,6 +117,7 @@ exports[`Storyshots Design System/CheckBox CheckBox with Label 1`] = `
<input
checked={true}
className="css-1fdnkzr-CheckBox"
data-testid="checkbox"
disabled={true}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -147,6 +150,7 @@ exports[`Storyshots Design System/CheckBox CheckBox with Label 1`] = `
<input
checked={true}
className="css-97n13b-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -179,6 +183,7 @@ exports[`Storyshots Design System/CheckBox CheckBox with Label 1`] = `
<input
checked={false}
className="css-z4uvgo-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -211,6 +216,7 @@ exports[`Storyshots Design System/CheckBox CheckBox with Label 1`] = `
<input
checked={true}
className="css-97n13b-CheckBox"
data-testid="checkbox"
disabled={true}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -282,6 +288,7 @@ exports[`Storyshots Design System/CheckBox CheckBox without 1`] = `
<input
checked={true}
className="css-1fdnkzr-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -309,6 +316,7 @@ exports[`Storyshots Design System/CheckBox CheckBox without 1`] = `
<input
checked={false}
className="css-tpx4o9-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -336,6 +344,7 @@ exports[`Storyshots Design System/CheckBox CheckBox without 1`] = `
<input
checked={true}
className="css-97n13b-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -363,6 +372,7 @@ exports[`Storyshots Design System/CheckBox CheckBox without 1`] = `
<input
checked={false}
className="css-z4uvgo-CheckBox"
data-testid="checkbox"
disabled={false}
id="styled-checkbox-"
onChange={[Function]}
Expand Down Expand Up @@ -390,6 +400,7 @@ exports[`Storyshots Design System/CheckBox CheckBox without 1`] = `
<input
checked={false}
className="css-z4uvgo-CheckBox"
data-testid="checkbox"
disabled={true}
id="styled-checkbox-"
onChange={[Function]}
Expand Down
Loading

0 comments on commit d31c9b4

Please sign in to comment.