<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Panos Voudouris on Medium]]></title>
        <description><![CDATA[Stories by Panos Voudouris on Medium]]></description>
        <link>https://medium.com/@panosvoudouris?source=rss-6ff53cf81da3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Panos Voudouris on Medium</title>
            <link>https://medium.com/@panosvoudouris?source=rss-6ff53cf81da3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 15 May 2026 08:33:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@panosvoudouris/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Analyzing Webpack bundles]]></title>
            <link>https://panosvoudouris.medium.com/analyzing-webpack-bundles-86460fa6953f?source=rss-6ff53cf81da3------2</link>
            <guid isPermaLink="false">https://medium.com/p/86460fa6953f</guid>
            <category><![CDATA[webpack]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <dc:creator><![CDATA[Panos Voudouris]]></dc:creator>
            <pubDate>Wed, 10 Feb 2021 10:07:47 GMT</pubDate>
            <atom:updated>2021-02-10T10:07:47.182Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever wondered what goes into a Webpack bundle? Why is it as big as it is? We were doing a bit of analysis lately on how to reduce the bundle size and there is a very handy little tool you can use to peek into the bundle: <a href="https://github.com/webpack-contrib/webpack-bundle-analyzer">webpack-bundle-analyzer</a>.</p><p>What it does is it gives you a very nice graphical representation of the items in the bundle. It is interactive as well so you can zoom in/out and see what gets what.</p><h3>Setup</h3><p>Setting it up in your repo is very simple. The docs are pretty comprehensive really but here’s a quick summary.</p><ol><li>add the package to your repo: npm install -D webpack-bundle-analyzer.</li><li>Add the the following options to your webpack script --profile —-json stats.json. This will output the stats to stats.json.</li><li>Run webpack-bundle-analyzer stats.json from the command line (or just add it as a script in your package.json.</li></ol><p>Here’s what your package.json will look like:</p><pre>&quot;build&quot;: &quot;webpack &lt;your options&gt; --profile --json &gt; stats.json&quot;,<br>&quot;build:analyze&quot;: &quot;npm run build &amp;&amp; npm run webpack-bundle-analyzer stats.json&quot;</pre><p>This way, you can just run npm run build:analyze which will build your app and then show the analyzer.</p><h3>Why is this useful</h3><p>If you need to look at why your bundle size is too big, this tool is a great start. In our case our external packages looked like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*MWLDpNDkq8TlIX3dLrj8tA.png" /></figure><p>This shows all the external packages we load into our project. One thing that stuck out was lodash. While we do use lodash, we do not use all of it, so this showed somewhere in our code we were importing the entire library vs just the bits we need. This is easy to miss if you import usingimport { map } from &#39;lodash&#39; vs import map from &#39;lodash/map&#39; .</p><p>A quick fix later our bundle is 500KB smaller:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vo8_Lk3fiOF0dT19NzDUYQ.png" /></figure><p>Not bad. Now, time to go through all the other stuff (I’m looking at you moment.js…).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=86460fa6953f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Retrofitting updates in React Storybook]]></title>
            <link>https://panosvoudouris.medium.com/retrofitting-updates-in-react-storybook-ba35dbda1a66?source=rss-6ff53cf81da3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ba35dbda1a66</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Panos Voudouris]]></dc:creator>
            <pubDate>Sat, 08 Jul 2017 10:32:20 GMT</pubDate>
            <atom:updated>2018-04-06T10:07:33.864Z</atom:updated>
            <content:encoded><![CDATA[<p>Continuing on from the post about <a href="https://medium.com/buildit/versioned-style-guides-with-react-storybook-aed6eebc585d">versioned Storybook releases</a>, I hit upon a simple problem: how do I fix a bug in previously released style guides? What do I mean by that? Well:</p><ol><li>Let’s say we have 10 versions of our style guide released as static Storybook builds.</li><li>These builds all use an addon (the <a href="https://github.com/buildit/storybook-addon-versions">versions</a> one in our case).</li><li>That the addon has a bug, which we have now fixed.</li><li>That’s all very nice and we can now release a new version of our style guide with includes the addon with the fix.</li><li>But what about the rest of the published guides with the buggy addon?</li></ol><p>On the face of it, it looks like we’d have to go back and rebuild every single version. Luckily, that is not the case. When you create a static Storybook build, you end up with something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*x4Yk6e9SkLBrNBtc4cNEOA.png" /><figcaption>Static Storybook build</figcaption></figure><p>What you’re getting in that build is, first the index.html which will load your style guide. That loads the static/manager.&lt;hash&gt;.bundle.js which is the main storybook interface, which in turns uses the iframe.html to display your stories. The stories are in static/preview.&lt;hash&gt;.bundle.js</p><p>As such, what we can do is replace index.html and static/manager... and that will have any updates we may have done in the packages and addons. However, since the configuration (what goes in .storybook/config.js) is bundled with the stories in the preview file, we cannot make any changes of that sort.</p><p>Overall, a nice thing to know as we can now retrofit updates to storybook and its addons without having to checkout and rebuild each older version of our style guide. Obviously there is the caveat of making changes to an addon that are incompatible with the stories, plus the usual dangers of retrofitting stuff to released software. But it can still be helpful to know all the above, when it comes to releasing bug fixes to our style guide. Hope this helps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ba35dbda1a66" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Versioned style guides with React Storybook]]></title>
            <link>https://panosvoudouris.medium.com/versioned-style-guides-with-react-storybook-aed6eebc585d?source=rss-6ff53cf81da3------2</link>
            <guid isPermaLink="false">https://medium.com/p/aed6eebc585d</guid>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Panos Voudouris]]></dc:creator>
            <pubDate>Mon, 26 Jun 2017 21:07:59 GMT</pubDate>
            <atom:updated>2017-07-08T10:28:20.731Z</atom:updated>
            <content:encoded><![CDATA[<p>A while ago I wrote about <a href="https://medium.com/buildit/using-react-within-a-design-system-73d4bb0cc822">how we are using Storybook to generate a living style guide</a>, for use within a design system. While continuing work on a living style guide, we encountered the need to be able to see the various versions of each component in the UI library we were creating. As such, we created a new add-on for just that: <a href="https://github.com/buildit/storybook-addon-versions">versions</a>.</p><h3>Versions</h3><p>Obviously, we are using React Storybook for our living style guide. I won’t bore you with what it can or cannot do yet again, however one of the important things it does is that we can build a static version of it. As such, when you commit your code (or merge to master or finish your sprint, whatever your process is), your build pipeline can run a simple npm script to generate a static version of Storybook. Therefore, you can then automatically deploy that to a host of your choice and let anyone see what the current state of your component library is. Since all this is automated, it is easy to end up with a bunch of builds for your UI library hosted together. So we may end-up with a folder structure that perhaps looks like this:</p><pre>- static-storybook<br>|-- 0.2.4<br>|-- 0.2.5<br>|-- 0.2.6<br>|-- 0.3.0</pre><p>So now we can navigate to our different storybook folders and see what each different version looks like, say <a href="http://styleguides/0.2.5/"><em>http://styleguides/0.2.5/</em></a><em> </em>for version 0.2.5. However, there is no way to actually do that from within Storybook. To solve this, we created the <a href="https://github.com/buildit/storybook-addon-versions">versions</a> add-on. What this does is that it adds a new panel showing you the various versions available. For the time being, the way the plugin works is that it expects to find a JSON file in the root of the host, giving info about what versions are installed and what the path pattern is (which is a regex, which is black magic).</p><pre>{<br>  &quot;storybook&quot;: {<br>    &quot;versions&quot;: [<br>      &quot;0.2.4&quot;,<br>      &quot;0.2.5&quot;,<br>      &quot;0.2.6&quot;,<br>      &quot;0.3.0&quot;<br>    ],<br>    &quot;regex&quot;: &quot;\/([^\/]+?)\/?$&quot;<br>  }<br>}</pre><p>See the <a href="https://github.com/buildit/storybook-addon-versions/blob/master/README.md">documentation</a> for more information on how to set it up.</p><p>With it all setup then, the add-on is installed and the config available. Here is what it looks like. In the example below we have a button component with the style changing between different versions (we are using the info add-on to add the documentation around the component).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*UT0Fv4kyI3kNGC7YuZsPwA.gif" /><figcaption>Navigating different versions of the style guide</figcaption></figure><p>Nice and simple then, and we can now travel back and forth in versions, seeing how a component evolved. Add the ability to comment with <a href="https://github.com/buildit/storybook-addon-blabbr">blabbr</a> and you now have a living style guide, showing you all the different versions of your components and all the discussions around them.</p><p>Additionally, there is a “dev” checkbox, which shows a “local dev” button. This is handy as when you are running your Storybook locally as a developer, you will want to see what the code you are writing does. However, you can still navigate to the other versions, living on another host, as long as your config is valid. But then, once you go to the official version, how do you go back to your local dev version? Just enable the dev mode and the flag travels across the versions (as URL params, like all other Storybook options) and you can go back &amp; forth.</p><p>Simple. Hope it helps. :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aed6eebc585d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[First attempt at DesOps]]></title>
            <link>https://panosvoudouris.medium.com/first-attempt-at-desops-8a9660c37634?source=rss-6ff53cf81da3------2</link>
            <guid isPermaLink="false">https://medium.com/p/8a9660c37634</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[desops]]></category>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Panos Voudouris]]></dc:creator>
            <pubDate>Sun, 12 Mar 2017 13:34:35 GMT</pubDate>
            <atom:updated>2017-07-08T10:29:04.869Z</atom:updated>
            <content:encoded><![CDATA[<p>To begin, I don’t want to appropriate DesOps in any way and perhaps what I’m about to talk about is not exactly about that. But what I am going to talk about are some first steps we are taking with a client, demonstrating how modern tooling can take them a few steps closer to a Design System.</p><p>Let’s start with a bit of history. In the beginning there was Sketch (bear with me in this first section). Actually probably Photoshop. Or some other tool like that. You probably know the story, a designer (and I will use the term loosely here, can be UX, can be UI, can be visual designer, service designer or even a dev who paid the $99 to get Sketch) spends quite a bit of time in Sketch creating some super cool assets, then finally hits the export button. A PDF is generated, <em>GreatDesign.pdf</em>, it is promptly emailed to the development team and everyone is happy. Eventually some changes are done in the next sprint or ten by said designer (or maybe another one), another PDF is generated, <em>GreatDesign_v2.pdf</em>, repeat the emailing and so on. Then some more changes are done, because some things were forgotten, and, finally, we have the final version of the design. So now we have <em>GreatDesign_final.pdf.</em> And that’s it. Or is it? Wait, we forgot a few things so, finally, <em>finally</em>, we have <em>GreatDesign_final_final.pdf</em>. Or do we? Because there is also a <em>GreatDesign_final_final(1).pdf</em>. Oh dear. Oh dear. Oh dear indeed.</p><p>Ok enough with the third rate sarcasm! Things have moved on a bit from the above, there’s stuff like Axure, Zeplin, InDesign and a few more that sprang up while you are reading this. At least your designs are organised; developers have a link to go get the latest; we can all agree what the right version is. You can even get some code samples or even fully working prototypes (the value of which, when it comes to how usable the code is, we can debate another time). Let’s have a brief look at what the workflow may look like using these tools to create a couple of apps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/551/1*XNTpYJaNpYmoOB-eGDokvQ.png" /><figcaption>Figure 1: From Sketch to Apps</figcaption></figure><p>I’ll assume some basic knowledge of what Sketch does so I’ll concentrate on the rest. You could argue that the PDF is now obsolete and there are tools like Zeplin. However, with Zeplin while we may get some measurements on how things should be laid out and also get some autogenerated CSS, we still need to manually copy and paste all that into our code. Additionally, Zeplin will not tell us how the responsive layout should work, what happens in the in between states and other things like that. It is just a nicer way of <em>handing over</em> from design to dev. As such, there is a whole raft of things that are left open to interpretation, plus a lot more that will just fall through the cracks and not surface till QA has a go at our app. Still, it is an improvement as we now have an easier way to get to the design vs trawling emails and PDFs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*fUWHiDc3T2IZzr8sTqkcKg.png" /><figcaption>Figure 2: A solid line denotes “automation” while the dotted line is manual work</figcaption></figure><p>Let’s see where we are now. It is easy to find the designs but what about the code? Right now, the only way to see what assets are there is to look at the code, the actual apps, and then take screenshots to catalogue them. Not that easy. Now, in our particular case these happen to be React apps. As such we can do something very easy: use <a href="https://getstorybook.io/">Storybook</a>. I’ve written a bit about the React toolchain <a href="https://medium.com/buildit/using-react-within-a-design-system-73d4bb0cc822">here</a> but, in a nutshell, Storybook will visualise our components, our actual React components, without having to run the app. As such we can now <em>catalogue</em> our components.</p><p>Let’s see those apps then. We’ve taken the example of a bank on this occasion and we made a couple of simple apps: one to see your account statements and another one to pay someone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OUqgXg--6b3tjcWhQ7h0Vg.png" /></figure><p>Looking at them (please ignore the garish design, this was a POC made to look a bit off on purpose), we quickly see that we have a couple of common things: a header and a footer. In fact we probably have three, a header, a footer and the buttons. Or maybe we have a few more, like section titles and so on, depending how we break them down (atomic design anyone?). We may also note that the buttons are different: one app has square buttons, the other rounded ones. This is a reality (not for a button specifically but for consistency overall) for many organisations where designs have to be translated to code again and again. The same design ends up slightly different in various parts of the system and, sometimes, even the design files end up diverging.</p><p>As such, the next step is obvious: create a component library! I say obvious but it is surprising how many organisations actually do <em>not</em> have one. So let’s see how things will look with a component library.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*s9QNEGYb6DM-RgdPH0KDuA.png" /><figcaption>Figure 3: Introducing the UI component library</figcaption></figure><p>As such, we now have a library of common components. We can update them in one place instead of two (or three, or ten, or fifty). Not only that, but notice how we have gone from <em>two manual updates</em> (copy/paste) in the first diagram, to <em>one automated export plus two manual updates</em> in the second diagram, to <em>three automated updates and one manual action</em> in this. We are now automating more things than we do manually. As such we are now close to using the automation capabilities of our CI environment <em>as part of the design process.</em> For now, our library is packaged and distributed and any updates end up in the apps automatically.</p><p>Additionally, we can use Storybook in our library to see the components, plus use the rest of the capabilities that come with it: interacting, testing, commenting (again, see <a href="https://medium.com/buildit/using-react-within-a-design-system-73d4bb0cc822">this</a> on how Storybook helps with all that).</p><p>What we now have is a sort of living style guide within the development domain. However that still leaves the rest of the process outside. In the video above, the last thing we see is someone commenting that the colours are all wrong. What next?</p><p>As it is now, a designer would have to make a change in Sketch/Zeplin. The developers would then have to deconstruct what they see, interpret it and write the code for it. That bit in the middle, the “interpret”, is where mistakes happen. Let’s see how we can improve on that.</p><p>Enter <a href="https://brand.ai/">Brand.ai</a>. The first thing Brand.ai does is to give us a Sketch plugin. As such we can now export from Sketch to brand.ai components, styles, images, etc. We can also upload assets direct to Brand.ai. For example, we can have all our logos and colours for the brand identity. We also get bidirectional updates: update something in Brand.ai and the Sketch file gets updated too.</p><p>The next important thing it has is an API to extract that info. Therefore, within the build process of our app, we can hit that URL, download the latest assets and use them. Here’s what our system now looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*uNpCubsBc1qlKtz79ny1lA.png" /><figcaption>Figure 4: Introducing Brand.ai</figcaption></figure><p>Notice how we no longer have any manual steps (by which I mean copy and paste type stuff). We have linked design into our CI environment. Finally, to enhance collaboration and distribution of information, we can hook into Slack and get notifications. When updates occur we get notified that a new version exists. When we comment on <a href="https://github.com/buildit/blabbr">blabbr</a>, we get notifications on Slack. Here’s what it actually looks like when working with it:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_KXV-Pb-r28%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_KXV-Pb-r28&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_KXV-Pb-r28%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b66f5686f34000fb125c92d8c1d78fb4/href">https://medium.com/media/b66f5686f34000fb125c92d8c1d78fb4/href</a></iframe><p>All the above show us is how we now can update our UI library, automatically, by initiating a change in Sketch. Once we can do that we are ready to update the actual apps as well. As such, we now have end to end flow, from <em>design</em> to <em>production</em>. That last word, “production” is the most significant one as that is what our customers get to see. It is important to realise that in our diagram above, once we hit the app box (App 1, App 2, etc) what I mean is that we are hitting the point where the app is ready to be deployed to a live environment.</p><p>Hold on. You may ask that its probably a bit too much trouble all this. We’ve added yet more tools, changed a lot in our environments, our processes, how people work and all that to get rid of that manual step in Figure 2. Yes we have. Let’s have a look at that diagram again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*s9QNEGYb6DM-RgdPH0KDuA.png" /></figure><p>That is a nice little example of a very simple system. The reality is that for starters, there is another line from Zeplin to each of the apps. The reason? Our UI library may have a lot of components but it will not have all of them. There are always app specific things and, in any case, the views are owned by the app. These need to exist as code too. So our diagram is now this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*P74yFJ3SKw-e_suzve5JyA.png" /></figure><p>This also covers just one platform. Most places will have a mobile platform, web and web apps too. You may have a few dozen apps per platform too. As such we would be looking at something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*C--HFftPbKu7QHyA-n_0zw.png" /><figcaption>A lot of manual work here</figcaption></figure><p>That is a lot of manual work, work that will inevitably go wrong, things will get misinterpreted and as such quality and consistency will rapidly decline. It is also interesting to see that since the jump from Zeplin to the library is manual, the automation to the right of each library will simply amplify any errors. Here is the alternative:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*ZNPnt5EJaqgTC-wnP-mqAg.png" /><figcaption>Still complicated but at least everything is automated</figcaption></figure><p>Still a lot of lines but at least they’re all linked. So any mistakes can be rectified very quickly, any updates too and we are always taking advantage of all the CI tooling. If we collapse this back to the lines via the libraries only this is what we have.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*HqY940dlLm0DLJw46ILj5Q.png" /></figure><p>You’ll notice I rearranged the library boxes a bit. We now have a web (ie HTML/CSS) library, a web app (ie some JS framework like React) and mobile. Imagine then how we can start sharing some styles between the different components. In the end the top two are both running in a browser, as such with a bit of clever thinking we can start sharing CSS between them. In fact we could share CSS with our mobile components too, depending on our technology choices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*xPJBTGsyD8aUPdm7ox6PvQ.png" /></figure><p>That may start looking complicated quickly. However, the importance of it is that we have now automated changes. We have also reduced the number of sources. Instead of having a plethora of styleguides, PDFs, Zeplin pages and the rest we have a living styleguide. This gives us access to the actual components that are going to be deployed to production, as such we no longer have to make assumptions about what will be delivered, we are looking at it.</p><p>We can also start prototyping without having to use off colours or fake components. We can do that using actual components and styles. The importance of this cannot be underestimated. How many times have we found designs, styles and code that were supposed to be “just a throwaway POC” in production? I’ve certainly found them myself, I even put them there on occasion. In fact, let’s have a look at how this looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*plG4Dq3SGaA7sgYtzVjO5w.png" /></figure><p>We can see then how a working prototype can now be created using our existing components. We can also see what components are available and thus make some more informed decisions, as opposed to a prototype coming up with more and more components that are just ever so slightly different to what is in the library, this either increasing the number of components or ending up using components that do not do exactly what is needed.</p><p>We can keep going and start adding more concepts, showing how testing fits in, eg kicking off accessibility testing well before the app is created, how copywriters can try new copy using the living style guides, et cetera, etc…</p><p>People do not make mistakes on purpose. They do not set off to write bad code. They do not start a new UI kit just because they want to play or introduce inconsistency. In the vast majority of cases, these things happen simply because they just want to get on with the job of building something vs trying to find what to use to build it. In some cases it is even just down to internal barriers, perhaps a department not sharing their designs &amp; code or just IT security making it impossible to share a PDF or use a hosted service. So people find workarounds hoping they will do something good.</p><p>What we are trying in this particular instance is to:</p><ul><li>make collaboration as easy and smooth as possible</li><li>automate as many steps as possible to reduce mistakes and inconsistencies</li><li>make as much as possible visible for others to find, thus encouraging reuse and eliminating waste</li></ul><p>I have probably over-simplified a few things. I’ve also used certain technologies and tools in the above example, but that is purely as these are the things we are currently using. That doesn’t mean that what we are doing is limited to just those. In any case, whatever we choose today will probably be gone in 3 years and there is something new starting as I type this. What matters are the principles that drive a design system as these are what DesOps need to apply and support. Hopefully our little example here can help demonstrate some of the things we can do, in order to get everyone working closer and better together.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8a9660c37634" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using React within a Design System]]></title>
            <link>https://panosvoudouris.medium.com/using-react-within-a-design-system-73d4bb0cc822?source=rss-6ff53cf81da3------2</link>
            <guid isPermaLink="false">https://medium.com/p/73d4bb0cc822</guid>
            <category><![CDATA[design-systems]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[storybook]]></category>
            <category><![CDATA[atomic-design]]></category>
            <dc:creator><![CDATA[Panos Voudouris]]></dc:creator>
            <pubDate>Thu, 16 Feb 2017 09:36:29 GMT</pubDate>
            <atom:updated>2017-07-08T10:29:16.150Z</atom:updated>
            <content:encoded><![CDATA[<p>You’ve probably have heard about concepts like <a href="https://medium.com/buildit/design-systems-wtf-42956f673250#.nqxc52l7e">Design Systems</a> and <a href="https://medium.com/buildit/our-atomic-journey-so-far-b333c98b1d3f#.ltsps1irq">Atomic Design</a> so far (if you haven’t please do read those two articles as some prior knowledge is assumed). You’ve read about all the goodness they can bring to teams building digital experiences and how it can bring designers and developers together, working in harmony, iterating quickly and getting awesome apps to their customers. But what does it actually mean, if you’re on the, let’s face it, receiving end of it as a developer? What can we, the developers, coders and the people that actually build the “stuff”, do to both be part of a design system, plus make both our <em>and</em> our non-coder colleagues’ lives easier?</p><p>Let’s look at some of the tools we are employing to help get things done.</p><h3>The Problem</h3><p>What is the problem? A “simple” one to express:</p><p><em>How do I, as the person that has to write the code, can collaborate with the designer and/or UX person that dreams up whatever it is I build?</em></p><p>There are buttons, drop-downs, forms, animations and what-not that we have to build, day-in, day-out to create the various apps we put out for our customers to use. The traditional approach so far was that some UX person does what a UX person does, then a UI designer does what a UI designer does and eventually a developer ends up with some PDF or PSD file that has a breakdown of the, let’s say, address details form to decipher and build. By the time the code is done, the UI/UX people have moved on and the developer has a raft of unanswered answers:</p><blockquote>- “John Smith” fits nicely in that box but what about “Maria de Los Angeles Hernandez”?</blockquote><blockquote>- …so the form breaks to the smaller layout at 800px while the header does so at 750px…?</blockquote><p>In any case, these questions are likely not to even be asked until QA has picked this up, which in some cases can be weeks after the code was done. Where I’m getting at is this: by the time the issues are done, nobody knows where the design came from, who coded it and why it was even required. So we might as well release it, because the boss is asking for something, <em>anything</em>, to be released. The big red deploy button is pressed and…everyone is disappointed. The customer, the designers, the developers, the CEO. Predictably, it is <em>your</em> fault for not implementing the glossy design properly.</p><p>So what can we do? Let’s look at a few <em>actual</em> things then that we can do today.</p><h3>React + Atomic Design = UI Library</h3><p>Hopefully you know what <a href="https://facebook.github.io/react/">React</a> is (again, if not, look it up, it’s great). I’m using React here simply because this is what we used for this particular project. There area myriad other things you can use in Javascript to get the same effect. Overall there are tons of things that React lets you do, but the one thing it does fit in with here is this: it is really easy to create UI component libraries, <a href="https://medium.com/@yejodido/atomic-components-managing-dynamic-react-components-using-atomic-design-part-1-5f07451f261f#.i5hgc3oiq">based on a Atomic Design principles</a>, that can be reused and shared between projects.</p><p>So, step one, we are using React. It makes it easy for the developers to keep components nice and small and atomic, which solves <em>our</em> immediate problem, as developers, on how we organise our code. That still leaves the rest of the issues though. Let’s how we can solve the next one: engaging with UX &amp; designers.</p><h3>Storybook</h3><p>Enter <a href="https://getstorybook.io/">Storybook</a>. Storybook is a great tool for showing our React components. At a basic level it is just a React application itself which displays our React components. The way it works is by writing “stories” that describe how the components are to be displayed and setup. This is similar to writing a unit test and the syntax is <a href="https://getstorybook.io/docs/react-storybook/basics/writing-stories">very simple</a>. Here’s a one line explanation from the docs:</p><blockquote>Technically, a story is a function that returns a React element.</blockquote><p>If we start to look at what it gives a developer, on their local machine, it is this: the ability to visualise the React components without having to run the actual application being developed. The advantage of this is that we can now view our component, <em>interact</em> with it (after all, this is a React app using our React components) and see very quickly what it is we are developing. This cannot be underestimated. The alternative is to either run the actual app, mocking the flow to the point where we can see our new component, or to build some artificial page showing the components. This is what it actually looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sPBy5JV-ditth8hWd0af3A.png" /><figcaption>Basic Storybook layout</figcaption></figure><p>As you can see, there is a simple navigation on the left, where we browse the “stories” per component. On the top right we see the actual components; in the bottom right there are a number of plug-in panels we can have, which can do various things (more on that in a bit).</p><p>So far pretty sparse. But wait, what we can do is show our components, from Atoms all the way to Pages (or Environments, depending on your naming convention) <em>live</em>, showing changes <em>as we code</em>. Let’s see how that works:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8T0opytn0oYuEMpd8PRTsw.gif" /><figcaption>Storybook demo (from getstorybook.io)</figcaption></figure><p>So now, not only can <em>we</em> see what it is we are coding, but the designer, the UXer, the product owner, QA or anyone else you may be interacting with can see what you are talking/asking/working/feeling-good about. So we have just found a way to quickly demo our code, discuss, review, update, discuss, review, update…neat.</p><p>But wait. That’s all very nice but isn’t this limited just to my machine? No it is not, Storybook can build a static site that can be hosted wherever we like. As such, we can setup our CI tools to build a new site and push it to whatever hosting environment we use, ready for everyone to see. And there is our demo, automatically built, every time we commit code to our master branch (or however else we want this setup). So now we have the attention of the wider team. Great, onwards!</p><h3>Plugins</h3><p>We’ve seen then how Storybook can let us code and see the results on the fly. But what about the static site and what other things we can we do with it? There are a number of plugins that Storybook has which we are going to use to enhance the experience.</p><h4>Full screen</h4><p>That is actually not a plugin but part of the built-in Storybook functionality. A keyboard shortcut (also available on the startup config) lets you get rid of the UI and show just the component. As such the user can then test the responsive UI for various screen sizes and devices.</p><h4>Knobs</h4><p>First is the <a href="https://github.com/storybooks/storybook-addon-knobs">knobs</a> plugin, which allows us to play with the component properties. This lets us modify component properties using a number of simple controls like text boxes, drop-down lists and check boxes without having to manually modify the story. Here’s what it looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZkAQAXd6R2nndd8rGANYhA.gif" /><figcaption>Storybook knobs plugin</figcaption></figure><p>If we were to write the code for the component above in our story it would probably be like this for the final state:</p><blockquote>&lt;Button size=’large’&gt;This is a long label&lt;/Button&gt;</blockquote><p>To get the different states we would normally create different stories. Any changes would mean a rebuild. However, with the knobs plugin we can just have one story with a number of controls instead. Not only this is faster but it allows two things:</p><ol><li>when working with a UX/UI person we can quickly try different parameters to see how the control responds.</li><li>when statically hosted, non-developers (e.g. QA) can interact with the components and try the various parameters.</li></ol><h4><strong>Checkpoint</strong></h4><p>So far we have a static site, which anyone (whether involved in the projector not) can access and:</p><ul><li>see what components are available</li><li>interact with the components properties and <em>test</em> them</li><li>test how responsive they are</li></ul><h4>Info</h4><p>All the above is great but, wouldn’t it be greater if we could add some context and information on each component? This is what our next plugin, <a href="https://github.com/storybooks/react-storybook-addon-info">storybook-addon-info</a>, does. It allows a developer (or whoever is writing the story) to add some information about the component plus it autogenerates a basic usage info and <a href="https://facebook.github.io/react/docs/typechecking-with-proptypes.html">PropType</a> documentation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uShRjUlALIos3qs3weWtSg.png" /></figure><p>The example above shows the component and usage <em>inline</em> (the actual button is rendered at the top, under the heading). The plugin can be configured to show the info on a separate page. That has its advantages, as for complicated components it would make it clearer to inspect the component. The original plugin, linked above, will only allow some basic text info to be added. We have <a href="https://github.com/panosvoudouris/react-storybook-addon-info">forked the plugin</a> to allow any valid React node to be added, as such the user can add complex HTML documentation, including links to other sites and documents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hM93Z-KILeo803DK5SMD-A.png" /></figure><p>As you can see above, there is some basic text, a link and an image. Therefore, we can now add complete documentation on how to use the component, links to the code repository, related information and design documentation plus include screenshots, examples, etc.</p><h4>Blabbr</h4><p>So far we’ve seen how we can use Storybook to</p><ul><li>view our components</li><li>interact with them</li><li>demonstrate and make them accessible to others</li><li>test them</li><li>share some information about them.</li></ul><p>This is all great but is still one way communication. The next step we want to take is allow people to <em>discuss</em> what they are looking at. There is already a solution for this, <a href="https://hub.getstorybook.io/">Storybook Hub</a>. The problem we are now facing though this: if we are in an environment where we cannot use github or have code hosted externally we need to have our own hosted solution. This is quite common in large organisations. So for such environments we created a stand-alone solution: <a href="https://github.com/buildit/storybook-addon-blabbr">blabbr</a>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUEjjkIUdNZg&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUEjjkIUdNZg%3Ffeature%3Doembed&amp;type=text%2Fhtml&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/27d43d20216d2b74bd8624e51b860f8b/href">https://medium.com/media/27d43d20216d2b74bd8624e51b860f8b/href</a></iframe><p>Blabbr is a plugin that adds a commenting facility in a new plugin panel. The concept is that a user will sign-up and then can post comments for everyone to see. Pretty simple to begin with but great for spurring discussion around components. Currently we are basing this on <a href="http://couchdb.apache.org/">CouchDB</a> (using <a href="https://pouchdb.com/">PouchDB</a> to provide offline capability). Why CouchDB? Because we had to start with something! Eventually we aim to provide a number of different solution.</p><p>For the time being, blabbr is still in alpha. Sign-up is essentially whatever the user wants to use. We ask for a nickname and email simply to tie the comment to a particular user. “Login” is just an entry in the browser’s local storage. Comments are just text. Tying comments to a component version is yet to come. But <a href="https://github.com/buildit/storybook-addon-blabbr/issues">new features and ideas are there</a>, we are working on a roadmap to effectively make this DB agnostic and provide a slick user experience, while at the same time providing a valuable collaboration facility for everyone involved in the creation of the app.</p><h3>Final Thoughts</h3><p>The above have, so far, helped us in tackling some of the collaboration issues we have encountered. Developers, UX and design now have a better set of tools to create a living style guide and work within a design system, to be able to provide feedback much quicker and to collaborate in an Agile environment.</p><p>In the end, the actual tools do not matter that much, it is the principles, the features, the attributes of whatever it is we may be using that make up the solution. Hopefully, though, I have given you a small set of tools to tackle some of the issues arising in the all-important team collaboration arena. Good luck! :-)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=73d4bb0cc822" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>