diff options
author | asurbernardo <asur@asurbernardo.com> | 2020-07-19 16:12:20 +0300 |
---|---|---|
committer | asurbernardo <asur@asurbernardo.com> | 2020-07-19 16:12:20 +0300 |
commit | 0b365c211094d0066320906422064912f0ca9bda (patch) | |
tree | f8b1db9eacd16292fce6e42fafa380a76b401a49 | |
parent | 74af75c9b664ae07b7d0cd0f33379f158e4ef15c (diff) |
Polish search styles, defautl values and code organization
-rw-r--r-- | assets/theme.scss | 24 | ||||
-rw-r--r-- | i18n/en.toml | 2 | ||||
-rw-r--r-- | i18n/es.toml | 2 | ||||
-rw-r--r-- | layouts/_default/list.html | 1 | ||||
-rw-r--r-- | layouts/index.html | 1 | ||||
-rw-r--r-- | layouts/partials/header/base.html | 3 | ||||
-rw-r--r-- | layouts/partials/header/search.html | 17 | ||||
-rw-r--r-- | layouts/partials/page/search.html | 17 |
8 files changed, 37 insertions, 30 deletions
diff --git a/assets/theme.scss b/assets/theme.scss index b121ab3..0d4078c 100644 --- a/assets/theme.scss +++ b/assets/theme.scss @@ -51,12 +51,7 @@ body { } } } -} - -.main { - min-width: 0; - min-height: 80vh; - .search { + &__search { font-family: Courier New, sans-serif; color: black; width: 100%; @@ -68,7 +63,10 @@ body { width: 100%; border-radius: 0; border: 1px solid black; - + border-top: none; + &:focus { + outline: none; + } } .search-item { &__link { @@ -76,6 +74,11 @@ body { } } } +} + +.main { + min-width: 0; + min-height: 80vh; .pagination { margin: 3em auto 2em auto; display: flex; @@ -382,6 +385,12 @@ blockquote { border: none; border-bottom: 1px solid #333; } + &__search { + &__input { + border: none; + border-bottom: 1px solid #333; + } + } } h1 { font-size: 2.5rem; @@ -415,7 +424,6 @@ blockquote { &__caption { position: relative; max-width: 100%; - } } .product { diff --git a/i18n/en.toml b/i18n/en.toml index 8e9ddb7..6dcb27f 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -3,7 +3,7 @@ other = "Home" [notFound] other = "Page not found" [search] -other = "Search for a post" +other = "Search for a post..." [goBackHome] other = "Go back to the homepage" [by] diff --git a/i18n/es.toml b/i18n/es.toml index 66f014e..0ef0521 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -3,7 +3,7 @@ other = "Inicio" [notFound] other = "Página no encontrada" [search] -other = "Buscar un artículo" +other = "Buscar un artículo..." [goBackHome] other = "Volver a la página de inicio" [by] diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 9e4913d..25b2a27 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,5 +1,4 @@ {{ define "main" }} - {{- partial "page/search.html" . -}} <article class="content"> {{.Content}} </article> diff --git a/layouts/index.html b/layouts/index.html index 313dd0b..328efa5 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,5 +1,4 @@ {{ define "main" }} - {{- partial "page/search.html" . -}} {{ range .Paginator.Pages }} {{- partial "post/summary.html" . -}} {{ end }} diff --git a/layouts/partials/header/base.html b/layouts/partials/header/base.html index 1151e3e..bba6444 100644 --- a/layouts/partials/header/base.html +++ b/layouts/partials/header/base.html @@ -3,4 +3,5 @@ {{- partial "header/logo.html" . -}} </a> {{- partial "header/menu.html" . -}} -</nav>
\ No newline at end of file +</nav> +{{- partial "header/search.html" . -}}
\ No newline at end of file diff --git a/layouts/partials/header/search.html b/layouts/partials/header/search.html new file mode 100644 index 0000000..dafa9f4 --- /dev/null +++ b/layouts/partials/header/search.html @@ -0,0 +1,17 @@ +<amp-autocomplete + on="select:AMP.navigateTo(url=event.value)" + filter="substring" + filter-value="title" + src="{{ `search.json` | absLangURL }}" + min-characters="1" + class="header__search"> + <input class="header__search__input" type="text" placeholder="{{ i18n "search"}}" aria-label="{{ i18n "search"}}"> + <template class="header__search__item-template" type="amp-mustache" id="amp-template-custom"> + <div class="search-item" data-value="{{ `{{url}}` }}"> + <small class="search-item__date">{{ `{{date}}` }}</small> <br> + <a class="search-item__link" {{ printf "href=%q" `{{url}}` | safeHTMLAttr }}> + {{ `{{title}}` }} + </a> + </div> + </template> +</amp-autocomplete>
\ No newline at end of file diff --git a/layouts/partials/page/search.html b/layouts/partials/page/search.html deleted file mode 100644 index 9d4c6f9..0000000 --- a/layouts/partials/page/search.html +++ /dev/null @@ -1,17 +0,0 @@ -<amp-autocomplete - on="select:AMP.navigateTo(url=event.value)" - filter="substring" - filter-value="title" - src="{{ `search.json` | absLangURL }}" - min-characters="1" - class="search"> - <input class="search__input" type="text" placeholder="{{ i18n "search"}}" aria-label="{{ i18n "search"}}"> - <template class="search__item-template" type="amp-mustache" id="amp-template-custom"> - <div class="search-item" data-value="{{ `{{url}}` }}"> - <small class="search-item__date">{{ `{{date}}` }}</small> <br> - <a class="search-item__link" {{ printf "href=%q" `{{url}}` | safeHTMLAttr }}> - {{ `{{title}}` }} - </a> - </div> - </template> -</amp-autocomplete>
\ No newline at end of file |