Skip to content
  • Unlock Pro
  • Log in with GitHub
Profile
OverviewSolutions
4
Comments
1

foolishsailor

@foolishsailor160 points

I’m a mysterious individual who has yet to fill out my bio. One thing’s for certain: I love writing front-end code!

Latest solutions

  • Full component based design using React and Styled Components


    foolishsailor•160
    Submitted about 5 years ago

    1 comment
  • Single Price Grid Component


    foolishsailor•160
    Submitted about 5 years ago

    1 comment
  • Fylo data storage component using Sass and BEM


    foolishsailor•160
    Submitted about 5 years ago

    1 comment
  • Social media dashboard with BEM, Sass, CSS Variables


    foolishsailor•160
    Submitted about 5 years ago

    0 comments

Latest comments

  • aashish-cloud•515
    @aashish-cloud
    Submitted about 5 years ago

    Social Media Dashboard Using CSS Flexbox and JS

    1
    foolishsailor•160
    @foolishsailor
    Posted about 5 years ago

    If you use css variables you can create a theme that doesnt require you to use javascript to change the class name of every class. Makes for much cleaner css and JS

    :root {
      --background: hsl(0, 0%, 100%);
      --background___pattern: hsl(225, 100%, 98%);
      --background__card: hsl(227, 47%, 96%);
      --text___dark: hsl(228, 12%, 44%);
      --text___light: hsl(230, 17%, 14%);
    }
    
    [data-theme="dark"] {
      --background: hsl(230, 17%, 14%);
      --background___pattern: hsl(232, 19%, 15%);
      --background__card: hsl(228, 28%, 20%);
      --text___dark: hsl(228, 34%, 66%);
      --text___light: hsl(0, 0%, 100%);
    }
    
    body {
      background-color: var(--background)
    }
    

    and then in JS when you want to switch to dark via the toggle

    const toggle = document.querySelector('.toggle input[type="checkbox"]');
    
    function switchTheme(e) {
        return (e.target.checked) ? 
             document.documentElement.setAttribute('data-theme', 'dark'):
            document.documentElement.setAttribute('data-theme', 'light');
         
    }
    
    toggleSwitch.addEventListener('change', switchTheme, false);
    

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Beta Member

This badge is a shoutout to the early members of our community. They've been around since the early days, putting up with (and reporting!) bugs and adjusting to big UX overhauls!

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub