Skip to content

Commit

Permalink
Imports
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinDFuller committed Aug 12, 2023
1 parent 1552d65 commit 06d4d57
Show file tree
Hide file tree
Showing 7 changed files with 785 additions and 749 deletions.
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

type data struct {
Title string
Meta string
Entries [][]byte
Entry []byte
}
Expand Down Expand Up @@ -99,7 +100,12 @@ func main() {
})

http.HandleFunc("/grass", func(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "./make/grass.html")
if err := template.Must(template.ParseFiles("./make/grass.template.html", "./make/grass.js", "./make/grass.css", "./meta.template.html")).Execute(w, data{
Title: "Grass",
Meta: "grass",
}); err != nil {
log.Printf("Error: %s", err)
}
})

http.HandleFunc("/story", func(w http.ResponseWriter, r *http.Request) {
Expand Down
19 changes: 19 additions & 0 deletions make/grass-service-worker.js
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
self.addEventListener('install', event => console.log('ServiceWorker installed'));

self.addEventListener('push', function(event) {
console.log({ event });

event.waitUntil(self.registration.showNotification("Grass | Justin Fuller", {
body: "Today's the day. Water your lawn!",
icon: "/image/grass.png",
}));
})

self.addEventListener('notificationclick', function(event) {
console.log('[Service Worker] Notification click received.');

event.notification.close();

event.waitUntil(
clients.openWindow('https://justindfuller.com/grass')
);
});
177 changes: 177 additions & 0 deletions make/grass.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<style>
* {
box-sizing: border-box;
}

html,
body {
padding: 0 20px;
margin: 0;
width: 100%;
height: max-content;
display: block;
font-size: 24px;
font-family: "Amiri", serif;
background: #fcf9f4;
}

#getLocation {
margin-top: 40px;
margin-bottom: 40px;
}

.centered {
margin-left: auto;
margin-right: auto;
display: block;
}

div {
width: 100%;
}

@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}

main {
animation: fadeIn 1s;
height: max-content;
max-width: 500px;
margin: auto;
display: flex;
justify-content: flex-start;
align-items: center;
flex-direction: column;
padding-bottom: 60px;
}

h1 {
line-height: 45px;
margin-top: 40px;
margin-bottom: 20px;
}

button,
p,
progress {
margin: 20px 0;
}

select {
width: 100%;
padding: 10px 20px;
border: 2px solid black;
background: white;
color: black;
}

button {
padding: 10px 20px;
border-top: 2px solid black;
border-left: 2px solid black;
border-right: 4px solid black;
border-bottom: 4px solid black;
border-radius: 2px;
background: white;
color: black;
cursor: pointer;
}

button:hover {
border-top: 3px solid black;
border-left: 3px solid black;
border-right: 3px solid black;
border-bottom: 3px solid black;
}

select,
label,
input[type="checkbox"] {
cursor: pointer;
}

label {
display: block;
}

#weekDays.hidden,
.hidden {
display: none;
}

#weekDays {
display: flex;
flex-direction: row;
justify-content: space-between;
flex-wrap: wrap;
align-items: flex-start;
}

.day {
background: white;
cursor: pointer;
text-align: center;
width: 45%;
border-top: 2px solid black;
border-left: 2px solid black;
border-right: 4px solid black;
border-bottom: 4px solid black;
border-radius: 4px;
margin-bottom: 20px;
}

.day:has(input:checked) {
border-color: #0075ff;
}

@media screen and (max-width: 400px) {
.day {
width: 100%;
}
}

.day:hover {
border-right: 3px solid black;
border-bottom: 3px solid black;
border-left: 3px solid black;
border-top: 3px solid black;
}

.day .icon {
height: 40px;
width: auto;
}

.day .icon.thermometer {
padding-bottom: 5px;
margin-left: -10px;
}

.day .icon.cloud {
padding-bottom: 2px;
margin-left: -10px;
}

.day .stat {
display: flex;
align-items: center;
justify-content: center;
}

.day .title {
display: block;
text-align: center;
font-weight: bold;
}

.day .rain,
.day .temperature {
min-width: 70px;
}
</style>
Loading

0 comments on commit 06d4d57

Please sign in to comment.