Make it better again
All checks were successful
Build Cat Web App Container / build (push) Successful in 13s
All checks were successful
Build Cat Web App Container / build (push) Successful in 13s
This commit is contained in:
91
main.go
91
main.go
@@ -18,48 +18,58 @@ var tpl = template.Must(template.New("index").Parse(`
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Random Cat Meme</title>
|
<title>Random Cat Meme</title>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background: #f2f2f2;
|
background: #f2f2f2;
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
img {
|
#cat-container {
|
||||||
max-width: 500px;
|
width: 500px;
|
||||||
max-height: 500px;
|
height: 500px;
|
||||||
margin-bottom: 20px;
|
display: flex;
|
||||||
border-radius: 12px;
|
justify-content: center;
|
||||||
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
|
align-items: center;
|
||||||
transition: transform 0.2s;
|
margin-bottom: 20px;
|
||||||
}
|
background: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 4px 10px rgba(0,0,0,0.2);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
img:hover {
|
#catImage {
|
||||||
transform: scale(1.05);
|
max-width: 100%;
|
||||||
}
|
max-height: 100%;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
button {
|
#catImage:hover {
|
||||||
padding: 10px 20px;
|
transform: scale(1.05);
|
||||||
font-size: 16px;
|
}
|
||||||
border: none;
|
|
||||||
border-radius: 8px;
|
|
||||||
background-color: #ff6f61;
|
|
||||||
color: white;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
button {
|
||||||
background-color: #ff3b2f;
|
padding: 10px 20px;
|
||||||
}
|
font-size: 16px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #ff6f61;
|
||||||
|
color: white;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background-color 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #ff3b2f;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script>
|
<script>
|
||||||
async function getCat() {
|
async function getCat() {
|
||||||
@@ -68,17 +78,20 @@ async function getCat() {
|
|||||||
const img = document.getElementById('catImage');
|
const img = document.getElementById('catImage');
|
||||||
img.src = data.url;
|
img.src = data.url;
|
||||||
}
|
}
|
||||||
window.onload = getCat; // Load a cat immediately
|
window.onload = getCat;
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Random Cat Meme</h1>
|
<h1>Random Cat Meme</h1>
|
||||||
<img id="catImage" src="" alt="Random Cat Meme">
|
<div id="cat-container">
|
||||||
|
<img id="catImage" src="" alt="Random Cat Meme">
|
||||||
|
</div>
|
||||||
<button onclick="getCat()">Get a new cat</button>
|
<button onclick="getCat()">Get a new cat</button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`))
|
`))
|
||||||
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
||||||
tpl.Execute(w, nil)
|
tpl.Execute(w, nil)
|
||||||
|
|||||||
Reference in New Issue
Block a user