aboutsummaryrefslogtreecommitdiffstats
path: root/internal/port/tpl/gemini.html
blob: 8d20da1b2f43f1a756321c379fa47542cf2aea45 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1" />
		<title>{{ .Title }} - Gemini proxy</title>
		<link rel="stylesheet" href="{{ .Assets.Style }}" />
		{{- template "_fonts.html" . -}}
	</head>
	<body class="{{ if .IsPlain }}is-plain{{ end }}">
		<header class="header header-base">
      <div class="location">
        <a class="location__prefix">gemini://</a><a class="location__prefix location__prefix--mobile">://</a>
        {{- range $i, $item := .Nav -}}
          {{- if ne $i 0 -}}
            <span class="location__slash">/</span>
          {{- end -}}
          {{- if .Current -}}
            <span class="location__uripart">{{ .Label }}</span>
          {{- else -}}
            <a href="{{ .URL }}/" class="location__uripart">{{ .Label }}</a>
          {{- end -}}
        {{- end -}}
      </div>
      <div class="actions">
        <div class="action"><button class="settings-btn">Settings</button></div>
      </div>
    </header>

		<main class="wrap">
      <div class="content{{ if not .IsPlain }} content--has-type-annotations{{ end }}">
        {{- range .Sections -}}
          {{- if eq .Type "RAW_TEXT" -}}
            <div class="section"><span class="section__type">```</span><pre class="section__content">{{- .Text -}}</pre></div>
          {{- else if eq .Type "REFLOW_TEXT" -}}
            <div class="section"><p class="section__content">{{- .Text -}}</p></div>
          {{- else if eq .Type "LINK" -}}
            {{- $linkCls := "link" -}}
            {{- $url := string .URL -}}
            {{- if or (hasSuffix $url ".jpg") (hasSuffix $url ".jpeg") (hasSuffix $url ".png") (hasSuffix $url ".gif") -}}
              {{- $linkCls = "link--IMG" -}}
            {{- end -}}
            <div class="section"><span class="section__type"> =></span><a class="section__content {{ $linkCls }}" href="{{ .URL }}">{{- .Text -}}</a></div>
          {{- else if eq .Type "HEADING_1" -}}
            <div class="section"><span class="section__type">  #</span><h1 class="section__content">{{- .Text -}}</h1></div>
          {{- else if eq .Type "HEADING_2" -}}
            <div class="section"><span class="section__type"> ##</span><h2 class="section__content">{{- .Text -}}</h2></div>
          {{- else if eq .Type "HEADING_3" -}}
            <div class="section"><span class="section__type">###</span><h3 class="section__content">{{- .Text -}}</h3></div>
          {{- else if eq .Type "LIST" -}}
            <div class="section"><ul class="section__content">
              {{- range .Items -}}
                <li>{{- . -}}</li>
              {{- end -}}
            </ul></div>
          {{- end -}}
        {{- end -}}
      </div>
		</main>

		{{- template "_modals.html" . -}}

		<script src="{{ .Assets.JS }}"></script>
	</body>
</html>