<?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: James A. </title>
    <description>The latest articles on DEV Community by James A.  (@jamees).</description>
    <link>https://dev.to/jamees</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%2F171962%2Fcaa38c66-517d-4c00-b0ca-741538474d49.png</url>
      <title>DEV Community: James A. </title>
      <link>https://dev.to/jamees</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jamees"/>
    <language>en</language>
    <item>
      <title>Creating a project with NextJS, Typescript and ChakraUI in 3 steps.</title>
      <dc:creator>James A. </dc:creator>
      <pubDate>Tue, 08 Mar 2022 14:38:24 +0000</pubDate>
      <link>https://dev.to/jamees/creating-a-project-with-nextjs-typescript-and-chakraui-in-3-steps-2j2n</link>
      <guid>https://dev.to/jamees/creating-a-project-with-nextjs-typescript-and-chakraui-in-3-steps-2j2n</guid>
      <description>&lt;p&gt;In modern times speed, efficiency and functionality are one of the many elements that makes a web application “super”.  One way we can achieve this gem is by using quality web-building tools like NextJS- to enhance web performance such as lazy-image loading, Typescript- to keep code quality and avoid future spills and ChakraUI- to build accessibly user-friend interfaces. &lt;/p&gt;

&lt;p&gt;This article will be working us through how we can combine these “powers” to build a “superpowered” web application&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step One- Initiate NextJS with Typescript: (&lt;a href="https://nextjs.org/docs/basic-features/typescript#create-next-app-support" rel="noopener noreferrer"&gt;Docs&lt;/a&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In our terminal, navigate to a directory to create a new project. Using your preferred package manager, let’s create a &lt;code&gt;React&lt;/code&gt; project powered with &lt;code&gt;NextJS&lt;/code&gt; and &lt;code&gt;Typescript&lt;/code&gt; using this command: &lt;br&gt;
&lt;code&gt;yarn create next-app --typescript&lt;/code&gt; or &lt;code&gt;npx create-next-app@latest --ts&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;In the process of running this command, the terminal will pop up a dialog asking us to name our new project. Let’s call it &lt;code&gt;doggies&lt;/code&gt; (A Dog-interest website) and we are golden! &lt;/p&gt;

&lt;p&gt;PS: &lt;em&gt;The &lt;code&gt;--ts&lt;/code&gt; or &lt;code&gt;--typescript&lt;/code&gt; is a flag to tell the package manager to initiate a React project with Typescript&lt;/em&gt;.&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%2Fjft850496cvkr7lsjtal.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%2Fjft850496cvkr7lsjtal.png" alt="Initiating Nextjs with Typescript"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Step Two- Install ChakraUI: (&lt;a href="https://chakra-ui.com/guides/getting-started/nextjs-guide" rel="noopener noreferrer"&gt;Docs&lt;/a&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After successfully creating our project that is powered with NextJS and Typescript, let’s now install ChakraUI. Before running the command to install ChakraUI, navigate to the root of the project, then go ahead to install ChakraUI using this command: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;or&lt;br&gt;
&lt;code&gt;npm i @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;And that’s it! ChakraUI is now available on our project. To have full access to the goodies that comes with &lt;code&gt;ChakraUI&lt;/code&gt; we need to do one last thing and that takes us to step number 3.&lt;/p&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%2Frxabw0m8wxwfei2qi1la.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%2Frxabw0m8wxwfei2qi1la.png" alt="Installing Chakra"&gt;&lt;/a&gt;&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;Step Three- Activate the power of ChakraUI.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To do this, we need to access the &lt;code&gt;_app.tsx&lt;/code&gt; file inside our &lt;code&gt;Pages&lt;/code&gt; folder of our project and &lt;code&gt;wrap&lt;/code&gt; its return components in a &lt;code&gt;ChakraProvider&lt;/code&gt; Component. &lt;/p&gt;

&lt;p&gt;This is what the file looks like by default:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;AppProps&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;pageProps&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;AppProps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;pageProps&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MyApp&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So now let’s import &lt;code&gt;ChakraProvider&lt;/code&gt; and use it as a wrapper before returning the &lt;code&gt;Components&lt;/code&gt;. Our file should now look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../styles/globals.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;AppProps&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;next/app&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ChakraProvider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@chakra-ui/react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;Component&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;pageProps&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;AppProps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ChakraProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;pageProps&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;ChakraProvider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MyApp&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fhphw5vnvvdfax1lu2xp4.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%2Fhphw5vnvvdfax1lu2xp4.png" alt="Initiating ChakraProvider"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And there it is! Our application is now powered with NextJS, Typescript and ChakraUI. &lt;/p&gt;

&lt;p&gt;To see the smooth user interfaces your can create with ChakraUI you can check the &lt;a href="https://chakra-ui.com/docs/components/overview" rel="noopener noreferrer"&gt;documentation of all its components here.&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;I’ll be writing an article about why this setup is my favourite and what opportunities this gives us, until then, have a good day and stay well!&lt;/p&gt;

</description>
      <category>chakra</category>
      <category>typescript</category>
      <category>nextjs</category>
      <category>yarn</category>
    </item>
    <item>
      <title>Responsive spacing with ChakraUI (React) </title>
      <dc:creator>James A. </dc:creator>
      <pubDate>Mon, 21 Feb 2022 19:07:35 +0000</pubDate>
      <link>https://dev.to/jamees/responsive-spacing-with-chakraui-react-n6n</link>
      <guid>https://dev.to/jamees/responsive-spacing-with-chakraui-react-n6n</guid>
      <description>&lt;p&gt;ChakraUI is a React based user interface library. Basically it helps you build more user friendly interfaces while still opting for optimal functionality. The creators of ChakraUI put in a lot of work to ensure that components built with ChakraUI can be made responsive as possible. &lt;/p&gt;

&lt;p&gt;In this article we will be exploring how to make responsive elements/components. We all agree that right spacing makes user interfaces more easy to navigate and also tender to the eyes.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kx-cHjrs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7g7p0a7x73rqwv5c73ts.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kx-cHjrs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7g7p0a7x73rqwv5c73ts.jpg" alt="Here we see the power of spacing and how ChakraUI Allows us to be flexible with it." width="880" height="627"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ChakraUI makes it easy to add spacing to our components. We will now look at some options: &lt;/p&gt;

&lt;p&gt;When creating components with &lt;code&gt;Flex&lt;/code&gt; / &lt;code&gt;Grid&lt;/code&gt; we are giving the option of adding a &lt;code&gt;gap&lt;/code&gt; attribute. This attribute typically expects a &lt;code&gt;number&lt;/code&gt;  value ie: &lt;code&gt;{4}&lt;/code&gt; or a &lt;code&gt;string&lt;/code&gt; ie: &lt;code&gt;4rem&lt;/code&gt; and also an &lt;code&gt;object&lt;/code&gt; which we will see in the code sample below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--CZ_M3nAC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cducnlkmr28y80qjpxk9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CZ_M3nAC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cducnlkmr28y80qjpxk9.jpg" alt="We can pass in a singular value for the gap attribute but whatever happened to responsive code?" width="880" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Referencing image: We can pass in a singular value for the &lt;code&gt;gap&lt;/code&gt; attribute but whatever happened to responsive code? &lt;/p&gt;

&lt;p&gt;On the left image we have passed in a value for the &lt;code&gt;gap&lt;/code&gt; attribute. This works but it isn’t optimal and doesn’t gives us the opportunity to make our components as responsive as we want. &lt;/p&gt;

&lt;p&gt;On the right, we are not introduced to a more optimal way of adding spacing to our component. The &lt;code&gt;gap&lt;/code&gt; attribute accepts an &lt;code&gt;object&lt;/code&gt; that also accepts specific &lt;code&gt;attribute&lt;/code&gt; which value will represent spacing values at each breakpoint. Let’s see this more extensively!: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;lg&lt;/code&gt;: Screens not larger than &lt;code&gt;60em&lt;/code&gt; (Default: &lt;code&gt;992px&lt;/code&gt;). &lt;code&gt;Macbook Pros&lt;/code&gt; &lt;code&gt;Laptops&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;md&lt;/code&gt;: Screens not larger than &lt;code&gt;48em&lt;/code&gt; (Default: (&lt;code&gt;768px) ie:&lt;/code&gt;Tablets&lt;code&gt;,&lt;/code&gt;IPads` &lt;/p&gt;

&lt;p&gt;&lt;code&gt;base&lt;/code&gt;: This is &lt;code&gt;default&lt;/code&gt; for all screen if we do not specify others.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://chakra-ui.com/docs/theming/theme#spacing"&gt;Please read the full documentation of how ChakraUI specifies their spacing here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;One more interesting thing is this principle can also be applied to &lt;code&gt;fontsizes&lt;/code&gt;, &lt;code&gt;colors&lt;/code&gt;, &lt;code&gt;display&lt;/code&gt; toggle. &lt;/p&gt;

&lt;p&gt;I hope you found this article helpful in some way. &lt;br&gt;
Enjoy the rest of your day! &lt;/p&gt;

&lt;p&gt;Best regards.&lt;/p&gt;

</description>
      <category>react</category>
      <category>chakraui</category>
      <category>responsivespacing</category>
    </item>
  </channel>
</rss>
