0.1.7 • Published 12 months ago
@kitsuyui/react-timer v0.1.7
@kitsuyui/react-timer
Simple timer React component.
Demo
Storybook: https://react-playground.docs.kitsuyui.com/storybook/
Installation
npm
npm install @kitsuyui/react-timeryarn
yarn add @kitsuyui/react-timerpnpm
pnpm add @kitsuyui/react-timerUsage
import { TimerContainer, MinimalTimer } from '@kitsuyui/react-timer'
const Timer = () => {
return (
<TimerContainer>
<TimerContext.Consumer>
{(timer: TimerProps) => <MinimalTimer {...timer} />}
</TimerContext.Consumer>
</TimerContainer>
)
}TimerContainer is a component that provides TimerContext. Timers are pure components that do not depend on TimerContext. Accept TimerProps as props. So you can define your own Timer component by same interface.
export interface TimerValue {
remaining: number
running: boolean
}
export interface TimerActions {
start(): void
stop(): void
toggle(): void
reset(): void
incrementTimerValue(value: number): void
setTimerValue(value: number): void
}
export type TimerProps = TimerValue & TimerActionsLicense
MIT
0.1.7
12 months ago
0.1.6
1 year ago
0.1.5
1 year ago
0.1.4
2 years ago
0.1.3
2 years 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
3 years ago
0.0.10
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.5
3 years ago