Skip to content

Commit 73a3595

Browse files
authored
Update message_person.html
UI updates, less intrusive alerts because it doesn't use the JavaScript alert function.
1 parent af62510 commit 73a3595

File tree

1 file changed

+102
-200
lines changed

1 file changed

+102
-200
lines changed

message_person.html

Lines changed: 102 additions & 200 deletions
Original file line numberDiff line numberDiff line change
@@ -1,222 +1,115 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
3+
<head>
44
<title>Send Messages | Coding Hut Website</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<style>
7-
body {
8-
overflow-x: hidden;
9-
font-family: Sans-Serif;
10-
margin: 0;
11-
}
12-
13-
.header {
14-
padding: 60px;
15-
text-align: center;
16-
background: #1abc9c;
17-
color: white;
18-
font-size: 30px;
19-
}
20-
21-
.badge {
22-
background-color: red;
23-
color: white;
24-
padding: 4px 8px;
25-
text-align: center;
26-
border-radius: 5px;
27-
}
28-
29-
/* The alert message box */
30-
.alert {
31-
padding: 20px;
32-
background-color: #f44336; /* Red */
33-
color: white;
34-
margin-bottom: 15px;
35-
}
36-
37-
/* The close button */
38-
.closebtn {
39-
margin-left: 15px;
40-
color: white;
41-
font-weight: bold;
42-
float: right;
43-
font-size: 22px;
44-
line-height: 20px;
45-
cursor: pointer;
46-
transition: 0.3s;
47-
}
48-
49-
/* When moving the mouse over the close button */
50-
.closebtn:hover {
51-
color: black;
52-
}
53-
54-
.menu-container {
55-
position: relative;
56-
display: flex;
57-
align-items: center;
58-
justify-content: space-between;
59-
background: #c04d4d;
60-
padding: 20px;
61-
z-index: 1;
62-
user-select: none;
63-
box-sizing: border-box;
64-
}
65-
66-
/* The snackbar - position it at the bottom and in the middle of the screen */
67-
#snackbar {
68-
visibility: hidden; /* Hidden by default. Visible on click */
69-
min-width: 250px; /* Set a default minimum width */
70-
margin-left: -125px; /* Divide value of min-width by 2 */
71-
background-color: #333; /* Black background color */
72-
color: #fff; /* White text color */
73-
text-align: center; /* Centered text */
74-
border-radius: 2px; /* Rounded borders */
75-
padding: 16px; /* Padding */
76-
position: fixed; /* Sit on top of the screen */
77-
z-index: 1; /* Add a z-index if needed */
78-
left: 50%; /* Center the snackbar */
79-
bottom: 30px; /* 30px from the bottom */
80-
}
81-
82-
/* Show the snackbar when clicking on a button (class added with JavaScript) */
83-
#snackbar.show {
84-
visibility: visible; /* Show the snackbar */
85-
/* Add animation: Take 0.5 seconds to fade in and out the snackbar.
86-
However, delay the fade out process for 2.5 seconds */
87-
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
88-
animation: fadein 0.5s, fadeout 0.5s 2.5s;
89-
}
90-
91-
/* Animations to fade the snackbar in and out */
92-
@-webkit-keyframes fadein {
93-
from {bottom: 0; opacity: 0;}
94-
to {bottom: 30px; opacity: 1;}
95-
}
96-
97-
@keyframes fadein {
98-
from {bottom: 0; opacity: 0;}
99-
to {bottom: 30px; opacity: 1;}
100-
}
101-
102-
@-webkit-keyframes fadeout {
103-
from {bottom: 30px; opacity: 1;}
104-
to {bottom: 0; opacity: 0;}
105-
}
106-
107-
@keyframes fadeout {
108-
from {bottom: 30px; opacity: 1;}
109-
to {bottom: 0; opacity: 0;}
110-
}
111-
112-
.menu-logo img {
113-
max-height: 40px;
114-
max-width: 100px;
115-
flex-shrink: 0;
116-
}
117-
118-
.menu-container a {
119-
text-decoration: none;
120-
color: #ffffff;
121-
transition: color 0.3s ease;
122-
}
123-
124-
.menu-container a:hover {
125-
color: #50e3c2;
126-
}
127-
128-
.menu ul {
129-
list-style: none;
130-
display: flex;
131-
padding: 0;
132-
margin: 0;
133-
}
134-
135-
.menu li {
136-
padding: 0 20px;
137-
font-size: 22px;
138-
}
139-
140-
/* Mobile Styles */
141-
@media only screen and (max-width: 767px) {
142-
.menu-container {
143-
flex-direction: column;
144-
align-items: flex-start;
7+
body {
8+
font-family: Arial, sans-serif;
9+
margin: 0;
10+
padding: 0;
11+
background: #ffffff;
12+
color: #333;
14513
}
14614

147-
.menu-logo {
148-
margin-bottom: 10px;
15+
.header {
16+
padding: 60px;
17+
text-align: center;
18+
background: #c04d4d;
19+
color: white;
20+
font-size: 30px;
14921
}
15022

151-
.menu {
152-
display: none;
153-
width: 100%;
154-
flex-direction: column;
23+
.container {
24+
max-width: 500px;
25+
margin: 40px auto;
26+
background: #ffffff;
27+
padding: 20px;
28+
border-radius: 8px;
29+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
15530
}
15631

157-
.menu ul {
158-
flex-direction: column;
159-
width: 100%;
32+
label {
33+
font-weight: bold;
34+
display: block;
35+
margin-top: 10px;
16036
}
16137

162-
.menu li {
163-
padding: 10px 0;
164-
text-align: center;
38+
input {
39+
width: 100%;
40+
padding: 10px;
41+
margin-top: 5px;
42+
border: 1px solid #ccc;
43+
border-radius: 5px;
44+
font-size: 16px;
45+
color: #333;
16546
}
16647

167-
/* Menu button */
168-
.hamburger {
169-
display: block;
170-
font-size: 30px;
171-
cursor: pointer;
48+
button {
49+
width: 100%;
50+
padding: 10px;
51+
margin-top: 15px;
52+
background: #c04d4d;
53+
color: white;
54+
border: none;
55+
border-radius: 5px;
56+
font-size: 18px;
57+
cursor: pointer;
58+
transition: background 0.3s;
17259
}
173-
}
174-
175-
/* Desktop Styles */
176-
@media only screen and (min-width: 768px) {
177-
.menu {
178-
display: flex;
179-
justify-content: space-between;
180-
width: 100%;
60+
61+
button:hover {
62+
background: #a03d3d;
63+
}
64+
65+
/* Snackbar */
66+
#snackbar {
67+
visibility: hidden;
68+
min-width: 250px;
69+
background-color: #333;
70+
color: white;
71+
text-align: center;
72+
border-radius: 5px;
73+
padding: 16px;
74+
position: fixed;
75+
left: 50%;
76+
bottom: 30px;
77+
transform: translateX(-50%);
78+
font-size: 16px;
79+
}
80+
81+
#snackbar.show {
82+
visibility: visible;
83+
animation: fadein 0.5s, fadeout 0.5s 2.5s;
84+
}
85+
86+
@keyframes fadein {
87+
from { bottom: 0; opacity: 0; }
88+
to { bottom: 30px; opacity: 1; }
18189
}
18290

183-
.hamburger {
184-
display: none;
91+
@keyframes fadeout {
92+
from { bottom: 30px; opacity: 1; }
93+
to { bottom: 0; opacity: 0; }
18594
}
186-
}
18795
</style>
188-
</head>
189-
<body>
190-
<nav class="menu-container">
191-
<!-- Logo -->
192-
<a href="https://scratch-coding-hut.github.io" class="menu-logo">
193-
<img src="https://i.postimg.cc/6qgPbyGH/temp-Image-BJ164c.avif" alt="Coding Hut Logo"/>
194-
</a></img>
195-
196-
<!-- Menu Items -->
197-
<div class="menu">
198-
<ul>
199-
<li><a href="https://scratch-coding-hut.github.io">Home</a></li>
200-
<li><a href="https://scratch-coding-hut.github.io/about">About</a></li>
201-
<li><a href="https://scratch.mit.edu/discuss/topic/652178/">Scratch Forum</a></li>
202-
<li><a href="https://scratch-coding-hut.github.io/Wiki/sitemaplinks">Wiki | FAQ | More Links</a></li>
203-
</ul>
204-
<ul>
205-
<li><a href="https://scratch-coding-hut.github.io/account">My Account</a></li>
206-
</ul>
207-
</div>
208-
</nav>
209-
<body>
210-
<center> <h2>Send Messages</h2>
211-
<form id="messageForm" onsubmit="saveMessageToLocalStorage(event)">
212-
<label for="recipient">Send to:</label>
213-
<input type="text" id="recipient" name="recipient" required>
214-
215-
<label for="message">Message:</label>
216-
<input type="text" id="message" name="message" required>
217-
218-
<button type="submit">Send Message</button>
219-
</form></center>
96+
</head>
97+
<body>
98+
<div class="header">Send Messages</div>
99+
100+
<div class="container">
101+
<form id="messageForm" onsubmit="saveMessageToLocalStorage(event)">
102+
<label for="recipient">Send to:</label>
103+
<input type="text" id="recipient" name="recipient" required>
104+
105+
<label for="message">Message:</label>
106+
<input type="text" id="message" name="message" required>
107+
108+
<button type="submit">Send Message</button>
109+
</form>
110+
</div>
111+
112+
<div id="snackbar">Message sent!</div>
220113

221114
<script>
222115
function saveMessageToLocalStorage(event) {
@@ -229,6 +122,15 @@
229122
localStorage.setItem(recipient, JSON.stringify(userMessages));
230123

231124
document.getElementById('messageForm').reset();
232-
alert(`Message sent to ${recipient}!`);
125+
showSnackbar(`Message sent to ${recipient}!`);
126+
}
127+
128+
function showSnackbar(message) {
129+
const snackbar = document.getElementById("snackbar");
130+
snackbar.textContent = message;
131+
snackbar.classList.add("show");
132+
setTimeout(() => snackbar.classList.remove("show"), 3000);
233133
}
234134
</script>
135+
</body>
136+
</html>

0 commit comments

Comments
 (0)