0.1.7 • Published 11 months ago
@kitsuyui/react-stopwatch v0.1.7
@kitsuyui/react-stopwatch
Simple stopwatch React component.
Demo
Storybook: https://react-playground.docs.kitsuyui.com/storybook/
Installation
npm
npm install @kitsuyui/react-stopwatchyarn
yarn add @kitsuyui/react-stopwatchpnpm
pnpm add @kitsuyui/react-stopwatchUsage
import { StopWatchContainer, MinimalStopwatch } from '@kitsuyui/react-stopwatch'
const Stopwatch = () => {
return (
<StopwatchContainer>
<StopwatchContext.Consumer>
{(props: StopwatchProps) => <MinimalStopwatch {...props} />}
</StopwatchContext.Consumer>
</StopwatchContainer>
)
}StopwatchContainer is a component that provides StopwatchContext. Stopwatchs are pure components that do not depend on StopwatchContext. Accept StopwatchProps as props. So you can define your own Stopwatch component by same interface.
export interface StopwatchValue {
elapsedTime: number
running: boolean
}
export interface StopwatchActions {
start(): void
stop(): void
toggle(): void
reset(): void
}
export type StopwatchProps = StopwatchValue & StopwatchActionsLicense
MIT
0.1.7
11 months ago
0.1.6
1 year ago
0.1.5
1 year ago
0.1.4
1 year ago
0.1.3
1 year ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago
0.0.33
2 years ago
0.0.20
2 years ago
0.0.21
2 years ago
0.0.22
2 years ago
0.0.23
2 years ago
0.0.24
2 years ago
0.0.25
2 years ago
0.0.16
2 years ago
0.0.18
2 years ago
0.0.19
2 years ago
0.0.30
2 years ago
0.0.31
2 years ago
0.0.32
2 years ago
0.0.0
2 years ago
0.0.26
2 years ago
0.0.27
2 years ago
0.0.28
2 years ago
0.0.29
2 years ago
0.0.11
2 years ago
0.0.10
2 years ago
0.0.9
2 years ago
0.0.8
2 years ago
0.0.7
2 years ago
0.0.6
2 years ago