Skip to content

Commit

Permalink
styling tweaks for language selector
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Jun 4, 2024
1 parent 367e27d commit f3ba1f3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
15 changes: 4 additions & 11 deletions css/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,16 @@
@apply fill-current;
}

.header-lang {
cursor: pointer;
}
.header-lang-select {
display: none;
background-color: rgb(226 232 240 / var(--tw-bg-opacity));
background-color: #fff;
cursor: pointer;
transform-origin: top;
white-space: nowrap;
z-index: 0;
transform: translateX(-50%);
left: 50%;
}
.header-lang:hover .header-lang-select {
display: block;
}
.header-lang-select .r-anchor-background {
background-color: #fff;
z-index: 1;
}
.header-lang-select .r-anchor-label {
z-index: 2;
}
4 changes: 2 additions & 2 deletions src/_includes/header.njk
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<a class="inline-block py-3 px-5 text-gray-800 hover:text-gray-900 rounded align-middle">
{% include "images/icons/translate.svg" %}
</a>
<div class="header-lang-select absolute px-2 py-2 text-gray-800 hover:text-gray-900 rounded align-middle focus:outline-none">
<div class="header-lang-select absolute shadow-2xl px-2 py-2 text-gray-800 rounded-lg align-middle focus:outline-none">
{% for localed in locales -%}
<a href="/{{ localed.code }}/{{ page.url | replace(locale, '') | replace('/', '') }}" hreflang="{{ localed.code }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-200">{{ localed.label }}</a>
<a href="/{{ localed.code }}/{{ page.url | replace(locale, '') | replace('/', '') }}" hreflang="{{ localed.code }}" class="block px-4 py-2 text-sm text-gray-700 hover:text-gray-900">{{ localed.label }}</a>
{% endfor -%}
</div>
</li>
Expand Down

0 comments on commit f3ba1f3

Please sign in to comment.