Initial commit

This commit is contained in:
2026-03-19 22:14:12 +01:00
commit dcad09f5ce
7 changed files with 538 additions and 0 deletions

45
js/app.js Normal file
View File

@@ -0,0 +1,45 @@
import { getRecipeListHTML } from './views/RecipeList.js';
import { getFilterHTML, setupFilter } from './views/Filter.js';
import { getRecipeDetailHTML, setupRecipeDetail } from './views/RecipeDetail.js';
document.addEventListener('DOMContentLoaded', () => {
const appContainer = document.getElementById('app-container');
// Inject all views into the main container
appContainer.innerHTML = `
${getRecipeListHTML()}
${getRecipeDetailHTML()}
${getFilterHTML()}
`;
// Initialize logic for the injected views
setupFilter();
setupRecipeDetail();
});
// --- GLOBAL NAVIGATION METHODS ---
window.openRecipeDetail = () => {
const view = document.getElementById('recipe-detail-view');
// Swap Tailwind classes to slide IN
view.classList.remove('translate-x-full', 'opacity-0', 'pointer-events-none');
view.classList.add('translate-x-0', 'opacity-100', 'pointer-events-auto');
};
window.closeRecipeDetail = () => {
const view = document.getElementById('recipe-detail-view');
// Swap Tailwind classes to slide OUT
view.classList.remove('translate-x-0', 'opacity-100', 'pointer-events-auto');
view.classList.add('translate-x-full', 'opacity-0', 'pointer-events-none');
};
window.openFilters = () => {
const fv = document.getElementById('filter-view');
fv.classList.remove('hidden');
fv.classList.add('flex');
};
window.closeFilters = () => {
const fv = document.getElementById('filter-view');
fv.classList.add('hidden');
fv.classList.remove('flex');
};