Add a logo
This commit is contained in:
parent
5339c442b7
commit
b1009fa109
18 changed files with 240 additions and 112 deletions
|
|
@ -13,17 +13,17 @@ const Public = "/this-is-fine/"
|
|||
// AssetsDefault contains assets for the 'Default' entrypoint.
|
||||
var AssetsDefault = Assets{
|
||||
Scripts: `<script type="module" src="/this-is-fine/Default.38d394c2.js"></script><script src="/this-is-fine/Default.38d394c2.js" nomodule="" defer></script><script type="module" src="/this-is-fine/Default.38d394c2.js"></script><script src="/this-is-fine/Default.38d394c2.js" nomodule="" defer></script>`,
|
||||
Styles: `<link rel="stylesheet" href="/this-is-fine/Default.db26a303.css"><link rel="stylesheet" href="/this-is-fine/Default.f9675eae.css">`,
|
||||
Styles: `<link rel="stylesheet" href="/this-is-fine/Default.938b4407.css"><link rel="stylesheet" href="/this-is-fine/Default.81f0a181.css">`,
|
||||
}
|
||||
|
||||
// AssetsUser contains assets for the 'User' entrypoint.
|
||||
var AssetsUser = Assets{
|
||||
Scripts: `<script type="module" src="/this-is-fine/Default.38d394c2.js"></script><script src="/this-is-fine/Default.38d394c2.js" nomodule="" defer></script><script type="module" src="/this-is-fine/User.e0367d79.js"></script><script src="/this-is-fine/User.b2f9a57c.js" nomodule="" defer></script>`,
|
||||
Styles: `<link rel="stylesheet" href="/this-is-fine/Default.db26a303.css"><link rel="stylesheet" href="/this-is-fine/User.68febbf8.css"><link rel="stylesheet" href="/this-is-fine/User.840de3b4.css">`,
|
||||
Styles: `<link rel="stylesheet" href="/this-is-fine/Default.938b4407.css"><link rel="stylesheet" href="/this-is-fine/User.68febbf8.css"><link rel="stylesheet" href="/this-is-fine/User.840de3b4.css">`,
|
||||
}
|
||||
|
||||
// AssetsAdmin contains assets for the 'Admin' entrypoint.
|
||||
var AssetsAdmin = Assets{
|
||||
Scripts: `<script nomodule="" defer src="/this-is-fine/User.b2f9a57c.js"></script><script type="module" src="/this-is-fine/User.e0367d79.js"></script><script type="module" src="/this-is-fine/Default.38d394c2.js"></script><script src="/this-is-fine/Default.38d394c2.js" nomodule="" defer></script><script type="module" src="/this-is-fine/Admin.1a380f6f.js"></script><script src="/this-is-fine/Admin.cb58d290.js" nomodule="" defer></script>`,
|
||||
Styles: `<link rel="stylesheet" href="/this-is-fine/Default.db26a303.css"><link rel="stylesheet" href="/this-is-fine/Admin.6d59e220.css"><link rel="stylesheet" href="/this-is-fine/User.840de3b4.css"><link rel="stylesheet" href="/this-is-fine/User.68febbf8.css"><link rel="stylesheet" href="/this-is-fine/Admin.6d2ae968.css">`,
|
||||
Styles: `<link rel="stylesheet" href="/this-is-fine/Default.938b4407.css"><link rel="stylesheet" href="/this-is-fine/Admin.6d59e220.css"><link rel="stylesheet" href="/this-is-fine/User.840de3b4.css"><link rel="stylesheet" href="/this-is-fine/User.68febbf8.css"><link rel="stylesheet" href="/this-is-fine/Admin.6d2ae968.css">`,
|
||||
}
|
||||
|
|
|
|||
1
internal/dis/component/server/assets/dist/Default.81f0a181.css
vendored
Normal file
1
internal/dis/component/server/assets/dist/Default.81f0a181.css
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
a.wisskilink{color:#00f!important}img.biglogo{width:80vw;height:80vw;display:block}@media screen and (min-width:600px){img.biglogo{float:right;width:33vw;height:33vw;max-width:20em;max-height:20em;margin-bottom:-9em;position:relative;top:-9em}}
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -1 +0,0 @@
|
|||
a.wisskilink{color:#00f!important}
|
||||
|
|
@ -14,6 +14,16 @@ nav.pure-menu, nav.breadcrumbs {
|
|||
border-bottom: 1px solid black;
|
||||
}
|
||||
|
||||
nav.pure-menu :has(img.logo) {
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
nav.pure-menu img.logo {
|
||||
height: 2.5em;
|
||||
width: 2.5em;
|
||||
}
|
||||
|
||||
nav.breadcrumbs {
|
||||
padding-left: 1em;
|
||||
font-size: small;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,30 @@
|
|||
a.wisskilink {
|
||||
color: blue !important;
|
||||
}
|
||||
|
||||
img.biglogo {
|
||||
display: block;
|
||||
|
||||
width: 80vw;
|
||||
height: 80vw;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 600px) {
|
||||
img.biglogo {
|
||||
float: right;
|
||||
|
||||
/* set a reasonable size */
|
||||
width: 33vw;
|
||||
height: 33vw;
|
||||
|
||||
/* but don't overdo it */
|
||||
max-width: 20em;
|
||||
max-height: 20em;
|
||||
|
||||
|
||||
/* place image next to the image, overlapping the crumbs bar */
|
||||
position: relative;
|
||||
top: -9em;
|
||||
margin-bottom: -9em;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
<div class="pure-u-1">
|
||||
{{ .Logo }}
|
||||
<p>
|
||||
For more information, see <a href="{{ .SelfRedirect }}">{{ .SelfRedirect }}</a>.
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ var aboutTemplate = template.Must(template.New("about.html").Parse(aboutHTML))
|
|||
// aboutContext is passed to about.html
|
||||
type aboutContext struct {
|
||||
Instances []status.WissKI
|
||||
Logo template.HTML
|
||||
SelfRedirect string
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +42,8 @@ type publicContext struct {
|
|||
About template.HTML
|
||||
}
|
||||
|
||||
const logoHTML = template.HTML(`<img src="/logo.svg" alt="WissKI Distillery Logo" class="biglogo">`)
|
||||
|
||||
func (home *Home) publicHandler(ctx context.Context) http.Handler {
|
||||
|
||||
tpl := publicTemplate.Prepare(
|
||||
|
|
@ -63,6 +66,7 @@ func (home *Home) publicHandler(ctx context.Context) http.Handler {
|
|||
defer pools.ReleaseBuilder(builder)
|
||||
|
||||
// prepare about
|
||||
pc.aboutContext.Logo = logoHTML
|
||||
pc.aboutContext.Instances = home.homeInstances.Get(nil)
|
||||
pc.aboutContext.SelfRedirect = home.Config.SelfRedirect.String()
|
||||
|
||||
|
|
|
|||
BIN
internal/dis/component/server/logo/favicon.ico
Normal file
BIN
internal/dis/component/server/logo/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 335 KiB |
58
internal/dis/component/server/logo/logo.go
Normal file
58
internal/dis/component/server/logo/logo.go
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
package logo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
|
||||
|
||||
_ "embed"
|
||||
)
|
||||
|
||||
type Logo struct {
|
||||
component.Base
|
||||
}
|
||||
|
||||
var (
|
||||
_ component.Routeable = (*Logo)(nil)
|
||||
)
|
||||
|
||||
func (*Logo) Routes() component.Routes {
|
||||
return component.Routes{
|
||||
Prefix: "/logo/",
|
||||
Aliases: []string{"/favicon.ico", "/logo.svg"},
|
||||
Exact: true,
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
//go:embed favicon.ico
|
||||
faviconICO []byte
|
||||
|
||||
//go:embed logo.svg
|
||||
logoSVG []byte
|
||||
)
|
||||
|
||||
var faviconRoute = httpx.Response{
|
||||
ContentType: "image/x-icon",
|
||||
Body: faviconICO,
|
||||
}
|
||||
|
||||
var logoSVGRoute = httpx.Response{
|
||||
ContentType: "image/svg+xml",
|
||||
Body: httpx.MinifySVG(logoSVG),
|
||||
}
|
||||
|
||||
func (*Logo) HandleRoute(ctx context.Context, path string) (http.Handler, error) {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.URL.Path {
|
||||
case "/favicon.ico":
|
||||
faviconRoute.ServeHTTP(w, r)
|
||||
case "/logo.svg":
|
||||
logoSVGRoute.ServeHTTP(w, r)
|
||||
default:
|
||||
http.NotFound(w, r)
|
||||
}
|
||||
}), nil
|
||||
}
|
||||
2038
internal/dis/component/server/logo/logo.svg
Normal file
2038
internal/dis/component/server/logo/logo.svg
Normal file
File diff suppressed because it is too large
Load diff
|
After Width: | Height: | Size: 75 KiB |
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: Adding a logo
|
||||
date: 2023-02-10
|
||||
---
|
||||
|
||||
- added a logo
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="utf-8">
|
||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||
|
||||
<title>{{ .Runtime.Flags.Title }}</title>
|
||||
{{ .Runtime.Flags.Assets.Styles }}
|
||||
|
|
@ -10,6 +11,10 @@
|
|||
|
||||
<body>
|
||||
<nav class="pure-menu pure-menu-horizontal">
|
||||
<span class="pure-menu-heading" role="banner">
|
||||
<img src="/logo.svg" class="logo" alt="WissKI Distillery Logo">
|
||||
</span>
|
||||
|
||||
<ul class="pure-menu-list" role="menubar">
|
||||
{{ range .Runtime.Menu }}
|
||||
<li class="pure-menu-item{{ if .Active }} pure-menu-selected{{ end }}" role="menuitem">
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import (
|
|||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/cron"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/home"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/legal"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/logo"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/news"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/server/templating"
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/solr"
|
||||
|
|
@ -192,6 +193,7 @@ func (dis *Distillery) allComponents() []initFunc {
|
|||
auto[*news.News],
|
||||
|
||||
auto[*assets.Static],
|
||||
auto[*logo.Logo],
|
||||
auto[*templating.Templating],
|
||||
|
||||
// Cron
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue