oskarnr1 commited on
Commit
5cbd4d2
·
verified ·
1 Parent(s): 29ecb41

when clicking all button show both the columns, art and games beside each others, when clicking games button show only games column and have it centered on the screen, the art button works the same way but show the art column

Browse files
Files changed (1) hide show
  1. index.html +42 -29
index.html CHANGED
@@ -378,45 +378,58 @@ View All Projects
378
  allBtn.classList.remove('bg-red-600', 'text-white');
379
  allBtn.classList.add('border', 'border-red-600', 'text-red-600');
380
  if (filter === 'games') {
381
- gamesCol.innerHTML = `
382
- <h3 class="text-2xl font-bold mb-6 text-center col-span-full">Games</h3>
383
- ${gamesCol.querySelectorAll('.project-card')[0].outerHTML}
384
- ${gamesCol.querySelectorAll('.project-card')[1].outerHTML}
385
- ${gamesCol.querySelectorAll('.project-card')[2].outerHTML}
386
- `;
387
- gamesBtn.classList.add('bg-red-600', 'text-white');
 
388
  gamesBtn.classList.remove('border', 'border-red-600', 'text-red-600');
389
- } else if (filter === 'art') {
 
 
 
 
 
 
390
  gamesCol.style.display = 'none';
391
- artBtn.classList.add('bg-red-600', 'text-white');
 
 
 
 
 
392
  artBtn.classList.remove('border', 'border-red-600', 'text-red-600');
393
- } else { // all
394
- projectsGrid.style.display = 'grid';
395
- allBtn.classList.add('bg-red-600', 'text-white');
396
- allBtn.classList.remove('border', 'border-red-600', 'text-red-600');
397
 
398
- // Update column headings
399
- gamesCol.innerHTML = `
400
- <h3 class="text-2xl font-bold mb-6 text-center col-span-full">Games</h3>
401
- ${gamesCol.querySelectorAll('.project-card')[0].outerHTML}
402
- ${gamesCol.querySelectorAll('.project-card')[1].outerHTML}
403
- ${gamesCol.querySelectorAll('.project-card')[2].outerHTML}
404
- `;
405
 
406
- artCol.innerHTML = `
407
- <h3 class="text-2xl font-bold mb-6 text-center col-span-full">Art</h3>
408
- ${artCol.querySelectorAll('.project-card')[0].outerHTML}
409
- ${artCol.querySelectorAll('.project-card')[1].outerHTML}
410
- ${artCol.querySelectorAll('.project-card')[2].outerHTML}
411
- `;
 
412
  }
413
  }
414
  // Initialize with all shown by default
415
  document.addEventListener('DOMContentLoaded', function() {
416
  const projectsGrid = document.getElementById('projects-grid');
417
- // Remove grid classes initially
418
- filterProjects('all');
419
- });
 
420
  // Scroll to section function
421
  function scrollToSection(sectionId) {
422
  if (sectionId === 'hero') {
 
378
  allBtn.classList.remove('bg-red-600', 'text-white');
379
  allBtn.classList.add('border', 'border-red-600', 'text-red-600');
380
  if (filter === 'games') {
381
+ // Show only games column centered
382
+ gamesCol.style.display = 'grid';
383
+ artCol.style.display = 'none';
384
+ projectsGrid.style.gridTemplateColumns = '1fr';
385
+ projectsGrid.style.maxWidth = '640px'; // Narrower width for single column
386
+
387
+ // Update button styles
388
+ gamesBtn.classList.add('bg-red-600', 'text-white');
389
  gamesBtn.classList.remove('border', 'border-red-600', 'text-red-600');
390
+ artBtn.classList.remove('bg-red-600', 'text-white');
391
+ artBtn.classList.add('border', 'border-red-600', 'text-red-600');
392
+ allBtn.classList.remove('bg-red-600', 'text-white');
393
+ allBtn.classList.add('border', 'border-red-600', 'text-red-600');
394
+
395
+ } else if (filter === 'art') {
396
+ // Show only art column centered
397
  gamesCol.style.display = 'none';
398
+ artCol.style.display = 'grid';
399
+ projectsGrid.style.gridTemplateColumns = '1fr';
400
+ projectsGrid.style.maxWidth = '640px'; // Narrower width for single column
401
+
402
+ // Update button styles
403
+ artBtn.classList.add('bg-red-600', 'text-white');
404
  artBtn.classList.remove('border', 'border-red-600', 'text-red-600');
405
+ gamesBtn.classList.remove('bg-red-600', 'text-white');
406
+ gamesBtn.classList.add('border', 'border-red-600', 'text-red-600');
407
+ allBtn.classList.remove('bg-red-600', 'text-white');
408
+ allBtn.classList.add('border', 'border-red-600', 'text-red-600');
409
 
410
+ } else { // all
411
+ // Show both columns side by side
412
+ gamesCol.style.display = 'grid';
413
+ artCol.style.display = 'grid';
414
+ projectsGrid.style.gridTemplateColumns = '1fr 1fr';
415
+ projectsGrid.style.maxWidth = '1024px'; // Wider width for two columns
 
416
 
417
+ // Update button styles
418
+ allBtn.classList.add('bg-red-600', 'text-white');
419
+ allBtn.classList.remove('border', 'border-red-600', 'text-red-600');
420
+ gamesBtn.classList.remove('bg-red-600', 'text-white');
421
+ gamesBtn.classList.add('border', 'border-red-600', 'text-red-600');
422
+ artBtn.classList.remove('bg-red-600', 'text-white');
423
+ artBtn.classList.add('border', 'border-red-600', 'text-red-600');
424
  }
425
  }
426
  // Initialize with all shown by default
427
  document.addEventListener('DOMContentLoaded', function() {
428
  const projectsGrid = document.getElementById('projects-grid');
429
+ projectsGrid.style.gridTemplateColumns = '1fr 1fr';
430
+ projectsGrid.style.maxWidth = '1024px';
431
+ filterProjects('all');
432
+ });
433
  // Scroll to section function
434
  function scrollToSection(sectionId) {
435
  if (sectionId === 'hero') {