Improve appearance of projects without logos

This commit is contained in:
Ben Visness 2021-11-11 16:23:24 -08:00
parent 0184cd1625
commit b41fb365cf
3 changed files with 17 additions and 5 deletions

View File

@ -746,6 +746,10 @@ func BuildTheme(filepath string, theme string, cachebust bool) string {
} }
func BuildUserFile(filepath string) string { func BuildUserFile(filepath string) string {
if filepath == "" {
return ""
}
filepath = strings.Trim(filepath, "/") filepath = strings.Trim(filepath, "/")
return BuildPublic(fmt.Sprintf("media/%s", filepath), false) return BuildPublic(fmt.Sprintf("media/%s", filepath), false)
} }

View File

@ -1,8 +1,10 @@
{{- /*gotype: git.handmade.network/hmn/hmn/src/templates.ProjectCardData*/ -}} {{- /*gotype: git.handmade.network/hmn/hmn/src/templates.ProjectCardData*/ -}}
<a class="project-card flex br2 overflow-hidden items-center relative {{ .Classes }}" href="{{ .Project.Url }}" > <a class="project-card flex br2 overflow-hidden items-center relative {{ .Classes }}" href="{{ .Project.Url }}" >
<div class="image-container flex-shrink-0"> {{ with .Project.Logo }}
<div class="image bg-center cover" style="background-image:url({{.Project.Logo}})"></div> <div class="image-container flex-shrink-0">
</div> <div class="image bg-center cover" style="background-image:url({{ . }})"></div>
</div>
{{ end }}
<div class="details pa3 flex-grow-1"> <div class="details pa3 flex-grow-1">
<h3 class="mb1">{{ .Project.Name }}</h3> <h3 class="mb1">{{ .Project.Name }}</h3>
<div class="blurb">{{ .Project.Blurb }}</div> <div class="blurb">{{ .Project.Blurb }}</div>

View File

@ -13,8 +13,14 @@
flex flex-column flex-row-ns items-start-ns flex-column-l items-stretch-l flex flex-column flex-row-ns items-start-ns flex-column-l items-stretch-l
mw5-l mh3 ml0-ns mb3 overflow-hidden mw5-l mh3 ml0-ns mb3 overflow-hidden
"> ">
<div class="w-100 w5-ns flex-shrink-0 flex justify-center"> <div class="w-100 w5-ns flex-shrink-0 flex justify-center br3 overflow-hidden">
<img alt="{{ .Project.Name }}" class="br3" src="{{ .Project.Logo }}"> {{ if .Project.Logo }}
<img alt="{{ .Project.Name }}" src="{{ .Project.Logo }}">
{{ else }}
<div class="bg--dim w-100 aspect-ratio--1x1 relative">
<div class="aspect-ratio--object flex justify-center items-center f3 b c--dimmest">{{ .Project.Name }}</div>
</div>
{{ end }}
</div> </div>
<div class="mt3 mt0-ns mt3-l ml3-ns ml0-l overflow-hidden"> <div class="mt3 mt0-ns mt3-l ml3-ns ml0-l overflow-hidden">
<div class="mb3"> <div class="mb3">