Skip to content

Captressketh001/social-media-dashboard-with-theme-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Social media dashboard with theme switcher solution

This is a solution to the Social media dashboard with theme switcher challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout for the site depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Toggle color theme to their preference

Screenshot

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • CSS Grid
  • Mobile-first workflow
  • Javascript for the theme switch

What I learned

  • This project expands my knowlegde of CSS Flexbox and grid
  • I also learnt how to switch theme with Javascript using the Local storage
  • The theme switch forced me to learn how to use CSS variables because it provides a straightforward means for the switching.
/* Using css variables */
.theme-light {
    --heading: hsl(230, 17%, 14%);
    --bg-top: hsl(225, 100%, 98%);
    --bg-down:hsl(0, 0%, 100%);
    --card-bg:  hsl(227, 47%, 96%);
    --card-hover:  hsl(228deg, 12% , 80%);
    --card-text: hsl(228, 12%, 44%);
    --overview: hsl(228, 12%, 44%);
}
.theme-dark {
    --heading: hsl(0, 0%, 100%);
    --bg-top: hsl(232, 19%, 15%);
    --bg-down: hsl(230, 17%, 14%);
    --card-bg: hsl(228, 28%, 20%);
    --card-hover: hsl(228, 12%, 44%);
    --card-text: hsl(228, 34%, 66%);
    --overview: hsl(0, 0%, 100%);
    --toggle: linear-gradient(45deg,  hsl(210, 78%, 56%), hsl(146, 68%, 55%));
}
// function to toggle between light and dark theme
function toggleTheme() {
    if (localStorage.getItem('theme') === 'theme-dark') {
            setTheme('theme-light');
    } else {
            setTheme('theme-dark');
    }
}

Continued development

  • settle the nuisance of the theme switch button (done 05/05/2021)

  • Practice more with CSS GRid and Flexbox

Useful resources

  • Gradient border - This helped me to add a gradient border to the instagram card. CSS Tricks is pretty good for anyone trying to work around CSS.
  • Theme Switch - This is an amazing article which helped me finally understand how to switch theme with JS. I'd recommend it to anyone still learning this concept.

Author

Acknowledgments

  • I will like to acknowledge the input of Praise Adeleke, a colleague and a friend.

About

Frontend mentor challenge

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published