@ixnode/simple-clock
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,6 +0,4 @@ | ||
'use strict'; | ||
import { jsx, jsxs, Fragment } from 'react/jsx-runtime'; | ||
import { useState, useRef, useEffect } from 'react'; | ||
var jsxRuntime = require('react/jsx-runtime'); | ||
var react = require('react'); | ||
/** | ||
@@ -36,7 +34,7 @@ * Calculates the shadow offset according to the given angle. | ||
const Clock = ({ color = 'default', size = 'medium', showBorder = false, use24HourFormat = true, showTenths = false, isAnalog = false, showDate = false, showTimeZone = false, timeZoneType = 'short', locale = 'en-US', timeZone = 'UTC', }) => { | ||
const [time, setTime] = react.useState(new Date()); | ||
const hourHandRef = react.useRef(null); | ||
const minuteHandRef = react.useRef(null); | ||
const secondHandRef = react.useRef(null); | ||
react.useEffect(() => { | ||
const [time, setTime] = useState(new Date()); | ||
const hourHandRef = useRef(null); | ||
const minuteHandRef = useRef(null); | ||
const secondHandRef = useRef(null); | ||
useEffect(() => { | ||
const timer = setInterval(() => { | ||
@@ -93,3 +91,3 @@ const newTime = new Date(); | ||
.replace("${offsetY}", offsetY.toString()); | ||
return jsxRuntime.jsx("div", Object.assign({ className: markClass, style: { transform } }, { children: jsxRuntime.jsx("div", { className: "mark-line", style: { boxShadow } }) }), index); | ||
return jsx("div", Object.assign({ className: markClass, style: { transform } }, { children: jsx("div", { className: "mark-line", style: { boxShadow } }) }), index); | ||
}); | ||
@@ -108,5 +106,5 @@ updateShadow(hourHandRef, hourAngle); | ||
}; | ||
return (jsxRuntime.jsx("div", Object.assign({ className: 'clock' + ' ' + color + ' ' + size + ' ' + (showBorder ? 'with-border' : 'no-border') }, { children: isAnalog ? (jsxRuntime.jsxs("div", Object.assign({ className: "analog-clock" }, { children: [jsxRuntime.jsxs("div", Object.assign({ className: "clock-face" }, { children: [marks, jsxRuntime.jsx("div", { className: "hand hour-hand", style: hourHandStyle, ref: hourHandRef }), jsxRuntime.jsx("div", { className: "hand minute-hand", style: minuteHandStyle, ref: minuteHandRef }), jsxRuntime.jsx("div", { className: "hand second-hand", style: secondHandStyle, ref: secondHandRef }), jsxRuntime.jsx("div", Object.assign({ className: "point" }, { children: jsxRuntime.jsx("div", { className: "point-marker" }) }))] })), showDate && jsxRuntime.jsx("div", Object.assign({ className: "display" }, { children: jsxRuntime.jsxs("div", Object.assign({ className: "date-text" }, { children: [formattedDate, showTimeZone && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("br", {}), formattedTimeZone] })] })) }))] }))) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [showDate && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [formattedDate, ", "] }), formattedTime, showTenths && jsxRuntime.jsxs("span", Object.assign({ className: 'tents' }, { children: [".", formattedTenths] })), showTimeZone && jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [" ", formattedTimeZone] })] })) }))); | ||
return (jsx("div", Object.assign({ className: 'clock' + ' ' + color + ' ' + size + ' ' + (showBorder ? 'with-border' : 'no-border') }, { children: isAnalog ? (jsxs("div", Object.assign({ className: "analog-clock" }, { children: [jsxs("div", Object.assign({ className: "clock-face" }, { children: [marks, jsx("div", { className: "hand hour-hand", style: hourHandStyle, ref: hourHandRef }), jsx("div", { className: "hand minute-hand", style: minuteHandStyle, ref: minuteHandRef }), jsx("div", { className: "hand second-hand", style: secondHandStyle, ref: secondHandRef }), jsx("div", Object.assign({ className: "point" }, { children: jsx("div", { className: "point-marker" }) }))] })), showDate && jsx("div", Object.assign({ className: "display" }, { children: jsxs("div", Object.assign({ className: "date-text" }, { children: [formattedDate, showTimeZone && jsxs(Fragment, { children: [jsx("br", {}), formattedTimeZone] })] })) }))] }))) : (jsxs(Fragment, { children: [showDate && jsxs(Fragment, { children: [formattedDate, ", "] }), formattedTime, showTenths && jsxs("span", Object.assign({ className: 'tents' }, { children: [".", formattedTenths] })), showTimeZone && jsxs(Fragment, { children: [" ", formattedTimeZone] })] })) }))); | ||
}; | ||
exports.Clock = Clock; | ||
export { Clock }; |
{ | ||
"name": "@ixnode/simple-clock", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A simple, updating clock component for React.", | ||
@@ -11,4 +11,5 @@ "main": "dist/index.js", | ||
"import": "./dist/index.js", | ||
"require": "./dist/index.js" | ||
} | ||
"require": "./dist/index.cjs" | ||
}, | ||
"./styles.css": "./dist/styles.css" | ||
}, | ||
@@ -15,0 +16,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
1757
846019
55