Make countdown timer bigger, easier to read from a glance
This commit is contained in:
parent
40b8e0668c
commit
03d5ca44e9
File diff suppressed because it is too large
Load Diff
|
@ -8,8 +8,10 @@
|
||||||
"@testing-library/react": "^13.4.0",
|
"@testing-library/react": "^13.4.0",
|
||||||
"@testing-library/user-event": "^13.5.0",
|
"@testing-library/user-event": "^13.5.0",
|
||||||
"bootstrap": "^5.3.2",
|
"bootstrap": "^5.3.2",
|
||||||
|
"firebase": "^10.7.1",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-bootstrap": "^2.9.2",
|
"react-bootstrap": "^2.9.2",
|
||||||
|
"react-countdown-clock": "^2.10.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
|
|
|
@ -3,6 +3,7 @@ import CountdownTimer from './CountdownTimer';
|
||||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
|
|
||||||
|
|
||||||
// Set your target date here
|
// Set your target date here
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
|
|
|
@ -11,32 +11,32 @@ import Card from 'react-bootstrap/Card';
|
||||||
|
|
||||||
// Create a CountdownTimer component and add variables to hold the days, hours, minutes, and seconds values returned from the useCountdown hook
|
// Create a CountdownTimer component and add variables to hold the days, hours, minutes, and seconds values returned from the useCountdown hook
|
||||||
const CountdownTimer = ({ targetDate }) => {
|
const CountdownTimer = ({ targetDate }) => {
|
||||||
const [days, hours, minutes, seconds] = useCountdown(targetDate);
|
const [days, hours, minutes, seconds] = useCountdown(targetDate);
|
||||||
|
|
||||||
// Return the JSX to display the countdown timer, this function will return the ExpiredNotice component if the countdown has finished,
|
// Return the JSX to display the countdown timer, this function will return the ExpiredNotice component if the countdown has finished,
|
||||||
// otherwise it will return the ShowCounter component
|
// otherwise it will return the ShowCounter component
|
||||||
// The component below display's the simple text stating the purpose of the timer, and the countdown box itself.
|
// The component below display's the simple text stating the purpose of the timer, and the countdown box itself.
|
||||||
|
return (
|
||||||
return (
|
<Container fluid className="countdown-container">
|
||||||
<Container fluid className="countdown-container">
|
<Row className="justify-content-center align-items-center">
|
||||||
<Row className="justify-content-center align-items-center">
|
<Col xs={12} sm={8} md={6}>
|
||||||
<Col xs={12} sm={8} md={6}>
|
<h1 className="title">Countdown to TomBay's Retirement</h1>
|
||||||
<h1 className="title">Countdown to TomBay's Retirement</h1>
|
<Card className="border-0 shadow-lg mt-4 countdown-card countdown-card--big"> {/* Updated CSS class */}
|
||||||
<Card className="border-0 shadow-lg mt-4">
|
{days + hours + minutes + seconds <= 0 ? (
|
||||||
{days + hours + minutes + seconds <= 0 ? (
|
<Card.Body className="d-flex flex-column justify-content-center align-items-center">
|
||||||
<Card.Body className="d-flex flex-column justify-content-center align-items-center">
|
<ExpiredNotice />
|
||||||
<ExpiredNotice />
|
</Card.Body>
|
||||||
</Card.Body>
|
) : (
|
||||||
) : (
|
<Card.Body className="d-flex flex-column justify-content-center align-items-center">
|
||||||
<Card.Body className="d-flex flex-column justify-content-center align-items-center">
|
<ShowCounter days={days} hours={hours} minutes={minutes} seconds={seconds} />
|
||||||
<ShowCounter days={days} hours={hours} minutes={minutes} seconds={seconds} />
|
|
||||||
</Card.Body>
|
</Card.Body>
|
||||||
)}
|
)}
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default CountdownTimer;
|
export default CountdownTimer;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
const ShowCounter = ({ days, hours, minutes, seconds }) => (
|
const ShowCounter = ({ days, hours, minutes, seconds }) => (
|
||||||
<div>
|
<div style={{ fontSize: '4rem' }}>
|
||||||
{days} days, {hours} hours, {minutes} minutes, {seconds} seconds
|
{days} days, {hours} hours, {minutes} minutes, {seconds} seconds
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -10,4 +10,6 @@ body {
|
||||||
code {
|
code {
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
monospace;
|
monospace;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
/* styles.css */
|
||||||
|
|
||||||
|
.ShowCounter {
|
||||||
|
font-size: 3em;
|
||||||
|
}
|
Loading…
Reference in New Issue