<?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: Brett Stevens</title>
    <description>The latest articles on DEV Community by Brett Stevens (@brettmstevens7).</description>
    <link>https://dev.to/brettmstevens7</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%2F53146%2F780a282a-bf14-4883-a411-8bf0663a7682.jpg</url>
      <title>DEV Community: Brett Stevens</title>
      <link>https://dev.to/brettmstevens7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brettmstevens7"/>
    <language>en</language>
    <item>
      <title>My coding playlist</title>
      <dc:creator>Brett Stevens</dc:creator>
      <pubDate>Fri, 26 Jun 2020 15:22:38 +0000</pubDate>
      <link>https://dev.to/brettmstevens7/my-coding-playlist-1ed5</link>
      <guid>https://dev.to/brettmstevens7/my-coding-playlist-1ed5</guid>
      <description>&lt;p&gt;Here's &lt;a href="https://open.spotify.com/playlist/1StbtqyXowBymfLyTwqori?si=Uprqnf0gRlaLZllIv7wiWg"&gt;my coding playlist on Spotify&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;It's a compilation of songs I've been listening to over the last year.&lt;/p&gt;

&lt;p&gt;I usually opt for songs with a steady beat and no lyrics, but there are some bangers in there (looking at you, Alesso). &lt;/p&gt;

&lt;p&gt;I'll occasionally listen to upbeat, high tempo music with lyrics because it improves my mood, which makes me more productive. &lt;/p&gt;

&lt;p&gt;My most productive artist is probably Brasstracks. I'm also a big fan of Vitamin String Quartet.&lt;/p&gt;

&lt;p&gt;I'll be continuing to add more music, but I'm always looking for new songs and suggestions.&lt;/p&gt;

&lt;p&gt;Share your playlists below in the comments!&lt;/p&gt;

</description>
      <category>music</category>
      <category>productivity</category>
      <category>spotify</category>
      <category>playlists</category>
    </item>
    <item>
      <title>It’s alive! Simple CSS animations in CodePen</title>
      <dc:creator>Brett Stevens</dc:creator>
      <pubDate>Fri, 25 Jan 2019 00:30:06 +0000</pubDate>
      <link>https://dev.to/brettmstevens7/its-alive-simple-css-animations-in-codepen-aa1</link>
      <guid>https://dev.to/brettmstevens7/its-alive-simple-css-animations-in-codepen-aa1</guid>
      <description>&lt;p&gt;After stumbling upon the &lt;a href="https://blog.codepen.io/2018/09/05/the-dogs-of-codepen/"&gt;Dogs of CodePen&lt;/a&gt;, I thought it would be fun to try animating our company mascot, &lt;a href="https://codepen.io/brettmstevens/pen/bOpPdX"&gt;Cody&lt;/a&gt;.* &lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/d3Kq5w84bzlBLVDO/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/d3Kq5w84bzlBLVDO/giphy.gif" alt="It’s alive!"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whether you’re new to coding or just interested in making an animation for fun, here’s how you can make your own. &lt;/p&gt;

&lt;p&gt;First, I partitioned Cody into four parts—a head, body, left arm, and tail—using &lt;a href="https://www.figma.com/file/LbODAJHebYmoqvLRyVvEPdjJ/Cody-from-Software-animation?node-id=0%3A1"&gt;Figma&lt;/a&gt;. These were the parts I wanted to animate in my CodePen.&lt;/p&gt;

&lt;p&gt;Next, I exported these partitions to SVG and uploaded them to a &lt;a href="https://yoksel.github.io/url-encoder/"&gt;URL encoder&lt;/a&gt;. Asset uploading is a pro feature of CodePen, but there are &lt;a href="https://css-tricks.com/lodge/svg/09-svg-data-uris/"&gt;several different ways&lt;/a&gt; you can use Data URIs instead of uploading assets. I am using the Data URI as the &lt;code&gt;background-image&lt;/code&gt; property. &lt;/p&gt;

