1{{- /*gotype: github.com/antonmedv/gitmal/pkg/templates.ListParams*/ -}}
  2{{ define "head" }}
  3    <style>
  4      .files {
  5        border: 1px solid var(--c-border);
  6        border-top: none;
  7        width: 100%;
  8        border-bottom-left-radius: var(--border-radius);
  9        border-bottom-right-radius: var(--border-radius);
 10        overflow-x: auto;
 11      }
 12
 13      .files .dir {
 14        color: var(--c-dir);
 15      }
 16
 17      .files a {
 18        color: var(--c-text-1);
 19      }
 20
 21      .files a:hover {
 22        color: var(--c-brand-2);
 23      }
 24
 25      .row {
 26        display: flex;
 27        height: 40px;
 28        border-bottom: 1px solid var(--c-border);
 29        padding-inline: 16px;
 30        gap: 16px;
 31      }
 32
 33      .row:last-child {
 34        border-bottom: none;
 35      }
 36
 37      .row:hover {
 38        background-color: var(--c-bg-alt);
 39      }
 40
 41      .cell {
 42        flex: 1;
 43        display: flex;
 44        gap: 8px;
 45        align-items: center;
 46        white-space: nowrap;
 47      }
 48
 49      .cell:not(:first-child) {
 50        justify-content: flex-end;
 51        max-width: 100px;
 52      }
 53
 54      @media (max-width: 767px) {
 55        .file-mode {
 56          display: none;
 57        }
 58      }
 59
 60      {{ if .Readme }}
 61      .markdown-container {
 62        padding-inline: 16px;
 63        border: 1px solid var(--c-divider);
 64        border-radius: 8px;
 65        overflow-x: auto;
 66        margin-top: 16px;
 67      }
 68
 69      .markdown-body {
 70        width: 100%;
 71        min-width: 200px;
 72        max-width: 980px;
 73        margin: 0 auto;
 74        padding: 32px;
 75        word-wrap: break-word;
 76        font-size: 16px;
 77        line-height: 1.5;
 78      }
 79
 80      @media (max-width: 767px) {
 81        .markdown-body {
 82          padding: 16px;
 83        }
 84      }
 85
 86      {{.CSSMarkdown}}
 87      {{ end }}
 88    </style>
 89{{ end }}
 90
 91{{ define "body" }}
 92    {{ template "header" . }}
 93
 94    <div class="files">
 95        {{ if .ParentHref }}
 96            <div class="row">
 97                <div class="cell">
 98                    <svg aria-hidden="true" focusable="false" width="16" height="16" class="dir">
 99                        <use xlink:href="#dir"></use>
100                    </svg>
101                    <a href="{{ .ParentHref }}">..</a>
102                </div>
103            </div>
104        {{ end }}
105
106        {{ if or .Dirs .Files }}
107            {{ range .Dirs }}
108                <div class="row">
109                    <div class="cell">
110                        <svg aria-hidden="true" focusable="false" width="16" height="16" class="dir">
111                            <use xlink:href="#dir"></use>
112                        </svg>
113                        <a href="{{ .Href }}">{{ .Name }}</a>
114                    </div>
115                </div>
116            {{ end }}
117
118            {{ range .Files }}
119                <div class="row">
120                    <div class="cell">
121                        <svg aria-hidden="true" focusable="false" width="16" height="16">
122                            <use xlink:href="#file"></use>
123                        </svg>
124                        <a href="{{ .Href }}">{{ .Name }}</a>
125                    </div>
126                    <div class="cell file-mode">{{ .Mode }}</div>
127                    <div class="cell file-size">{{ .Size }}</div>
128                </div>
129            {{ end }}
130        {{ else }}
131            <div class="row">
132                <div class="cell">(empty)</div>
133            </div>
134        {{ end }}
135    </div>
136
137    {{ if .Readme }}
138        <div class="markdown-container">
139            <div class="markdown-body">
140                {{ .Readme }}
141            </div>
142        </div>
143    {{ end }}
144{{ end }}
145