Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/wojtekmaj/react-clock. An analog clock for your React app. projects.wojtekmaj.pl/react-clock
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import React from 'react';import PropTypes from 'prop-types';
import { isHandLength, isHandWidth } from './shared/propTypes';
import type { HandLength, HandWidth, OppositeHandLength } from './shared/types';
type HandProps = { angle?: number; length?: HandLength; name: string; oppositeLength?: OppositeHandLength; width?: HandWidth;};
export default function Hand({ angle = 0, name, length = 100, oppositeLength = 10, width = 1,}: HandProps) { return ( <div className={`react-clock__hand react-clock__${name}-hand`} style={{ transform: `rotate(${angle}deg)`, }} > <div className={`react-clock__hand__body react-clock__${name}-hand__body`} style={{ width: `${width}px`, top: `${50 - length / 2}%`, bottom: `${50 - oppositeLength / 2}%`, }} /> </div> );}
Hand.propTypes = { angle: PropTypes.number, length: isHandLength, name: PropTypes.string.isRequired, oppositeLength: isHandLength, width: isHandWidth,};