&lt;p&gt;Then I created a parent &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element for the body and nested a child &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; element for the tail, arm, and head. I set the position of the parent element to &lt;code&gt;relative&lt;/code&gt; and the position of each child element to &lt;code&gt;absolute&lt;/code&gt; (if you need some refreshing on CSS positioning, &lt;a href="https://dzone.com/articles/css-position-relative-vs-position-absolute"&gt;here is a good guide&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;I used &lt;a href="https://www.smashingmagazine.com/2011/05/an-introduction-to-css3-keyframe-animations/"&gt;keyframe-based syntax&lt;/a&gt; to create a tail wag, subtle thumbs-up motion, and a slowly unraveling tongue. &lt;/p&gt;

&lt;p&gt;Last but not least, I made a simple Javascript function to add and remove classes when you click anywhere on Cody.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/brettmstevens/embed/bOpPdX?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;More about Cody: Cody is our robot AI puppy-persona whose mission is to help developers improve their craft. Cody is a border collie, one of the world’s smartest dogs and was created by Simon Oxley (the creator of the Twitter bird and the GitHub Octocat).&lt;/em&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>animations</category>
      <category>codepen</category>
    </item>
    <item>
      <title>Building simple data visualizations with React</title>
      <dc:creator>Brett Stevens</dc:creator>
      <pubDate>Thu, 17 Jan 2019 00:54:44 +0000</pubDate>
      <link>https://dev.to/brettmstevens7/building-simple-data-visualizations-with-react-9em</link>
      <guid>https://dev.to/brettmstevens7/building-simple-data-visualizations-with-react-9em</guid>
      <description>&lt;p&gt;If you’re looking for an alternative to building your own custom charts using D3, there are a lot of great React charting libraries out there (like &lt;a href="https://formidable.com/open-source/victory/" rel="noopener noreferrer"&gt;Victory&lt;/a&gt; by Formidable Labs, &lt;a href="http://recharts.org/en-US/" rel="noopener noreferrer"&gt;Recharts&lt;/a&gt;, and &lt;a href="https://uber.github.io/react-vis/" rel="noopener noreferrer"&gt;React Vis&lt;/a&gt; by Uber, to name a few).&lt;/p&gt;

&lt;p&gt;I personally like &lt;a href="https://nivo.rocks/" rel="noopener noreferrer"&gt;Nivo&lt;/a&gt; because it has an interactive documentation site. You can adjust the chart properties using toggles in the UI to quickly visualize and iterate on your design.&lt;/p&gt;

&lt;p&gt;There are also lots of examples (or “recipes”) and an &lt;a href="https://discordapp.com/channels/358204068931567619/358204068931567620" rel="noopener noreferrer"&gt;active community on Discourse&lt;/a&gt;. The charts are responsive and some have an API, which can be useful if you want to render your charts server-side. Not to mention, the Nivo library is free, open source, and actively maintained.&lt;/p&gt;

&lt;p&gt;Here’s a &lt;a href="https://stackblitz.com/edit/work-life-balance?file=src%2FWorkLifeBalance.js" rel="noopener noreferrer"&gt;live example&lt;/a&gt; of a chart I built using Nivo that shows how many hours I coded during and outside of my normal work hours during a week in December. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2pzeKONR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/xhxn5a0gjhvqkutkg90d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2pzeKONR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://thepracticaldev.s3.amazonaws.com/i/xhxn5a0gjhvqkutkg90d.png" alt="Work-life balance" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you’re interested in using Nivo for your own project, here’s a brief overview of how I built this chart.&lt;/p&gt;

&lt;p&gt;First, I chose to build my project on StackBlitz. I like to use StackBlitz to quickly prototype my data visualizations and see what they look like with actual data. I also like CodePen, CodeSandbox, and JSFiddle, but my favorite thing about StackBlitz is that it’s powered by Visual Studio Code, which is &lt;a href="https://www.software.com/review/why-you-should-switch-to-vs-code" rel="noopener noreferrer"&gt;my code editor of choice&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://stackblitz.com/edit/work-life-balance?" width="100%" height="500"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Next, I imported my dependencies. For this chart, I imported &lt;code&gt;@nivo/bar&lt;/code&gt; and Material, since I also used a few Material UI components.&lt;/p&gt;

&lt;p&gt;My data came from my &lt;a href="https://www.software.com/" rel="noopener noreferrer"&gt;Software.com&lt;/a&gt; plugin for VS Code (I’m on the team at &lt;em&gt;Software&lt;/em&gt; - check us out!). I stored it as a constant in its own file (&lt;code&gt;item.js&lt;/code&gt;) and imported it into my main file (&lt;code&gt;workLifeBalance.js&lt;/code&gt;). &lt;/p&gt;

&lt;p&gt;Since my data isn’t in the exact format that is required for the Nivo bar chart, I did some light array manipulation to map my data to the Nivo structure (see &lt;code&gt;data.json&lt;/code&gt; for that structure), which is also clearly documented on the Nivo site.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bsbkd5hnespjz9ysni0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0bsbkd5hnespjz9ysni0.png" alt="Work-life balance code" width="800" height="527"&gt;&lt;/a&gt;&lt;/p&gt;
Mapping data from our an API response to Nivo’s structure. Snippet using Carbon.



&lt;p&gt;The last step was to pass my data as a property into the custom bar chart component (&lt;code&gt;BarChart.js&lt;/code&gt;) I created using Nivo. If you want to reuse your Nivo charts but with different stylistic elements, you can also make those properties customizable. For instance, I made another chart that uses “grouped” instead of “stacked” bars, so I made that a variable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmv67zryhcnx0fp6ppxd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmv67zryhcnx0fp6ppxd.png" alt="Bar chart component" width="740" height="635"&gt;&lt;/a&gt;&lt;/p&gt;
Bar chart component. Snippet made using Carbon.



&lt;p&gt;You can add some fit and finish by customizing the Nivo theme. If you’re looking to customize the theme more than I did, see &lt;a href="https://github.com/plouc/nivo/blob/aa12d9d23e43344b05c4ea103177afbe2285b6ee/packages/core/src/theming/defaultTheme.js" rel="noopener noreferrer"&gt;this file&lt;/a&gt; in the Nivo GitHub repository.&lt;/p&gt;

&lt;p&gt;That’s it! If you’re interested in building your own Nivo chart, you can fork this chart and plug in your data. And if you want to see what your work-life balance and the rest of your coding data looks like, check out &lt;a href="https://www.software.com/" rel="noopener noreferrer"&gt;Software.com&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;What are your favorite chart libraries for React?&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
