Skip to content

Commit

Permalink
🔙 reset (#16)
Browse files Browse the repository at this point in the history
* done.

* fix bug with resume. add status states.

* switch from parcel to vite.

* remove comments.

* remove parcel from gitignore.

* update documentation.

* set state after handling timer.
  • Loading branch information
bradgarropy authored Nov 23, 2021
1 parent 685cb41 commit d903f50
Show file tree
Hide file tree
Showing 14 changed files with 10,717 additions and 9,674 deletions.
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"jsxSingleQuote": false,
"trailingComma": "all",
"bracketSpacing": false,
"jsxBracketSameLine": false,
"bracketSameLine": false,
"arrowParens": "avoid",
"endOfLine": "lf"
}
2 changes: 1 addition & 1 deletion example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

<body>
<div id="root"></div>
<script src="./index.tsx"></script>
<script src="./index.tsx" type="module"></script>
</body>
</html>
7 changes: 6 additions & 1 deletion example/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react"
import * as ReactDOM from "react-dom"

import useCountdown from "../."
import useCountdown from "../src"

const App = () => {
const countdown = useCountdown({
Expand All @@ -21,12 +21,17 @@ const App = () => {
countdown.resume()
}

const onReset = () => {
countdown.reset()
}

return (
<>
<h1>⏳ useCountdown hook</h1>
<h2>{countdown.formatted}</h2>
<button onClick={onPause}>Pause</button>
<button onClick={onResume}>Resume</button>
<button onClick={onReset}>Reset</button>
</>
)
}
Expand Down
8,037 changes: 1,564 additions & 6,473 deletions example/package-lock.json

Large diffs are not rendered by default.

20 changes: 6 additions & 14 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,13 @@
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html"
},
"dependencies": {
"react-app-polyfill": "^1.0.0"
},
"alias": {
"react": "../node_modules/react",
"react-dom": "../node_modules/react-dom/profiling",
"scheduler/tracing": "../node_modules/scheduler/tracing-profiling"
"start": "vite"
},
"devDependencies": {
"@types/react": "^16.9.11",
"@types/react-dom": "^16.8.4",
"parcel": "^1.12.3",
"typescript": "^3.4.5"
"@types/react": "^17.0.36",
"@types/react-dom": "^17.0.11",
"@vitejs/plugin-react": "^1.1.0",
"typescript": "^4.5.2",
"vite": "^2.6.14"
}
}
18 changes: 0 additions & 18 deletions example/tsconfig.json

This file was deleted.

6 changes: 6 additions & 0 deletions example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import react from "@vitejs/plugin-react"
import {defineConfig} from "vite"

export default defineConfig({
plugins: [react()],
})
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const config = {
clearMocks: true,
collectCoverage: true,
collectCoverageFrom: ["<rootDir>/src/**"],
testEnvironment: "jsdom",
transform: {
"^.+\\.(ts|tsx)$": "ts-jest",
},
Expand Down
Loading

0 comments on commit d903f50

Please sign in to comment.