<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tarandeep Singh</title>
    <description>The latest articles on DEV Community by Tarandeep Singh (@tarandeep_singh).</description>
    <link>https://dev.to/tarandeep_singh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F673888%2Fe85e404a-7e53-4898-9bc7-44c0e7f96c76.png</url>
      <title>DEV Community: Tarandeep Singh</title>
      <link>https://dev.to/tarandeep_singh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tarandeep_singh"/>
    <language>en</language>
    <item>
      <title>How to do wiring in VanillaJS</title>
      <dc:creator>Tarandeep Singh</dc:creator>
      <pubDate>Mon, 09 Aug 2021 23:46:54 +0000</pubDate>
      <link>https://dev.to/tarandeep_singh/how-to-do-wiring-in-vanillajs-36gh</link>
      <guid>https://dev.to/tarandeep_singh/how-to-do-wiring-in-vanillajs-36gh</guid>
      <description>&lt;p&gt;After an unbelievable start to my blogging journey, with my first two blogs crossing over 120+ bookmarks combined, here I am with my third blog! This time around we are going to touch on the basics of JavaScript.&lt;/p&gt;

&lt;p&gt;"VanillaJS" is a term that developers use to describe regular JavaScript. It means using the inbuilt JavaScript methods and objects without any additional libraries or frameworks.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why VanillaJS?
&lt;/h3&gt;

&lt;p&gt;So why use VanillaJS instead of libraries or frameworks? Well, we gotta admit libraries like ReactJS are just amazing but VanillaJS is faster than any other JavaScript framework because it has fewer overheads. Moreover, Using frameworks or libraries in JS is a little like using Bootstrap or Tailwind in CSS, we might miss out on the fundamentals, it eliminates control over your abilities to solve the problem in a different most probably in a better way. For beginners, it's better to start off with VanillaJS and then shift to any framework with the confidence of knowing what actually is going on in that framework!&lt;/p&gt;

&lt;h3&gt;
  
  
  What is wiring?
&lt;/h3&gt;

&lt;p&gt;Wiring is basically connecting different components with a wire. Pretty much like we did in electric circuits while studying physics! Remember connecting a bulb, switch and battery using a wire? That's it! So connecting different code components like input, output and processing is what we are aiming for.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejdn2b8folbqi9vi77mc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fejdn2b8folbqi9vi77mc.jpg" alt="circuit image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Wiring a Button
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a button in HTML &amp;amp; give it an id &lt;code&gt;&amp;lt;button id="btn-click"&amp;gt;Click&amp;lt;/button&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Refer button using &lt;code&gt;querySelector()&lt;/code&gt; in "app.js" &lt;code&gt;var btnClick = document.querySelector("#btn-click");&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Add event listener to button &lt;code&gt;btnClick.addEventListner("click", function clickEventHandler() {
})&lt;/code&gt;
If you are an absolute beginner then do read about the querySelector(), event listener &amp;amp; callbacks in JavaScript at &lt;a href="https://developer.mozilla.org/en-US/" rel="noopener noreferrer"&gt;MDN Docs&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Wiring a textarea input
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create a &lt;code&gt;textarea&lt;/code&gt; input tag &amp;amp; give it an id &lt;code&gt;&amp;lt;textarea id="txt-input"&amp;gt;&amp;lt;/textarea&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Now refer it in js file &lt;code&gt;var txtInput = document.querySelector("#txt-input");&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Read the &lt;code&gt;value&lt;/code&gt; of the tag. You can do this only inside event. For this we are using the same event listener we wrote in 3rd point of 'Wiring a Button' &lt;code&gt;btnClick.addEventListner("click", function clickEventHandler() { txtInput.value;
})&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Wiring a div to show output
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Create an output &lt;code&gt;div&lt;/code&gt; with an id &lt;code&gt;&amp;lt;div id="output"&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Refer it in js &lt;code&gt;var outputDiv = document.querySelector("#output");&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;innerText&lt;/code&gt; to write to this div dynamically when button click happens &lt;code&gt;btnClick.addEventListner("click", function clickEventHandler() { outputDiv.innerText = txtInput.value;
})&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now our wiring is complete and the web app is ready to take input in &lt;code&gt;textarea&lt;/code&gt; and &lt;code&gt;onclick&lt;/code&gt; of a button it'll show output in our output &lt;code&gt;div&lt;/code&gt; element.&lt;/p&gt;

