Files
godot-website/assets/css/header.css
Emi bf79f99062 Add localization plugin and initial es translation (#1011)
* Add plugin and initial `es` translation

* Add missing features to plugin

* Translate home page and sponsors

* Add language selector and widen nav

* Fix mobile style and language selector

* Add js helper file

* Update header.css

* translate footer
2025-02-27 19:33:16 +01:00

272 lines
4.6 KiB
CSS

header {
/* Show on top of GodotCon banner (if any). */
position: relative;
z-index: 2;
height: 64px;
background-color: var(--navbar-background-color);
display: flex;
align-items: center;
box-shadow: var(--base-shadow);
.container {
overflow: initial;
width: 100%;
}
#logo-link {
/* Make the logo's clickable area as tall as for other navigation links. */
padding: 0.2rem 0.5rem;
padding-top: 6px;
margin-left: -9px;
padding-right: 15px;
margin-right: -23px;
}
}
#nav, #nav_head {
.fund {
margin-right: 0px;
margin-left: 0px;
padding-left: 7px;
&.desktop {
@media (max-width: 1200px) {
display: none;
}
}
&.mobile {
top: -2px;
position: relative;
@media (min-width: 1200px) {
display: none;
}
}
a {
text-decoration: none;
color: #F35774;
color: white;
background-color: #F35774 !important;
border-radius: var(--button-border-radius);
box-shadow: inset 0 0 0 2px #F35774;
padding: 13px;
}
}
}
#nav_toggle_cb {
display: none;
}
#nav_toggle_btn {
line-height: 0px;
cursor: pointer;
user-select: none;
border-radius: 100%;
@media (min-width: 1200px) {
display: none;
}
}
.mobile-language-selector {
display: none;
}
.mobile-links {
display: grid;
grid-template-columns: 1fr 49px;
align-items: center;
@media (min-width: 1200px) {
display: none;
}
}
#nav {
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
padding-left: 26px;
a {
text-decoration: none;
font-size: 16px;
font-weight: 400;
color: var(--navbar-link-color);
padding: 1.3175rem 1rem;
margin-left: 14px;
}
ul {
list-style: none;
margin: 0;
padding-left: 0;
}
a:hover, #logo-link:hover {
background-color: hsla(0, 0%, 50%, 0.1);
}
}
#nav > ul {
display: flex;
align-items: center;
height: 100%;
}
#nav > ul > :first-child {
padding-left: 0;
}
#nav > ul > :last-child {
padding-right: 0;
}
#nav > ul li {
padding-left: 1rem;
margin-bottom: 0;
margin-left: -1rem;
margin-right: -1rem;
}
#nav li.active > a {
color: var(--navbar-link-current-color);
}
#nav > ul ul {
display: none;
}
#nav_head {
display: flex;
align-items: center;
justify-content: space-between;
}
/* Mobile style */
@media (max-width: 1200px) {
.hide-on-mobile {
display: none;
}
header {
height: auto;
}
header > div {
flex-direction: column;
}
#logo-link {
margin: 0;
}
#nav_head {
width: 100%;
margin-top: 0.25rem;
}
#nav_toggle_btn {
display: block;
/* Make the navbar toggle button easier to click. */
padding: 1.25rem;
margin-top: -0.2rem;
margin-right: -1rem;
}
#nav_toggle_btn:hover {
background-color: hsla(0, 0%, 50%, 0.15);
}
#nav_toggle_btn:active {
background-color: hsla(0, 0%, 50%, 0.25);
}
#nav_toggle_cb:checked ~ header nav {
display: block;
}
#nav {
display: none;
padding-left: 0;
}
#nav ul {
align-items: flex-start;
flex-direction: column;
height: auto;
}
#nav > ul {
margin-bottom: 16px;
}
#nav ul li {
padding: 0;
padding-top: 16px;
width: 100%;
}
#nav ul a {
width: 100%;
display: block;
/* Make links easier to click but still close to each other. */
padding-top: 0.75rem;
padding-bottom: 0.75rem;
padding-left: 1.5rem;
padding-right: 1.5rem;
margin-top: -0.4375rem;
margin-bottom: -0.4375rem;
}
}
/* Language selector */
.language-selector {
background-image: none;
}
.language-option {
@media (max-width: 1200px) {
margin-left: 30px;
}
}
@media (prefers-color-scheme: dark) {
#nav_toggle_btn {
filter: invert(100%)saturate(0%)brightness(120%);
}
}
/* Language selector */
@media (min-width: 1200px) {
#nav {
.language-selector {
width: 66px;
height: 43px;
display: block;
text-align: center;
background-image: url(/assets/icons/language.svg);
background-repeat: no-repeat;
background-position: 28px 6px;
background-size: 42px;
opacity: 0.8;
margin-left: -10px;
cursor: pointer;
user-select: none;
@media (prefers-color-scheme: light) {
background-image: url(/assets/icons/language-light.svg);
}
}
.language-dropdown {
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
border-radius: 5px;
background: #303030;
border: 1px solid #ffffff3b;
position: relative;
top: 50px;
width: 120px;
left: -65px;
display: none;
a {
padding: 5px 10px;
margin: 0;
display: block;
}
}
.language-selector.open .language-dropdown {
display: block;
}
.language-option {
user-select: none;
}
}
}