Skip to content

Commit 7861097

Browse files
committed
Fix: Improved footer styling and positioning
- Updated the Footer component to ensure proper positioning and styling - Added CSS styles to position the footer at the bottom of the page. - the footer content is centered and spaced correctly - preserved Ben's admin login sequence logic for keyboard input.
1 parent b74884c commit 7861097

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

components/Footer.tsx

+24-22
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const Footer: React.FC = () => {
1313
let shiftPressed = false;
1414

1515
const handleKeyDown = (e: KeyboardEvent) => {
16-
// Detect if Ctrl or Shift are pressed
1716
if (e.key === 'Control') {
1817
ctrlPressed = true;
1918
}
@@ -23,47 +22,42 @@ const Footer: React.FC = () => {
2322
};
2423

2524
const handleKeyUp = (e: KeyboardEvent) => {
26-
// When both Ctrl and Shift are released, start listening for "admin"
2725
if (ctrlPressed && shiftPressed) {
28-
setListeningForAdmin(true); // Set flag to start listening for "admin"
29-
setInputSequence(''); // Reset input sequence
26+
setListeningForAdmin(true);
27+
setInputSequence('');
3028
ctrlPressed = false;
3129
shiftPressed = false;
3230

33-
// Set a timer to stop listening if no input in 5 seconds
3431
if (timer) clearTimeout(timer);
3532
setTimer(
3633
setTimeout(() => {
37-
setListeningForAdmin(false); // Stop listening after 5 seconds
38-
setInputSequence(''); // Reset sequence
34+
setListeningForAdmin(false);
35+
setInputSequence('');
3936
}, 5000)
4037
);
4138
}
4239
};
4340

4441
const handleKeyPress = (e: KeyboardEvent) => {
45-
// Only proceed if we're in the input mode
4642
if (listeningForAdmin) {
4743
const newSequence = inputSequence + e.key.toLowerCase();
4844

49-
// Check if the input sequence matches "admin"
5045
if (newSequence === 'admin') {
5146
setShowLink(true);
52-
setInputSequence(''); // Reset sequence after success
53-
setListeningForAdmin(false); // Stop listening
47+
setInputSequence('');
48+
setListeningForAdmin(false);
5449

55-
// Set a timer to hide the link after 5 seconds
5650
if (timer) clearTimeout(timer);
5751
setTimer(
5852
setTimeout(() => {
59-
setShowLink(false); // Hide the link after 5 seconds
53+
setShowLink(false);
6054
}, 5000)
6155
);
6256
} else if ('admin'.startsWith(newSequence)) {
63-
setInputSequence(newSequence); // Update sequence
57+
setInputSequence(newSequence);
6458
} else {
65-
setInputSequence(''); // Reset sequence on wrong input
66-
setListeningForAdmin(false); // Stop listening if incorrect
59+
setInputSequence('');
60+
setListeningForAdmin(false);
6761
}
6862
}
6963
};
@@ -76,7 +70,7 @@ const Footer: React.FC = () => {
7670
window.removeEventListener('keydown', handleKeyDown);
7771
window.removeEventListener('keyup', handleKeyUp);
7872
window.removeEventListener('keypress', handleKeyPress);
79-
if (timer) clearTimeout(timer); // Clean up timeout on unmount
73+
if (timer) clearTimeout(timer);
8074
};
8175
}, [inputSequence, listeningForAdmin, timer]);
8276

@@ -90,7 +84,7 @@ const Footer: React.FC = () => {
9084
};
9185

9286
return (
93-
<footer>
87+
<footer className="footer">
9488
<div className="footer-content">
9589
<p>© 2024 ProBooker</p>
9690
{showLink && (
@@ -101,13 +95,21 @@ const Footer: React.FC = () => {
10195
</div>
10296
<AdminLoginModal show={showModal} onClose={closeModal} />
10397
<style jsx>{`
98+
.footer {
99+
width: 100%;
100+
position: absolute;
101+
bottom: 0;
102+
background: #f8f9fa;
103+
border-top: 1px solid #e9ecef;
104+
padding: 20px;
105+
text-align: center;
106+
}
104107
.footer-content {
105108
display: flex;
106109
justify-content: space-between;
107110
align-items: center;
108-
padding: 20px;
109-
background: #f8f9fa;
110-
border-top: 1px solid #e9ecef;
111+
max-width: 1200px;
112+
margin: 0 auto;
111113
}
112114
a {
113115
color: #0070f3;
@@ -122,4 +124,4 @@ const Footer: React.FC = () => {
122124
);
123125
};
124126

125-
export default Footer;
127+
export default Footer;

0 commit comments

Comments
 (0)