Caeden.dev

Caeden.dev

Tags
Web Dev
Published
June 14, 2023
Author
Kalen Wallin
api_v1_role
api_v1_company
api_v1_type
api_v1_category
api_v1_year
api_v1_cover
api_v2_order
api_v3_link
I recently met a friend of a friend named Caeden. He is a backend developer who’s worked on projects like
ChroMapper
Caeden117Updated Sep 20, 2023
and
Hive
Atlas-RhythmUpdated Jan 23, 2023
. He mentioned that his portfolio site was unresponsive, so I decided to take a crack at fixing some of the issues. Here are the changes I made to improve his portfolio website: caeden.dev.

Major Improvements

Fixed “Click or tap to expand images”

  • Previously, images would expand and then contract when clicked on. They would only stay expanded if long clicked inside the window and then clicked outside the window.
    • This worked by setting CSS styles when the image is :active, meaning only when the user is clicking on the image.
  • Now they work as expected with the use of a little JavaScript.
    • We can achieve the same effect as a long press with a single click by toggling the :active CSS styles through the utilization of the expanded class. This enables us to activate the effect with one click and deactivate it with another, providing a simple and interactive experience.
1st Expand Image JavaScript Function
1st Expand Image JavaScript Function
Copy code from the image
// Toggles the 'expanded' class on an HTML image element. function expandImage(event) { // Get the clicked image element from the event object const clickedImage = event. target; // Toggle the 'expanded' class on the clicked image element clickedImage.classList.toggle('expanded'); }
Old Image Expansion (Mobile)
Old Image Expansion (Mobile)
New Image Expansion (Mobile)
New Image Expansion (Mobile)
The problem with this method is you can only contract the image if you click on the image again. In other words, clicking outside of the image does nothing. This results in a poor user experience. To fix this, we’ll write a new JavaScript function that will detect clicks on the body.
2nd Expand Image JavaScript Function
2nd Expand Image JavaScript Function
Copy code from the image
// Keep track of the currently expanded image let expandedImage = null; function expandImage(event) { // Get the clicked element from the event object const clickedElement = event.target; // Check if the clicked element is an image with the 'expandable' class const isExpandable = clickedElement.tagName === "IMG" && clickedElement.classList.contains("expandable"); if (isExpandable) { // If the clicked image is the same as the currently expanded image, toggle the 'expanded' class and update the reference if (clickedElement === expandedImage) { clickedElement.classList.toggle("expanded"); expandedImage = clickedElement.classList.contains("expanded") ? clickedElement : null; } else { // If there is an expanded image, shrink it if (expandedImage) { expandedImage.classList.remove("expanded"); } // Expand the clicked image and update the reference clickedElement.classList.add("expanded"); expandedImage = clickedElement; } // Stop the event propagation to prevent shrinking the image immediately when expanding event.stopPropagation(); } else { // If an element other than an expandable is clicked, shrink the expanded image if (expandedImage) { expandedImage.classList.remove("expanded"); expandedImage = null; } } }
Warning/Disclaimer: The gifs below cause a flash when expanding the images. This doesn’t actually happen when using the website.
1st attempt at fixing image expansion (Mobile)
1st attempt at fixing image expansion (Mobile)
2nd attempt at fixing image expansion (Mobile)
2nd attempt at fixing image expansion (Mobile)
2nd attempt at fixing image expansion (Laptop)
2nd attempt at fixing image expansion (Laptop)

Content Alignment on Mobile

  • Remove the 5% left margin from .big-side and .small-side.
notion image
notion image

Skills section grid

  • Reduced section height
  • Used a grid layout for the six skills to align them properly
  • Non-breaking hyphen on “.NET 5-8”
Old skills section (Small Phone)
Old skills section (Small Phone)
Old skills section (Phone)
Old skills section (Phone)
Old skills section (Tablet)
Old skills section (Tablet)
Old skills section (Laptop)
Old skills section (Laptop)
New skills section (Small Phone)
New skills section (Small Phone)
New skills section (Phone)
New skills section (Phone)
New skills section (Tablet)
New skills section (Tablet)
New skills section (Laptop)
New skills section (Laptop)

Projects Title Section Height on Mobile

  • Reduced section height
Old project title section (Mobile)
Old project title section (Mobile)
Old project title section (Tablet)
Old project title section (Tablet)
Old project title section (Laptop)
Old project title section (Laptop)

Row Height

New project title section (Mobile)
New project title section (Mobile)
New project title section (Tablet)
New project title section (Tablet)
Old project title section (Laptop)
Old project title section (Laptop)
 
  • Removed row height constraint & Increased margin bottom of large links to prevent this:
View project large link cut off.
View project large link cut off.
View project large link sitting comfortably.
View project large link sitting comfortably.
Rows now take up as much room as they need and look more comfortable.

Minor Improvements

  • Moved meta tags from the body to the head (Best practice).
  • Reduced the font size of h1, h2, h3, and #large-link for really small devices.
  • Changed the top-bar to be underneath header for project pages, similar to home screen.
notion image
notion image
  • Added better page titles for more info on the current page
    • Project Name | Caeden Statia
  • Added non-breaking space to Beat Saber link.
  • scoll-behavior: smooth; was being overridden, so I added !important to force it to activate.
  • Removed deprecated image-rendering property.