-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added TailwindCSS to Urchin. - Updated Makefile to download TailwindCSS (currently only Linux is supported) - Refactored templates to share similar logic between templates. - Redesigned UI for Urchin. - Added layout page shared between all sub pages. - Added dark mode support. - Added new `renderHtml` method to reduce duplicate code in go. - Added self-designed minimalistic 'sea urchin' favicon. :D - Added missing sites `about` and `services`. - Added `Not Found` handling if a resource is requested that is not present, displaying an error message while keeping the layout page. - Restructured `static` folder to include stylesheets, scripts and assets.
- Loading branch information
Showing
38 changed files
with
381 additions
and
303 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ build: prepare_env | |
$(TEMPL) generate | ||
GIN_MODE=release $(GOCMD) build -ldflags "-s" -v -o $(BUILD_DIR)/$(BINARY_NAME) $(URCHIN_DIR) | ||
GIN_MODE=release $(GOCMD) build -ldflags "-s" -v -o $(BUILD_DIR)/$(ADMIN_BINARY_NAME) $(URCHIN_ADMIN_DIR) | ||
./tailwindcss -i ./static/css/custom.css -o ./static/css/style.css --minify | ||
|
||
test: prepare_env | ||
$(GOCMD) test -v ./... | ||
|
@@ -26,9 +27,15 @@ clean: | |
$(GOCMD) clean | ||
rm -rf $(BUILD_DIR) | ||
|
||
# TODO: For now we support only the linux version of tailwindcss, has to be updated in the future to support Windows and MacOS as well. | ||
install-tools: | ||
go install github.com/pressly/goose/v3/cmd/[email protected] | ||
go install github.com/a-h/templ/cmd/[email protected] | ||
go install github.com/cosmtrek/[email protected] | ||
|
||
.PHONY: all build test clean | ||
install-tailwindcss: | ||
curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 | ||
chmod +x tailwindcss-linux-x64 | ||
mv tailwindcss-linux-x64 tailwindcss | ||
|
||
.PHONY: all build test clean install-tailwindcss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/matheusgomes28/urchin/common" | ||
"github.com/matheusgomes28/urchin/database" | ||
"github.com/matheusgomes28/urchin/views" | ||
) | ||
|
||
func aboutHandler(c *gin.Context, app_settings common.AppSettings, db database.Database) ([]byte, error) { | ||
return renderHtml(c, views.MakeAboutPage(app_settings.AppNavbar.Links)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package app | ||
|
||
import ( | ||
"github.com/gin-gonic/gin" | ||
"github.com/matheusgomes28/urchin/common" | ||
"github.com/matheusgomes28/urchin/database" | ||
"github.com/matheusgomes28/urchin/views" | ||
) | ||
|
||
func servicesHandler(c *gin.Context, app_settings common.AppSettings, db database.Database) ([]byte, error) { | ||
return renderHtml(c, views.MakeServicesPage(app_settings.AppNavbar.Links)) | ||
} |
Binary file not shown.
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* Loading tailwind builtins. All custom rules have to be added in here. */ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
|
||
body { | ||
background: #E5E5E5; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
document.getElementById('menu-toggle').addEventListener('click', function () { | ||
const menu = document.getElementById('mobile-menu'); | ||
menu.classList.toggle('hidden') | ||
}); | ||
|
||
const themeToggle = document.getElementById('theme-toggle'); | ||
const lightIcon = document.getElementById('light-icon'); | ||
const darkIcon = document.getElementById('dark-icon'); | ||
|
||
themeToggle.addEventListener('click', function () { | ||
// Toggle dark class on HTML element | ||
document.documentElement.classList.toggle('dark'); | ||
}); | ||
|
||
document.getElementById('demo-form').addEventListener('submit', function() { | ||
const event = new Event('verified'); | ||
const elem = document.querySelector("#demo-form"); | ||
elem.dispatchEvent(event); | ||
}) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** @type {import('tailwindcss').Config} */ | ||
export const content = [ | ||
"./views/*.templ", | ||
] | ||
|
||
export const theme = { | ||
container: { | ||
center: true, | ||
padding: { | ||
DEFAULT: "1rem", | ||
mobile: "1rem", | ||
tablet: "1rem", | ||
desktop: "1rem", | ||
}, | ||
}, | ||
extend: { | ||
colors: { | ||
pastel: { | ||
blue: '#AEC6CF', | ||
purple: '#CBAACB', | ||
pink: '#FFB6C1', | ||
orange: '#FFDAB9', | ||
green: '#C4E17F', | ||
yellow: '#FFDD94', | ||
gray: '#E5E5E5' | ||
} | ||
} | ||
} | ||
} | ||
|
||
export const darkMode = 'selector' | ||
|
||
export const plugins = [require("@tailwindcss/forms"), require("@tailwindcss/typography")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package views | ||
|
||
import ( | ||
. "github.com/matheusgomes28/urchin/common" | ||
) | ||
|
||
templ MakeAboutPage(links []Link) { | ||
@MakeLayout("About", links, makeUnderConstruction()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package views | ||
|
||
templ MakeContactFailure(email string, err string) { | ||
<h2 style="color: #720d0d">Failed to send message from { email }!</h2> | ||
<p>Your message could not be sent. Error: { err }</p> | ||
<h2 class="text-2xl text-bold text-red-800 mb-4">Failed to send message from { email }!</h2> | ||
<p class="text-xl text-bold">Your message could not be sent. Error: <span class="text-extrabold">{ err }</span></p> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package views | ||
|
||
templ MakeContactSuccess(email string, name string) { | ||
<h2>Message Sent From { email }!</h2> | ||
<p>Thank you { name }. The message was successfully sent.</p> | ||
<h2>Message Sent From { email }!</h2> | ||
<p>Thank you { name }. The message was successfully sent.</p> | ||
} |
Oops, something went wrong.