&lt;p&gt;Using this simple concept I have made two fun translator web apps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Minion Translator: &lt;a href="https://minions-bananas.netlify.app/" rel="noopener noreferrer"&gt;See it in action!&lt;/a&gt; | &lt;a href="https://github.com/Tarandeep-s1ngh/Banana-language-translator" rel="noopener noreferrer"&gt;View Source Code&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Yoda Translator: &lt;a href="https://yodatalks.netlify.app/" rel="noopener noreferrer"&gt;See it in action!&lt;/a&gt; | &lt;a href="https://github.com/Tarandeep-s1ngh/Yoda-Speak-Translator" rel="noopener noreferrer"&gt;View Source Code&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fquwf8b6zrmjqai2jue9w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fquwf8b6zrmjqai2jue9w.jpg" alt="minion translator app image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's all for this one! You can check out my other blogs &lt;a href="https://dev.to/tarandeep_singh"&gt;here.&lt;/a&gt;&lt;br&gt;
Do tell me in the comments if you would like the next blog to be on ReactJS!&lt;/p&gt;

&lt;p&gt;You can follow me on &lt;a href="https://twitter.com/Tarandeep_s1ngh" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/tarandeep-s1ngh/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Amazing CSS Tips &amp; Tricks - Part 2</title>
      <dc:creator>Tarandeep Singh</dc:creator>
      <pubDate>Thu, 29 Jul 2021 19:55:37 +0000</pubDate>
      <link>https://dev.to/tarandeep_singh/amazing-css-tips-tricks-part-2-37lg</link>
      <guid>https://dev.to/tarandeep_singh/amazing-css-tips-tricks-part-2-37lg</guid>
      <description>&lt;p&gt;After an amazing response on my first &lt;a href="https://dev.to/tarandeep_singh/amazing-css-tips-tricks-1jl0"&gt;"Amazing CSS Tips &amp;amp; Tricks"&lt;/a&gt; blog, here I am with Part-2. So gear up and get ready to take a dive into CSS!&lt;/p&gt;

&lt;h3&gt;
  
  
  Clamp it Down
&lt;/h3&gt;

