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

Feature/attempt to transpile #1

Open
wants to merge 2 commits into
base: master
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
4 changes: 4 additions & 0 deletions __mocks__/svg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// eslint-disable-next-line import/no-anonymous-default-export
const svgrURL = 'SvgrURL';
const ReactComponent = 'div';
module.exports = { svgrURL, ReactComponent };
1 change: 1 addition & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { presets: ["@babel/preset-env", '@babel/preset-react'] };
20 changes: 20 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type {
Config
} from 'jest';

const config: Config = {
verbose: true,
moduleNameMapper: {
'\\.svg': '<rootDir>/__mocks__/svg.js',
'\\.(css|sass)$': '<rootDir>/__mocks__/svg.js'
},
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
'^.+\\.(js|jsx)$': 'babel-jest'
},
transformIgnorePatterns: [
'/node_modules/(?!(@mui/x-charts)/)'
]
};

export default config;
21 changes: 17 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,35 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/material": "^5.15.2",
"@mui/styles": "^5.15.2",
"@mui/x-charts": "^6.18.4",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^13.0.0",
"@testing-library/user-event": "^13.2.1",
"@types/jest": "^27.0.1",
"@types/jest": "^29.5.11",
"@types/node": "^16.7.13",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"jest": "^29.5.11",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"ts-node": "^10.9.2",
"typescript": "^4.4.2",
"web-vitals": "^2.1.0"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@babel/preset-react": "^7.23.3",
"ts-jest": "^29.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test": "jest",
"eject": "react-scripts eject"
},
"eslintConfig": {
Expand All @@ -39,5 +51,6 @@
"last 1 firefox version",
"last 1 safari version"
]
}
}
},
"license": "UNLICENSED"
}
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import logo from './logo.svg';
import './App.css';
import TinyBarChart from './TinyBarChart';

function App() {
return (
Expand All @@ -18,6 +19,7 @@ function App() {
>
Learn React
</a>
<TinyBarChart />
</header>
</div>
);
Expand Down
25 changes: 25 additions & 0 deletions src/TinyBarChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ChartContainer, BarPlot } from '@mui/x-charts';

const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490];
const xLabels = [
'Page A',
'Page B',
'Page C',
'Page D',
'Page E',
'Page F',
'Page G',
];

export default function TinyBarChart() {
return (
<ChartContainer
width={500}
height={300}
series={[{ data: uData, label: 'uv', type: 'bar' }]}
xAxis={[{ scaleType: 'band', data: xLabels }]}
>
<BarPlot />
</ChartContainer>
);
}
Loading