feat: header component

This commit is contained in:
Yanislav Igonin 2022-01-28 01:44:35 +02:00
parent 21c82b47e9
commit 2809a418a2
3 changed files with 20 additions and 11 deletions

17
templates/header.html Normal file
View File

@ -0,0 +1,17 @@
{{ define "header" }}
{{ if . }}
<a href="/" class="thread-title-link">
<h1 class="display-1 text-center thread-title">
{{ if ne . "" }}
{{ . }}
{{ else }}
Welcome to Micrach
{{ end }}
</h1>
</a>
{{ else }}
<h1 class="display-1 text-center">Welcome to Micrach</h1>
{{ end }}
{{ end }}

View File

@ -8,7 +8,7 @@
</head>
<body>
<h1 class="display-1 text-center">Welcome to Micrach</h1>
{{ template "header" }}
<div class="container">
{{ template "post-form" .FormData }}

View File

@ -11,19 +11,11 @@
</head>
<body>
<a href="/" class="thread-title-link">
<h1 class="display-1 text-center thread-title">
{{ if ne $FirstPost.Title "" }}
{{$FirstPost.Title}}
{{ else }}
Welcome to Micrach
{{ end }}
</h1>
</a>
{{ template "header" $FirstPost.Title }}
<div class="container">
{{ template "post-form" .FormData }}
<div id="postsСontainer">
{{ range $Post := .Thread }}
<div class="post-container mb-4">