&lt;p&gt;Making the websites responsive is a big headache for most developers as they have to write lengthy code with lots of media queries. But I have a life-saver for you guys. You can use functions like min, max, and clamp to refactor your code. The following code shows how you can set the width to a clamped value that has a minimum of 200 pixels, a max of 600, and a preferred value of 50%.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;article {
    width: clamp(200px, 50%, 600px);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The following comparison image shows how I turned 13 lines of code into just 1 using this trick:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8rfbiq6uvviviwqp56bb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8rfbiq6uvviviwqp56bb.png" alt="Comparison: clamp() vs media query"&gt;&lt;/a&gt; &lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  The link pseudo-class
&lt;/h3&gt;

&lt;p&gt;A lot of developers and designers often miss this simple yet effective CSS trick that solves usability issues with visitors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;a:link { color: blue; }
a:visited { color: purple; }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;link:&lt;/code&gt; pseudo-class controls all links that haven’t been clicked on yet &amp;amp; the &lt;code&gt;:visited&lt;/code&gt; pseudo-class handles the styling of all of the links user has already visited. This tells the visitors where they have already been on your site, and where they have yet to explore. &lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Drop Caps
&lt;/h3&gt;

&lt;p&gt;Drop caps remind me of the traditional printed books &amp;amp; newspapers. I just love it as it is a great way to start a page with written content. That first, large letter really grabs your attention. We can use &lt;code&gt;:first-letter&lt;/code&gt; to create a drop cap in CSS. Here’s an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;p:first-letter {
  font-family: "Source Sans Pro", Arial, Helvetica, sans-serif;
  float: left;
  font-size: 6rem;
  line-height: 0.65;
  margin: 0.1em 0.1em 0.2em 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5u3x73txtfkjnomiwty.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy5u3x73txtfkjnomiwty.png" alt="drop-cap output image"&gt;&lt;/a&gt; &lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Hover Effects
&lt;/h3&gt;

&lt;p&gt;This might be an easy one, yet very useful. If you want to highlight something whenever the user hovers the mouse over it then add &lt;code&gt;:hover&lt;/code&gt; to that button, text link, block section or icon. Here's how the CSS would look if you wanted to change the color of h2 tag whenever the user hovers over it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.entry h2{
    font-size:24px;
    color:#000;
    font-weight:700;
}

.entry h2:hover{
    color:#f00;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;h3&gt;
  
  
  Transition for Hover Effect
&lt;/h3&gt;

&lt;p&gt;For hover effects, on menus or images in your website, you don’t want colors snapping too quickly as they might not look pleasing to the end-user. So ideally, we should ease the change gradually, which is where the transition property comes into play. The following code shows how in the same hover effect used above, we can make the change happen over .4 seconds, instead of just instantly snapping to red.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.entry h2 {
  transition: color 0.3s ease;
}

.entry h2:hover{
    color:#f00;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
That's all for this one! I want to thank all of you guys for such an overwhelming response on my first blog. I was amazed to see how it got 60+ bookmarks in just 24 hours of posting it! If you have not seen it, Check it out &lt;a href="https://dev.to/tarandeep_singh/amazing-css-tips-tricks-1jl0"&gt;here.&lt;/a&gt; &lt;br&gt;
Tell me in the comments which trick did you guys liked the most!&lt;/p&gt;

&lt;p&gt;You can follow me on &lt;a href="https://twitter.com/Tarandeep_s1ngh" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/tarandeep-s1ngh/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Amazing CSS Tips &amp; Tricks</title>
      <dc:creator>Tarandeep Singh</dc:creator>
      <pubDate>Mon, 26 Jul 2021 14:32:14 +0000</pubDate>
      <link>https://dev.to/tarandeep_singh/amazing-css-tips-tricks-1jl0</link>
      <guid>https://dev.to/tarandeep_singh/amazing-css-tips-tricks-1jl0</guid>
      <description>&lt;p&gt;Wanna know how to use modern CSS features to write clean code by using some stunning CSS tricks? You have just landed at the right place!&lt;/p&gt;

&lt;h3&gt;
  
  
  A Tip For Beginners
&lt;/h3&gt;

&lt;p&gt;Here's a quick tip for those who have just started to learn CSS - DON'T use Bootstrap or Tailwind! No doubt they are great tools to get a nice-looking UI quickly but using these will mean that you'll be missing on CSS fundamentals. I have personally done this mistake &amp;amp; oh boy did I regret it. &lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Grid is Great
&lt;/h3&gt;

&lt;p&gt;Unlike flexbox which only deals with individual columns &amp;amp; rows, Grid allows you to think about the big picture. When you set an element to &lt;code&gt;display: grid;&lt;/code&gt; you can then define its children as a bunch of columns &amp;amp; rows. Have a look at the amount of code we have eliminated by using grid instead of flexbox in the image below.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuey8kgmk3ybat10wby6j.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuey8kgmk3ybat10wby6j.jpg" alt="Grid vs flexbox image"&gt;&lt;/a&gt; &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout" rel="noopener noreferrer"&gt;Click here to read more about CSS Grid Layout&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  CSS Debugging
&lt;/h3&gt;

&lt;p&gt;We often use Chrome developer tools for debugging our code (including CSS) but you'll be surprised to know that Firefox developer tools are much superior especially when it comes to CSS. On inspecting an element in Firefox, you'll have a break-down of the box-model like you have in Chrome but you can also edit properties on it directly, for instance changing the padding or margin and it will also give you a breakdown of all the properties that are influencing the box-model. Not only this, Firefox also provides really nice graphics for flex &amp;amp; grid layouts.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7a39m463qcewxi2vbey2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7a39m463qcewxi2vbey2.jpg" alt="Firefox dev-tool image"&gt;&lt;/a&gt; &lt;br&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Image Filters
&lt;/h3&gt;

&lt;p&gt;It's fun to play around with images in CSS, but did you know that we can apply amazing effects to those images. In fact CSS allows using lots of filters on the images to help developers play with the graphics without changing it in Photoshop. Let’s have a look at some of the filters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.image img {
  max-width: 300px;
}

.blur {
  filter: blur(5px);
}

.grayscale {
  filter: grayscale(100%);
}

.brightness {
  filter: brightness(150%);
}

.saturate {
  filter: saturate(200%);
}

.invert {
  filter: invert(100%);
}

.huerotate {
  filter: hue-rotate(180deg);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;br&gt;&lt;br&gt;
I have much more to write and share with you guys but it's getting a little long, so comment below if you want part 2 of &lt;strong&gt;Amazing CSS Tips &amp;amp; Tricks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can follow me on &lt;a href="https://twitter.com/Tarandeep_s1ngh" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/tarandeep-s1ngh/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
