feat: add git commit hash into footer

This commit is contained in:
rramiachraf 2024-03-05 19:47:02 +01:00
parent 9b0f8fb96a
commit 23b11d2edf
4 changed files with 46 additions and 18 deletions

View File

@ -1,4 +1,6 @@
VERSION=`git rev-parse --short HEAD`
gentempl:
@command -v templ &> /dev/null || go install github.com/a-h/templ/cmd/templ@latest
build:gentempl
templ generate && go build -o dumb
templ generate && go build -ldflags="-X 'github.com/rramiachraf/dumb/data.Version=$(VERSION)' -s -w"

3
data/data.go Normal file
View File

@ -0,0 +1,3 @@
package data
var Version = "DEVELOPMENT"

View File

@ -225,24 +225,22 @@ a {
color: #333;
}
@media screen and (max-width: 900px) {
#container {
padding: 3rem 2rem;
display: flex;
flex-direction: column;
gap: 3rem;
width: calc(100vw - 4rem);;
}
#metadata {
align-items: center;
}
footer {
background-color: #ffcd38;
padding: 1rem 0;
}
footer {
text-align: center;
background-color: #ffcd38;
padding: 1rem;
#footer_container {
width: 1024px;
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 auto;
}
#version {
font-size: 1.3rem;
color: #1b1b1b;
}
footer a {
@ -349,6 +347,26 @@ footer a:hover {
border-radius: 5px;
}
@media screen and (max-width: 1080px) {
#container {
padding: 3rem 2rem;
display: flex;
flex-direction: column;
gap: 3rem;
width: calc(100vw - 4rem);;
}
#metadata {
align-items: center;
}
#footer_container {
width: 100%;
padding: 0 2rem;
box-sizing: border-box;
}
}
/* dark mode */
@media (prefers-color-scheme: dark) {
body {

View File

@ -1,7 +1,12 @@
package views
import "github.com/rramiachraf/dumb/data"
templ footer() {
<footer>
<a rel="noopener noreferrer" target="_blank" href="https://github.com/rramiachraf/dumb">Source Code</a>
<div id="footer_container">
<a rel="noopener noreferrer" target="_blank" href="https://github.com/rramiachraf/dumb">Source Code</a>
<p id="version">{ data.Version }</p>
</div>
</footer>
}