3-column-preview-card-component

3 Column Preview Card Component

Solution to the 3-column Preview Card Component challenge by Frontend Mentor. Built with Svelte + Vite + WindiCSS.

Frontend Mentor - 3-column preview card component solution

This is a solution to the 3-column preview card component challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Note: Delete this note and update the table of contents based on what sections you keep.

Overview

The challenge

Users should be able to:

  • View the optimal layout depending on their device's screen size
  • See hover states for interactive elements

Screenshot

My process

Built with

What I learned

I learnt to use WindiCSS's safelist config option to prevent dynamic concatenations from being removed at compile step. Will come in handy going forward.

<script>
  // ...
  export let color;
</script>

<!-- Windi cannot guess the possible combinations-->
<section class="... bg-{color}">
  <!-- ... -->
  <button class="... text-{color}">Learn More</button>
</section>
// solved
export default defineConfig({
  safelist: [
    'bg-orange',
    'text-orange',
    'bg-cyan-600',
    'text-cyan-600',
    'bg-cyan-700',
    'text-cyan-700',
  ]
}

Useful resources

Author

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes