DEV Community

Gerardo Andrés Ruiz Castillo
Gerardo Andrés Ruiz Castillo

Posted on • Originally published at geanruca.gitvlg.com

From Text to SVG: A Landing Page Refresh

In the devlog-ist/landing project, we're always looking for ways to improve the user experience and visual appeal of our landing page. One recent enhancement involved replacing text-based labels for star ratings with more visually engaging SVG icons. This seemingly small change has a significant impact on the overall aesthetic and clarity of the design.

The Problem: Text Labels vs. Visual Cues

Previously, the landing page used simple text labels (e.g., '5 stars') to indicate ratings or endorsements. While functional, these labels lacked visual impact and didn't immediately draw the user's attention. Our goal was to create a more intuitive and visually appealing representation of these ratings.

The Solution: SVG Star Icons

We decided to replace the text labels with SVG star icons. Here’s how we approached it:

  1. SVG Implementation: We used scalable vector graphics (SVG) to ensure the icons would look crisp and clear on all devices, regardless of screen size or resolution.

    <svg width="24" height="24" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
        <path d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"/>
    </svg>
    
  2. Dynamic Rendering: We implemented logic to dynamically render the appropriate number of filled star icons based on the rating value. For example, a 4-star rating would display four filled stars and one empty star (or a visual representation of a half star for fractional ratings).

  3. Accessibility: Ensuring the star icons were accessible was crucial. We added appropriate ARIA attributes to provide screen readers with meaningful descriptions of the ratings.

The Impact

The change from text labels to SVG star icons has had several positive effects:

  • Improved Visual Appeal: The star icons are more visually engaging and contribute to a cleaner, more modern design.
  • Enhanced User Experience: The visual representation of ratings is more intuitive and easier for users to quickly understand.
  • Consistency: Using SVG icons ensures consistent rendering across different browsers and devices.

By replacing simple text labels with SVG icons, we elevated the visual design and user experience of the devlog-ist/landing project's landing page. This enhancement makes the page more engaging and professional.

Top comments (0)