<?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: Jaiden Hodson</title>
    <description>The latest articles on DEV Community by Jaiden Hodson (@pvtgandalf).</description>
    <link>https://dev.to/pvtgandalf</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%2F882773%2Fc01d95be-ff23-430c-ab31-8c699293961c.jpeg</url>
      <title>DEV Community: Jaiden Hodson</title>
      <link>https://dev.to/pvtgandalf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pvtgandalf"/>
    <language>en</language>
    <item>
      <title>Emotion Styled Components [Tutorial]</title>
      <dc:creator>Jaiden Hodson</dc:creator>
      <pubDate>Mon, 27 Jun 2022 03:31:13 +0000</pubDate>
      <link>https://dev.to/pvtgandalf/emotion-styled-components-tutorial-407n</link>
      <guid>https://dev.to/pvtgandalf/emotion-styled-components-tutorial-407n</guid>
      <description>&lt;h3&gt;
  
  
  Styled Components are becoming the standard
&lt;/h3&gt;

&lt;p&gt;Styled Components are a perfect pairing when working within a component-based framework (i.e., React, Angular, Vue) so it isn’t surprising to see the growing popularity for this type of styling within the industry. While Styled Components closely resemble that of strict CSS, there are a few syntactic differences that may make it difficult for newly introduced developers to begin working with this library. In this tutorial I will go through some of the most common use-cases when working with Styled Components as well as how to implement them into your own projects.&lt;/p&gt;

&lt;h3&gt;
  
  
  Styling an HTML tag
&lt;/h3&gt;

&lt;p&gt;First you will need to initialize the Styled Component. Then you can use the Styled Component just like any other Functional Component, although it will now include the styling you’ve added.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Styledbutton = styled.button`
  background-color: red;
`;

&amp;lt;Styledbutton&amp;gt;Styled button&amp;lt;/Styledbutton&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Styling a prebuilt component
&lt;/h3&gt;

&lt;p&gt;When using a prebuilt component, the initialization process is exactly the same, although rather than using the dot operator you’ll need to wrap the component in parentheses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Button } from "react-bootstrap";

const StyledButton = styled(Button)`
  background-color: red;
`;

&amp;lt;StyledButton&amp;gt;Styled button&amp;lt;/StyledButton&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Styling nested selectors
&lt;/h3&gt;

&lt;p&gt;Oftentimes when working with prebuilt components you may run into situations where nested attributes need to be altered to accommodate your stylistic needs. This can be done by prepending an ‘&amp;amp;’ to the item you are attempting to select.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Button } from "react-bootstrap";.

const StyledSuccessButton = styled(Button)`
  &amp;amp;.btn-success {
    background-color: red;
  }
`;

&amp;lt;StyledSuccessButton&amp;gt;Styled button&amp;lt;/StyledSuccessButton&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Styling media queries
&lt;/h3&gt;

&lt;p&gt;Responsive web design is one of the most important features implemented by web developers in the modern era of technology. Adjusting Styled Components by a media query is very simple, just include the CSS at-rule prior to the media keyword.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Button } from "react-bootstrap";

const StyledMediaQueryButton = styled(Button)`
  @media (max-width: 650px) {
    background-color: red;
  }
`;

&amp;lt;StyledMediaQueryButton&amp;gt;Styled button&amp;lt;/StyledMediaQueryButton&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Styling with props
&lt;/h3&gt;

&lt;p&gt;One of the major improvements Styled Components has over vanilla CSS is the ability to pass props into components that can then be used to dynamically alter styling based on external factors. Every Styled Component has the ‘props’ attribute which can be accessed to pull out extra data that can be used to change how that component is rendered.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Button } from "react-bootstrap";

const StyledPropsButton = styled(Button)`
  background-color: ${(props) =&amp;gt; props.bgcolor};
`;

&amp;lt;StyledPropsButton&amp;gt;Styled button&amp;lt;/StyledPropsButton&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Styling with conditional props
&lt;/h3&gt;

&lt;p&gt;Since Styled Components allow for functional rendering, it can be very easy to implement conditional statements that alter how the component is rendered based on the props passed into it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Button } from "react-bootstrap";

const StyledConditionalPropsButton = styled(Button)`
  background-color: ${(props) =&amp;gt; (props.isRed ? 'red' : 'green')};
`;

&amp;lt;StyledConditionalPropsButton&amp;gt;Styled button&amp;lt;/StyledConditionalPropsButton&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Demo code
&lt;/h3&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/emotion-styled-components-tutorial-pxx785"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>styledcomponents</category>
      <category>react</category>
      <category>bootstrap</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>My First Post [Welcome to my Blog!]</title>
      <dc:creator>Jaiden Hodson</dc:creator>
      <pubDate>Tue, 21 Jun 2022 02:00:12 +0000</pubDate>
      <link>https://dev.to/pvtgandalf/my-first-post-welcome-to-my-blog-22g8</link>
      <guid>https://dev.to/pvtgandalf/my-first-post-welcome-to-my-blog-22g8</guid>
      <description>&lt;p&gt;Hey all, my name is Jaiden and I’d like to welcome you to the beginning of my blog journal! I’m a full stack software developer with most of my web development experience using the MERN stack (MongoDB, Express, React, Node). I love learning new technologies and I’m always on the hunt for new project ideas.&lt;/p&gt;

&lt;p&gt;As I continue my journey into the life of a software engineer, I will be updating this blog with things I’ve learned along the way. I’m creating this blog to document my progress while also hopefully providing useful information to my fellow computer geeks.&lt;/p&gt;

&lt;p&gt;My initial roadmap for things I’ll be writing about will mostly involve features I’ve implemented within the projects I’ve worked on (as well as projects I’m currently developing). These posts will likely align more closely to frontend development, but I will also include the occasional backend feature as well. As an excuse to freshen up on my data-structures and algorithms, I may include the recurring writeup on Leetcode questions I run through as I prepare myself for coding interviews.&lt;/p&gt;

&lt;p&gt;Thanks for reading,&lt;/p&gt;

&lt;p&gt;Jaiden (aka PvtGandalf)&lt;/p&gt;

</description>
      <category>blog</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
