diff --git a/src/components/Footer.jsx b/src/components/Footer.jsx index dc4ac83..d51decc 100644 --- a/src/components/Footer.jsx +++ b/src/components/Footer.jsx @@ -1,59 +1,55 @@ -import { Component } from 'preact'; import { Button } from './common'; import { Trans, t } from '@lingui/macro'; import { I18n } from '@lingui/react'; import { ProBadge } from './ProBadge'; import { HStack } from './Stack'; -import { useState } from 'preact/hooks'; +import { useEffect, useState } from 'preact/hooks'; -class JS13K extends Component { - constructor(props) { - super(props); - const compoDate = new Date('August 13 2018 11:00 GMT'); - var now = new Date(); - var daysLeft; +import React, { useState } from 'react'; + +const JS13K = props => { + const [daysLeft, setDaysLeft] = useState(0); + + useEffect(() => { + const compoDate = new Date('August 13 2024 11:00 GMT'); + const now = new Date(); if (+compoDate > +now) { - daysLeft = Math.floor((compoDate - now) / 1000 / 3600 / 24); + const _daysLeft = Math.floor((compoDate - now) / 1000 / 3600 / 24); + setDaysLeft(_daysLeft); } - this.setState({ - daysLeft - }); - } + }, []); - render() { - const codeSizeInKb = this.props.codeSize - ? (this.props.codeSize / 1024).toFixed(2) - : 0; - return ( + const codeSizeInKb = props.codeSize ? (props.codeSize / 1024).toFixed(2) : 0; + + return ( +