init site

This commit is contained in:
ld3zian 2025-01-13 17:44:11 -07:00
parent 40a7e60a8b
commit c765ca9c85
20 changed files with 6860 additions and 1 deletions

View file

@ -0,0 +1,59 @@
---
import { availableLanguages, availableContentTypes } from '../lib/api';
interface Props {
currentLang: string;
currentType: string;
}
const { currentLang, currentType } = Astro.props;
---
<div class="filters">
<select name="language" id="language">
{availableLanguages.map(lang => (
<option value={lang} selected={lang === currentLang}>{lang.toUpperCase()}</option>
))}
</select>
<select name="contentType" id="contentType">
{availableContentTypes.map(type => (
<option value={type} selected={type === currentType}>{type.toUpperCase()}</option>
))}
</select>
</div>
<script>
const langSelect = document.getElementById('language') as HTMLSelectElement;
const typeSelect = document.getElementById('contentType') as HTMLSelectElement;
function updateURL() {
const lang = langSelect.value;
const type = typeSelect.value;
window.location.href = `/${lang}/${type}`;
}
langSelect.addEventListener('change', updateURL);
typeSelect.addEventListener('change', updateURL);
</script>
<style>
.filters {
display: flex;
gap: 1rem;
margin-bottom: 2rem;
}
select {
padding: 0.5rem 1rem;
border-radius: 4px;
background: #23262d;
color: white;
border: 1px solid #444;
}
select:focus {
outline: none;
border-color: rgb(var(--accent));
}
</style>