mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] yarn format
This commit is contained in:
parent
6300c88cac
commit
d7b0080da0
6 changed files with 61 additions and 36 deletions
|
@ -4,7 +4,8 @@ export default {
|
|||
},
|
||||
renderers: [
|
||||
// Our main renderer for frontend components
|
||||
'@astrojs/renderer-preact',
|
||||
'@astrojs/renderer-preact',
|
||||
// Needed for Algolia search component
|
||||
'@astrojs/renderer-react'],
|
||||
'@astrojs/renderer-react',
|
||||
],
|
||||
};
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
.language-select {
|
||||
flex-grow: 1;
|
||||
width: 48px;
|
||||
|
@ -23,7 +22,7 @@
|
|||
transition-property: border-color, color;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
padding-left: 30px;
|
||||
padding-right: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
.language-select-wrapper .language-select:hover,
|
||||
.language-select-wrapper .language-select:focus {
|
||||
|
@ -35,14 +34,14 @@
|
|||
position: relative;
|
||||
}
|
||||
.language-select-wrapper > svg {
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 10px;
|
||||
z-index: -1;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 10px;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
@media (min-width: 50em) {
|
||||
.language-select {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,29 +14,55 @@ const SelectLanguage: FunctionalComponent<{}> = ({}) => {
|
|||
|
||||
return (
|
||||
<div class="language-select-wrapper">
|
||||
<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 88.6 77.3" height="1.2em" width="1.2em"> <path fill="currentColor" d="M61,24.6h7.9l18.7,51.6h-7.7l-5.4-15.5H54.3l-5.6,15.5h-7.2L61,24.6z M72.6,55l-8-22.8L56.3,55H72.6z" /> <path fill="currentColor" d="M53.6,60.6c-10-4-16-9-22-14c0,0,1.3,1.3,0,0c-6,5-20,13-20,13l-4-6c8-5,10-6,19-13c-2.1-1.9-12-13-13-19h8 c4,9,10,14,10,14c10-8,10-19,10-19h8c0,0-1,13-12,24l0,0c5,5,10,9,19,13L53.6,60.6z M1.6,16.6h56v-8h-23v-7h-9v7h-24V16.6z" /> </svg>
|
||||
<select class="language-select" value={defaultValue} onChange={(e) => {
|
||||
const newLang = e.target.value;
|
||||
if (newLang === 'en') {
|
||||
window.location.pathname = `/getting-started`;
|
||||
} else {
|
||||
window.location.pathname = `/${newLang}/getting-started`;
|
||||
}
|
||||
// TODO: Preserve the current page, if it exists:
|
||||
// const oldPathname = window.location.pathname;
|
||||
// const oldPathnameParts = oldPathname.split('/');
|
||||
// oldPathnameParts.shift();
|
||||
// if (/^[a-z]{2}$/.test(oldPathnameParts[0])) {
|
||||
// oldPathnameParts.shift();
|
||||
// }
|
||||
// if (newLang !== 'en') {
|
||||
// oldPathnameParts.unshift(newLang);
|
||||
// }
|
||||
// window.location.pathname = '/' + oldPathnameParts.join('/');
|
||||
}}>
|
||||
<option value="en"><span>English</span></option>
|
||||
<option value="nl"><span>Dutch</span></option>
|
||||
</select>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
role="img"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 88.6 77.3"
|
||||
height="1.2em"
|
||||
width="1.2em"
|
||||
>
|
||||
{' '}
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M61,24.6h7.9l18.7,51.6h-7.7l-5.4-15.5H54.3l-5.6,15.5h-7.2L61,24.6z M72.6,55l-8-22.8L56.3,55H72.6z"
|
||||
/>{' '}
|
||||
<path
|
||||
fill="currentColor"
|
||||
d="M53.6,60.6c-10-4-16-9-22-14c0,0,1.3,1.3,0,0c-6,5-20,13-20,13l-4-6c8-5,10-6,19-13c-2.1-1.9-12-13-13-19h8 c4,9,10,14,10,14c10-8,10-19,10-19h8c0,0-1,13-12,24l0,0c5,5,10,9,19,13L53.6,60.6z M1.6,16.6h56v-8h-23v-7h-9v7h-24V16.6z"
|
||||
/>{' '}
|
||||
</svg>
|
||||
<select
|
||||
class="language-select"
|
||||
value={defaultValue}
|
||||
onChange={(e) => {
|
||||
const newLang = e.target.value;
|
||||
if (newLang === 'en') {
|
||||
window.location.pathname = `/getting-started`;
|
||||
} else {
|
||||
window.location.pathname = `/${newLang}/getting-started`;
|
||||
}
|
||||
// TODO: Preserve the current page, if it exists:
|
||||
// const oldPathname = window.location.pathname;
|
||||
// const oldPathnameParts = oldPathname.split('/');
|
||||
// oldPathnameParts.shift();
|
||||
// if (/^[a-z]{2}$/.test(oldPathnameParts[0])) {
|
||||
// oldPathnameParts.shift();
|
||||
// }
|
||||
// if (newLang !== 'en') {
|
||||
// oldPathnameParts.unshift(newLang);
|
||||
// }
|
||||
// window.location.pathname = '/' + oldPathnameParts.join('/');
|
||||
}}
|
||||
>
|
||||
<option value="en">
|
||||
<span>English</span>
|
||||
</option>
|
||||
<option value="nl">
|
||||
<span>Dutch</span>
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -64,4 +64,4 @@
|
|||
.search-hint {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
.theme-toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
@ -35,4 +34,4 @@ input[name='theme-toggle'] {
|
|||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ export const SIDEBAR = [
|
|||
export const SITE = {
|
||||
title: 'Astro Documentation',
|
||||
description: 'Build faster websites with less client-side Javascript.',
|
||||
}
|
||||
};
|
||||
|
||||
export const OPEN_GRAPH = {
|
||||
locale: 'en_US',
|
||||
|
|
Loading…
Reference in a new issue