Skip to content

This app allows users to select an emotion and get a matching cat image or GIF, displayed in a modal. The app uses JavaScript to dynamically render the available emotions, filter the cats by selected emotion, and randomly display an image or GIF.

Notifications You must be signed in to change notification settings

mendezpvi/fcp-meme-picker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meme Picker

Overview 🧐

The Meme Picker project is part of the "Essential JavaScript Concepts" module from the Scrimba Frontend Career Path course. This app allows users to select an emotion and get a matching cat image or GIF, displayed in a modal. The app uses JavaScript to dynamically render the available emotions, filter the cats by selected emotion, and randomly display an image or GIF.

Meme Picker

Screenshots 📷

Mobile

Desktop

Pseudocode 🖥️

  1. Get emotions from catsData
    • Extract all emotion tags from the catsData array.
  2. Filter out duplicate emotions
    • Ensure only unique emotions are used.
  3. Render emotions as radio inputs
    • Dynamically create a radio button and label for each unique emotion.
  4. Highlight the selected emotion
    • When a radio button is selected, highlight the corresponding label.
  5. Filter cat images and GIFs based on the selected emotion
    • Use the selected emotion and filter catsData to get the matching cats.
  6. Randomly select a cat
    • If multiple cats match the selected emotion, randomly pick one.
  7. Render the selected image or GIF in a modal
    • Display the randomly selected cat’s image or GIF inside a modal.
  8. Close the modal
    • Provide a function to close the modal when the close button is clicked.

Links 🔗

Live site 👈

Scrim code 👈

Scrimba projects repository 👈

What I learned 🤓

🔳 for...of loop: For iterating over arrays and objects.

🔳 import/export: For modularizing code across files.

🔳 Radio & checkbox inputs: How to work with form inputs and their checked states.

🔳 querySelector: For selecting DOM elements dynamically.

🔳 getElementsByClassName: For accessing groups of elements and applying bulk actions.

🔳 classList.remove: For manipulating class names and changing styles.

🔳 Array methods like .includes() and .filter(): Essential methods for array filtering and searching.

🔳 Nested CSS: Writing cleaner and more modular CSS by nesting styles for better organization.

Resources 🗃️

🗃️ Frontend Career Path by Scrimba

Author 🔰

✨ Frontend Mentor - @medezpvi

✨ X (formerly Twitter) - @medezpvi

About

This app allows users to select an emotion and get a matching cat image or GIF, displayed in a modal. The app uses JavaScript to dynamically render the available emotions, filter the cats by selected emotion, and randomly display an image or GIF.

Topics

Resources

Stars

Watchers

Forks