diff --git a/README.md b/README.md
index 55b1f54..82950b1 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,56 @@ OR using Yarn
yarn add @cubetiq/react-chart-js
```
+### Line Chart Example
+```typescript
+import React from 'react';
+import { ReactChartJs } from '@cubetiq/react-chart-js';
+
+function LineChartExample(props) {
+ return (
+
+ );
+}
+
+export default LineChartExample;
+```
+
### Contributors
Project's repository: [React Countdown](https://git.cubetiqs.com/CUBETIQ/react-chart-js.git)
- [@s.long](https://git.cubetiqs.com/s.long)
diff --git a/examples/line-chart-example/.env b/examples/line-chart-example/.env
new file mode 100644
index 0000000..7d910f1
--- /dev/null
+++ b/examples/line-chart-example/.env
@@ -0,0 +1 @@
+SKIP_PREFLIGHT_CHECK=true
\ No newline at end of file
diff --git a/examples/line-chart-example/README.md b/examples/line-chart-example/README.md
index 389c7b6..29aade2 100644
--- a/examples/line-chart-example/README.md
+++ b/examples/line-chart-example/README.md
@@ -1,4 +1,4 @@
-### Line Chart Example
+# Line Chart Example
```typescript
import React from 'react';
diff --git a/examples/line-chart-example/package.json b/examples/line-chart-example/package.json
index a0f30da..f6b3000 100644
--- a/examples/line-chart-example/package.json
+++ b/examples/line-chart-example/package.json
@@ -3,12 +3,18 @@
"version": "0.1.0",
"private": true,
"dependencies": {
+ "@cubetiq/react-chart-js": "^1.0.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
+ "@types/jest": "^24.0.0",
+ "@types/node": "^12.0.0",
+ "@types/react": "^16.9.0",
+ "@types/react-dom": "^16.9.0",
"react": "^16.14.0",
"react-dom": "^16.14.0",
- "react-scripts": "3.4.3"
+ "react-scripts": "3.4.3",
+ "typescript": "~3.7.2"
},
"scripts": {
"start": "react-scripts start",
diff --git a/examples/line-chart-example/public/index.html b/examples/line-chart-example/public/index.html
index aa069f2..878bcfb 100644
--- a/examples/line-chart-example/public/index.html
+++ b/examples/line-chart-example/public/index.html
@@ -24,7 +24,7 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
-
React App
+ Line Chart Example
diff --git a/examples/line-chart-example/src/App.css b/examples/line-chart-example/src/App.css
index 74b5e05..39ae441 100644
--- a/examples/line-chart-example/src/App.css
+++ b/examples/line-chart-example/src/App.css
@@ -1,38 +1,3 @@
-.App {
- text-align: center;
-}
-
-.App-logo {
- height: 40vmin;
- pointer-events: none;
-}
-
-@media (prefers-reduced-motion: no-preference) {
- .App-logo {
- animation: App-logo-spin infinite 20s linear;
- }
-}
-
-.App-header {
- background-color: #282c34;
- min-height: 100vh;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- font-size: calc(10px + 2vmin);
- color: white;
-}
-
-.App-link {
- color: #61dafb;
-}
-
-@keyframes App-logo-spin {
- from {
- transform: rotate(0deg);
- }
- to {
- transform: rotate(360deg);
- }
+.app {
+ margin: 0px 20px;
}
diff --git a/examples/line-chart-example/src/App.js b/examples/line-chart-example/src/App.js
deleted file mode 100644
index ce9cbd2..0000000
--- a/examples/line-chart-example/src/App.js
+++ /dev/null
@@ -1,26 +0,0 @@
-import React from 'react';
-import logo from './logo.svg';
-import './App.css';
-
-function App() {
- return (
-
- );
-}
-
-export default App;
diff --git a/examples/line-chart-example/src/App.test.js b/examples/line-chart-example/src/App.test.js
deleted file mode 100644
index 4db7ebc..0000000
--- a/examples/line-chart-example/src/App.test.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import React from 'react';
-import { render } from '@testing-library/react';
-import App from './App';
-
-test('renders learn react link', () => {
- const { getByText } = render();
- const linkElement = getByText(/learn react/i);
- expect(linkElement).toBeInTheDocument();
-});
diff --git a/examples/line-chart-example/src/App.tsx b/examples/line-chart-example/src/App.tsx
new file mode 100644
index 0000000..85719c6
--- /dev/null
+++ b/examples/line-chart-example/src/App.tsx
@@ -0,0 +1,13 @@
+import React from 'react';
+import './App.css';
+import LineChartExample from './LineChartExample';
+
+function App() {
+ return (
+
+
+
+ );
+}
+
+export default App;
diff --git a/examples/line-chart-example/src/LineChartExample.tsx b/examples/line-chart-example/src/LineChartExample.tsx
index 6b02104..fc41e60 100644
--- a/examples/line-chart-example/src/LineChartExample.tsx
+++ b/examples/line-chart-example/src/LineChartExample.tsx
@@ -1,7 +1,7 @@
import React from 'react';
import { ReactChartJs } from '@cubetiq/react-chart-js';
-function LineChartExample(props) {
+function LineChartExample(props: any) {
return (
-
-
-
-
-
-
diff --git a/examples/line-chart-example/src/react-app-env.d.ts b/examples/line-chart-example/src/react-app-env.d.ts
new file mode 100644
index 0000000..6431bc5
--- /dev/null
+++ b/examples/line-chart-example/src/react-app-env.d.ts
@@ -0,0 +1 @@
+///
diff --git a/examples/line-chart-example/src/serviceWorker.js b/examples/line-chart-example/src/serviceWorker.ts
similarity index 91%
rename from examples/line-chart-example/src/serviceWorker.js
rename to examples/line-chart-example/src/serviceWorker.ts
index b04b771..b09523f 100644
--- a/examples/line-chart-example/src/serviceWorker.js
+++ b/examples/line-chart-example/src/serviceWorker.ts
@@ -20,10 +20,18 @@ const isLocalhost = Boolean(
)
);
-export function register(config) {
+type Config = {
+ onSuccess?: (registration: ServiceWorkerRegistration) => void;
+ onUpdate?: (registration: ServiceWorkerRegistration) => void;
+};
+
+export function register(config?: Config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
- const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
+ const publicUrl = new URL(
+ process.env.PUBLIC_URL,
+ window.location.href
+ );
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
@@ -54,7 +62,7 @@ export function register(config) {
}
}
-function registerValidSW(swUrl, config) {
+function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
@@ -98,10 +106,10 @@ function registerValidSW(swUrl, config) {
});
}
-function checkValidServiceWorker(swUrl, config) {
+function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl, {
- headers: { 'Service-Worker': 'script' },
+ headers: { 'Service-Worker': 'script' }
})
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
diff --git a/examples/line-chart-example/src/setupTests.js b/examples/line-chart-example/src/setupTests.ts
similarity index 100%
rename from examples/line-chart-example/src/setupTests.js
rename to examples/line-chart-example/src/setupTests.ts
diff --git a/examples/line-chart-example/tsconfig.json b/examples/line-chart-example/tsconfig.json
new file mode 100644
index 0000000..f2850b7
--- /dev/null
+++ b/examples/line-chart-example/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "es5",
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "strict": true,
+ "forceConsistentCasingInFileNames": true,
+ "module": "esnext",
+ "moduleResolution": "node",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "noEmit": true,
+ "jsx": "react"
+ },
+ "include": [
+ "src"
+ ]
+}