From 2454f1bbabaa882b02328cb2f319c2e8f3a8da6b Mon Sep 17 00:00:00 2001 From: David Ralph Date: Wed, 17 Mar 2021 18:26:09 +0000 Subject: [PATCH] feat: analog time settings --- .../modals/settings/sections/Time.jsx | 24 ++++++++++++++++--- src/components/widgets/time/Clock.jsx | 16 ++++++++++++- src/components/widgets/time/clock.scss | 2 +- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/components/modals/settings/sections/Time.jsx b/src/components/modals/settings/sections/Time.jsx index 9b1005ba..4a5a32a5 100644 --- a/src/components/modals/settings/sections/Time.jsx +++ b/src/components/modals/settings/sections/Time.jsx @@ -19,6 +19,11 @@ export default class TimeSettings extends React.PureComponent { }); } + componentDidMount() { + document.getElementById('dateformat').value = localStorage.getItem('dateFormat'); + document.getElementById('timeType').value = localStorage.getItem('timeType'); + } + render() { let digitalSettings = ( @@ -28,10 +33,23 @@ export default class TimeSettings extends React.PureComponent { - ) + ); - if (this.state.timeType !== 'digital') { - digitalSettings = null; + let analogSettings = ( + +

Analog

+ + + + + +
+ ); + + switch (this.state.timeType) { + case 'digital': break; + case 'analogue': digitalSettings = analogSettings; break; + default: digitalSettings = null; break; } return ( diff --git a/src/components/widgets/time/Clock.jsx b/src/components/widgets/time/Clock.jsx index 40af9b37..6714ae5a 100644 --- a/src/components/widgets/time/Clock.jsx +++ b/src/components/widgets/time/Clock.jsx @@ -97,8 +97,22 @@ export default class Clock extends React.PureComponent { render() { let clockHTML =

{this.state.time}{this.state.ampm}

; + const checkValue = (setting) => { + return (localStorage.getItem(setting) === 'true'); + } + if (localStorage.getItem('timeType') === 'analogue') { - clockHTML = ; + clockHTML = ( + + ); } return clockHTML; diff --git a/src/components/widgets/time/clock.scss b/src/components/widgets/time/clock.scss index 8999b5b2..033fa3b6 100644 --- a/src/components/widgets/time/clock.scss +++ b/src/components/widgets/time/clock.scss @@ -18,7 +18,7 @@ border: 1px solid map-get($theme-colours, 'main') !important; } -.react-clock__hand__body { +.react-clock__hand__body, .react-clock__mark__body { background: map-get($theme-colours, 'main') !important; box-shadow: 0 0 25px rgba(0, 0, 0, 0.3); }