Day 16: Final SASS touch-up

kemystra

Kemystra

Posted on April 21, 2022

Day 16: Final SASS touch-up

This post is a continuation of the previous post. For context, I'm making a Random Quote Machine for FreeCodeCamp projects. This is how I completed it.

Adding random colors 🌈

Before this, we have completed the fading function. Now, we want to change its color each time the new quote is shown. This part is kinda trivial, this would be left as an exercise to the reader.
Random colors
I also applied the colors to background-color property of buttons and body element.

Now, it is time to do a few touch ups!

Added Twitter Intent properly

If you have seen Tweet buttons on some website, they may use Twitter Web Intent.

It's a special Twitter URL that allow users to tweet some pre-defined content. The URL is placed as the href attribute in a button.

You can read more here.

After placing them inside the tweet button, it's time for the final touch ups!

Finalizing the site

First, made the site neat with layout adjustments.

Then, added rounded corners to all buttons and the quote box.

I also took some fonts from Google Fonts (specifically, Akshar and Open Sans font).

And... we're done! How cool is that?
Final Result'
Now, to publish them onto CodePen.

Publishing!

CodePen only allows HTML codes that you normally put inside the body tag, so we need to set inline styles to them thru JavaScript:

var body = document.body;
body.classList.add("same-color");

document.documentElement.style.setProperty("--trans-time", "0.5s");
Enter fullscreen mode Exit fullscreen mode

Since we are not writing pure CSS or JavaScript, we need to set the preprocessors for each: Babel for JS, and SASS for CSS.

We also need to put our Google Fonts link into the head tag. Luckily, CodePen already have a special setting for that.

The most important thing here is importing React, ReactDOM and FontAwesome library into the site. This can be done by searching the necessary package in the setting.

And now we're done.

Afterwords

Yay I finished it! I'm now one step closer towards becoming a front-end developer. For those who are struggling with bugs or any random stuff, keep going! Finishing a project will make you forget about that random bug at 3am, or that dependency hell you encounter, or heck anything. It felt blissful and reassuring.

Hope tomorrow would be better for you!

Fullo me on Github!
Also on Twitter!

💖 💪 🙅 🚩
kemystra
Kemystra

Posted on April 21, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Day 16: Final SASS touch-up
100daysofcode Day 16: Final SASS touch-up

April 21, 2022

Day 13: Preparing React Practice
100daysofcode Day 13: Preparing React Practice

April 18, 2022

Day 14: Random Quote Machine
100daysofcode Day 14: Random Quote Machine

April 19, 2022

Day 8: Almost finished with React
100daysofcode Day 8: Almost finished with React

April 13, 2022

Day 20-24: Drum Machine
100daysofcode Day 20-24: Drum Machine

May 1, 2022