-
Notifications
You must be signed in to change notification settings - Fork 0
Clock
The Clock component brings the time to your ReactJS app using SVG.
It's supported by all newer browsers.
By default, this component looks like this:
It can be achieved with the following code:
import React from 'react'
import { render } from 'react-dom'
import { Clock } from 'rsg-components'
render(<Clock />, document.getElementById("root"));
The clock component is firstly available in version
3.0.0-beta.1
whereRSG
is removed from the components and you have to import justClock
instead ofRSGClock
Prop | Type | Default value | Description |
---|---|---|---|
standard props | not specified | all standard React props for a *div or span: http://goo.gl/SSrsHn | |
size | number (positive number bigger than 20) | 200 | Change the SVG sizes and proportions |
seconds | boolean | false | If the size prop IS SMALLER than 95 use this to specify whether to show seconds. |
*The main SVG is placed in a div but if you set too small size, the clock won't be displayed as SVG, that's why standard props are for div OR span.
If the prop's value is between 20 and 95 the clock is show as text with font size: size / 2.5
;
If the value of size
is bigger than 95 it's shown as SVG. View how the sizes are calculated;
Code | Screenshot | Notes |
---|---|---|
<Clock /> |
The default component Clock | |
<Clock size={50} /> |
||
<Clock size={75} seconds={true} /> |
seconds enabled |
|
<Clock size={100} /> |
Resizable clock to fit anywhere |
If you want to use rsg-components
(and any other thing related to React, for that matter) at it's best, I recommend you read more React docs:
And understand it's architecture and history better.
- https://en.wikipedia.org/wiki/React_(JavaScript_library)
- https://github.com/acdlite/react-fiber-architecture (For understanding React Fiber's (aka React 16+) internals)
npm install rsg-components --save
or
yarn add rsg-components