1.0.11 • Published 6 months ago

clock-analog-digital-react v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Clock React Component (lightweight and customizable)

clock-analog-digital-react is a React component that provides two modes for displaying a clock: Analog and Digital. All inner components are customizable by the user, and you can easily configure your desired clock.

You can view a live demo and configure your clock here.

Installation

To install the package, run the following command:

npm i clock-analog-digital-react

Importing the Component

You can import the Clock component into your React project like this:

import Clock from 'clock-analog-digital-react';

Usage

Analog Clock

To display the analog clock, set the clockMode prop to 'analog'.

import Clock from 'clock-analog-digital-react';

const App = () => {
  return (
    <Clock clockMode="analog" />
  );
};

export default App;

Digital Clock

To display the digital clock, set the clockMode prop to 'digital'.

import Clock from 'clock-analog-digital-react';

const App = () => {
  return (
    <Clock clockMode="digital" />
  );
};

export default App;

Props

Below is a list of available props for both Analog and Digital clocks. The clockMode prop must be either 'analog' or 'digital'.

Prop NameTypeDescription
clockMode'analog' \| 'digital'Mode for the clock. Choose either 'analog' or 'digital'.

Analog Clock Props

Prop NameTypeDescription
colorConfigurationAnalogClockColorConfigurationDefines the color configuration for the analog clock.
clockBorderThicknessnumberDefines the thickness of the analog clock's border.
clockNumbersTypestringDefines the numbering system for the analog clock (e.g., 'ENGLISH', 'ROMAN').
clockLogoSrcAndOffset{ cmp: React.ReactNode; offset: number }Defines a logo component and its offset position on the analog clock.
hasPrimaryTicksbooleanWhether the analog clock shows primary ticks (default: false).
hasMajorTicksbooleanWhether the analog clock shows major ticks (default: false).
hasMinorTicksbooleanWhether the analog clock shows minor ticks (default: false).
hasPrimaryNumbersbooleanWhether the analog clock shows primary numbers (default: false).
hasMajorNumbersbooleanWhether the analog clock shows major numbers (default: false).
majorNumbersFontSizenumberDefines the font size for major numbers on the analog clock.
primaryNumbersFontSizenumberDefines the font size for primary numbers on the analog clock.
UserPrimaryTicksComponentReact.ReactNodeCustom component for primary ticks.
UserMajorTicksComponentReact.ReactNodeCustom component for major ticks.
UserMinorTicksComponentReact.ReactNodeCustom component for minor ticks.
PrimaryNumbersComponentReact.ReactNodeCustom component for primary numbers.
MajorNumbersComponentReact.ReactNodeCustom component for major numbers.
ClockCenterComponentReact.ReactNodeCustom component for the clock center.

Digital Clock Props

Prop NameTypeDescription
colorConfigurationDigitalClockColorConfigurationDefines the color configuration for the digital clock.
twentyFourHoursbooleanWhether the digital clock shows in 24-hour format (default: false).
paddingnumberDefines the padding around the digital clock.

Color Configuration

The colorConfiguration prop changes depending on whether the clock is set to Analog or Digital mode.

AnalogClockColorConfiguration

This configuration controls various aspects of the analog clock's appearance, including the colors of the hands, numbers, ticks, and the clock background. Here's a detailed list of the available fields:

Prop NameTypeDescription
clockBackgroundColorstringDefines the background color of the analog clock.
clockBorderColorstringDefines the color of the analog clock's border.
hourHandColorstringDefines the color of the hour hand.
minuteHandColorstringDefines the color of the minute hand.
secondHandColorstringDefines the color of the second hand.
majorNumbersColorstringDefines the color of the major numbers on the clock.
primaryNumbersColorstringDefines the color of the primary numbers on the clock.
primaryTicksColorstringDefines the color of the primary ticks on the clock.
majorTicksColorstringDefines the color of the major ticks on the clock.
minorTicksColorstringDefines the color of the minor ticks on the clock.
centerCircleColorstringDefines the color of the center circle of the analog clock.
alarmRingColorstringDefines the color of the alarm ring (if any).

DigitalClockColorConfiguration

This configuration controls the colors specific to the digital clock's segments and display. Here's a breakdown:

Prop NameTypeDescription
backgroundColorstringDefines the background color of the digital clock.
activeSegmentColorstringDefines the color of the active segments in the digital display.
inactiveSegmentColorstringDefines the color of the inactive segments in the digital display.
dotsColorstringDefines the color of the dots (used for separating hours, minutes, etc.).
alarmRingColorstringDefines the color of the alarm ring for the digital clock.

Support:

For support contact: masoud8bigdeli@gmail.com

1.0.9

6 months ago

1.0.8

6 months ago

1.0.7

6 months ago

1.0.6

6 months ago

1.0.11

6 months ago

1.0.10

6 months ago

1.0.5

6 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago