-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(templates): make error page more generic and ✨ responsive ✨
Co-authored-by: Morten Lied Johansen <[email protected]>
- Loading branch information
Showing
13 changed files
with
1,669 additions
and
216 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
local: | ||
npx tailwindcss -i ./input.css -o ./output.css --watch | ||
|
||
build: | ||
npx tailwindcss -o ./output.css --minify |
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,25 @@ | ||
# Error templates | ||
|
||
This directory contains `.gohtml` templates for static error pages served by Wonderwall. | ||
|
||
These pages are typically only shown on exceptional errors, i.e. invalid configuration or infrastructure errors. | ||
End-users should generally not see these pages unless something is really wrong. | ||
|
||
We embed the CSS directly into the `.gohtml` templates. | ||
This avoids implementing an endpoint to serve the CSS file separately. | ||
|
||
## Prerequisites | ||
|
||
If you haven't already, [install the Tailwind CSS CLI](https://tailwindcss.com/docs/installation). | ||
|
||
## Development | ||
|
||
```shell | ||
make local | ||
``` | ||
|
||
## Production | ||
|
||
```shell | ||
make build | ||
``` |
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 templates | ||
|
||
import ( | ||
_ "embed" | ||
"html/template" | ||
) | ||
|
||
//go:embed output.css | ||
var CSS template.CSS |
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,34 @@ | ||
package templates | ||
|
||
import ( | ||
_ "embed" | ||
"html/template" | ||
"io" | ||
|
||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
//go:embed error.gohtml | ||
var errorGoHtml string | ||
var errorTemplate *template.Template | ||
|
||
type ErrorVariables struct { | ||
CorrelationID string | ||
CSS template.CSS | ||
DefaultRedirectURI string | ||
RetryURI string | ||
} | ||
|
||
func init() { | ||
var err error | ||
|
||
errorTemplate = template.New("error") | ||
errorTemplate, err = errorTemplate.Parse(errorGoHtml) | ||
if err != nil { | ||
log.Fatalf("parsing error template: %+v", err) | ||
} | ||
} | ||
|
||
func ExecError(w io.Writer, vars ErrorVariables) error { | ||
return errorTemplate.Execute(w, vars) | ||
} |
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,39 @@ | ||
<!DOCTYPE html> | ||
<html lang="no"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<style> | ||
{{ .CSS }} | ||
</style> | ||
<title>Innloggingsfeil</title> | ||
</head> | ||
<body> | ||
<section class="bg-white"> | ||
<div class="py-8 px-6 mx-auto max-w-screen-xl lg:py-26 lg:px-12"> | ||
<div class="mx-auto max-w-screen-md text-left"> | ||
<h1 class="h-[4rem] mb-2 sm:mb-8 text-4xl tracking-tight font-extrabold sm:text-5xl bg-gradient-to-r from-indigo-700 via-primary-300 to-primary-500 inline-block text-transparent bg-clip-text"> | ||
Beklager, noe gikk galt. | ||
</h1> | ||
<p class="mb-2 text-xl tracking-tight font-bold text-gray-900 sm:text-2xl"> | ||
Vi kunne ikke logge deg på. | ||
</p> | ||
<p class="mb-8 text-base tracking-tight font-normal text-gray-900"> | ||
En teknisk feil gjør at siden er utilgjengelig. Dette skyldes ikke noe du gjorde.<br /> | ||
Vent litt og prøv igjen. | ||
</p> | ||
<div class="flex flex-col gap-3 mt-8 sm:flex-row sm:items-center sm:gap-3"> | ||
<a href="{{.RetryURI}}" class="inline-flex items-center justify-center min-w-44 p-4 text-base font-normal text-white rounded-md bg-action-500 hover:bg-action-600"> | ||
<span class="w-full text-center">Prøv igjen</span> | ||
</a> | ||
<a href="{{.DefaultRedirectURI}}" class="inline-flex items-center justify-center min-w-44 p-4 text-base font-normal rounded-md border-2 border-action-500 text-action-500 hover:bg-action-100"> | ||
<span class="w-full text-center">Gå til forsiden</span> | ||
</a> | ||
</div> | ||
<p class="mt-8 font-light text-sm text-gray-500"> | ||
ID: {{.CorrelationID}} | ||
</p> | ||
</div> | ||
</div> | ||
</section> | ||
</body> | ||
</html> |
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,3 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.