<?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 Barney Atkins on Medium]]></title>
        <description><![CDATA[Stories by Barney Atkins on Medium]]></description>
        <link>https://medium.com/@barneyatkins?source=rss-989cea540270------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*llW7We5Bxf0gpKFLA7mJ6g.jpeg</url>
            <title>Stories by Barney Atkins on Medium</title>
            <link>https://medium.com/@barneyatkins?source=rss-989cea540270------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:17:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@barneyatkins/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[Make a Sidebar for Your Website: The Easy Way — HTML5 CSS3 VanillaJS]]></title>
            <link>https://medium.com/@barneyatkins/make-a-sidebar-for-your-website-the-easy-way-html5-css3-vanillajs-eccbb4d0cff6?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/eccbb4d0cff6</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[user-experience]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Mon, 24 Sep 2018 09:37:39 GMT</pubDate>
            <atom:updated>2024-11-09T16:30:46.860Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mzgXjFq8pRHUhij8" /><figcaption>Photo by <a href="https://unsplash.com/@jeztimms?utm_source=medium&amp;utm_medium=referral">Jez Timms</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Just coming back from the last course I gave and I was asked how to make a sidebar for a website, so here it is.</p><p>A few things to keep in mind:</p><ul><li>3 lines of Vanilla Javascript (no library, no ugly stuff)</li><li>An HTML template made of three nodes only</li><li>No more than 35 lines of CSS (you could reduce drastically)</li><li>There really is nothing hard</li></ul><p>I’ll provide you with interactive demonstrations and the whole code, so that you can implement one very simply.</p><h3>How it will look</h3><p>First variant:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fembed%2Fpreview%2FyxGwbm%3Fheight%3D600%26slug-hash%3DyxGwbm%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fpen%2FyxGwbm&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2056496.yxGwbm.small.38e8959d-7d1c-4dff-b06d-a4df0595e05c.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/3adbebb05cc3996068702068b669c02a/href">https://medium.com/media/3adbebb05cc3996068702068b669c02a/href</a></iframe><p>Second variant:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fembed%2Fpreview%2FRYEdLQ%3Fheight%3D600%26slug-hash%3DRYEdLQ%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fpen%2FRYEdLQ&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2056496.RYEdLQ.small.fa2ec1ce-1d80-4117-9cec-2b10c53cad6c.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b3b502305121dcbeaa0ef4369b5c428e/href">https://medium.com/media/b3b502305121dcbeaa0ef4369b5c428e/href</a></iframe><p>It’s all very simple to customize and tailor to your needs.</p><h3>How it works</h3><p><strong>First, you need to define what the HTML looks like.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f009c811072f61c8ba041011955dafa2/href">https://medium.com/media/f009c811072f61c8ba041011955dafa2/href</a></iframe><p>Here’s my thought on it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ckUh0JVe5hn0ro36pN6XgA.png" /></figure><p>That’s all.</p><p>In my opinion, all you need actually is a node for the sidebar, a node for the content next to / behind it and a button that will tell whether the sidebar is opened or not.</p><p><strong>Then, you need to use CSS to have it working without interactions first.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b70806a5a1ff7915650aa456bff750fc/href">https://medium.com/media/b70806a5a1ff7915650aa456bff750fc/href</a></iframe><p>The crucial parts are:</p><ul><li>Make &lt;html /&gt; and &lt;body /&gt; take the whole screen size. The user will never really scroll through the body, he will scroll through either the sidebar or the content individually.</li><li>Knowing that, make the sidebar and the content fill the full height and adjust when there’s an overflow using overflow: auto .</li><li>Using float:left will make the sidebar and the content align on the same line, one next to each other (assuming the screen is wide enough).</li><li>Define fixed sizes for the sidebar and the content, depending on the state of the sidebar ( collapsed or not) using the + CSS selector which allows to select what comes after the sidebar node.</li><li>Tweak the transition duration to make the whole thing smooth for your visitors.</li></ul><p><strong>Eventually, make it interactive using Vanilla Javascript.</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc79b3755133d28f3bcc0821bd607913/href">https://medium.com/media/cc79b3755133d28f3bcc0821bd607913/href</a></iframe><p>The thing here is to toggle the collapsed class on the sidebar when the button is clicked.</p><h3>Further possibilities</h3><p>I think my solution is great as it can be easily extended to other kinds of sidebar without hard restructuration (wait, is there any big structure ?).</p><p>This is how you could take it to the next level:</p><ul><li>Make two sidebars : one on the left and one on the right.</li><li>Use 3-dimensional effects to make your sidebar appear fancier than it is already.</li><li>Take some Dribbble shots to reproduce. So that if you feel out of aesthetics, professionals got it done for free without you asking.</li><li>Make it work without Javascript. Hint: Use two-states nodes (check-boxes, radios, etc).</li></ul><h3>Thanks for reading</h3><p>I’ll be glad answering your questions and potentially working with you 😃</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IHYPNFVub7aHBjJT" /><figcaption>“white ceramic teacup filled with red liquid” by <a href="https://unsplash.com/@erol?utm_source=medium&amp;utm_medium=referral">Erol Ahmed</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eccbb4d0cff6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visual Studio Code : Auto-Compile Less To CSS On Save Using Gulp]]></title>
            <link>https://itnext.io/visual-studio-code-auto-compile-less-to-css-on-save-using-gulp-2fa15bc7d954?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fa15bc7d954</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[time-management]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Wed, 22 Aug 2018 09:01:01 GMT</pubDate>
            <atom:updated>2024-11-09T16:30:31.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*G0oV0Pt-UztcvWKK" /><figcaption>Photo by <a href="https://unsplash.com/@nate_dumlao?utm_source=medium&amp;utm_medium=referral">Nathan Dumlao</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We are getting faster at developing interfaces, using on-save-compilation for compiling Less to CSS.</p><p>No editor plugin. No dirty trick. No hard code to understand.</p><p>I will provide you with a clean Javascript snippet, and easy steps to get your setup done in seconds.</p><h3>Setup</h3><p>You need:</p><ul><li><strong>A</strong> <strong>project directory</strong>: mkdir project</li><li><strong>Gulp:</strong></li></ul><p>Both globally and in your project:</p><p>npm install -g gulp or yarn global add gulp</p><p>cd project</p><p>npm install gulp or yarn add gulp</p><ul><li><strong>Gulp-Less: </strong>In your project only</li></ul><p>cd project</p><p>npm install gulp-less or yarn add gulp-less</p><p>You’re done. Onward.</p><h3>Short Explanations</h3><p><strong>Gulp </strong>is a Javascript task runner that lets you automate redundant tasks.</p><p>It has a lot of built-in features that are really useful.</p><p>Among those, we’ll be using the file watcher which lets us execute a task when a file changes.</p><p><strong>Gulp-Less </strong>is a Gulp plugin made specifically for compiling Less files to CSS. It provides us with a Less compiler.</p><h3>Working Snippet</h3><p><em>Which you can easily customize to fit your needs.</em></p><p><strong>First, </strong>create a file at the root of your project directory and name it gulpfile.js .</p><p>It is how Gulp expects you to organize your tasks, so don’t name it differently.</p><p><strong>Then, </strong>copy-paste this snippet into gulpfile.js:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d64ca8467d9509b79cbd4d950b1cbf3c/href">https://medium.com/media/d64ca8467d9509b79cbd4d950b1cbf3c/href</a></iframe><p><strong>Finally, </strong>open a terminal (either using cmd or Ctrl + Shift + ù in VSCode) and run this command :</p><p>gulp default</p><p><strong>You’re done.</strong></p><p>Every time you’ll modify a Less file located in your srcDir , it will compile it and generate the corresponding CSS file located in your dstDir .</p><p><em>By “modify a file” I mean using </em><em>Ctrl + S or </em><em>File &gt; Save</em></p><h3>Further Details: How Does It Work ?</h3><p><strong>First, </strong>we’re just importing two modules: gulp | gulp-less .</p><p><strong>Then, </strong>we define where our Less files are located and where we want the CSS files to be generated.</p><p>Line 9 : We’re defining a Gulp task named “less”, and defined by a custom function of ours.</p><p>Line 11 : We order Gulp to take all the .less files in srcDir as source. ( using *.less )</p><p>Line 12 : We order Gulp to take all those files into the less function (using pipe) which comes from the gulp-less module. This function will just compile each file to their CSS counterpart.</p><p>Line 13 : We order Gulp to take all the dynamically created CSS files from their Less sources and save them into srcDir .</p><p><strong>Yet, this task by itself alone does nothing.</strong> It’s just a task defined somewhere which alone won’t react to file changes.</p><p><strong>That’s why:</strong></p><p>Line 17: We tell Gulp to execute the less task when a file located in srcDir changes.</p><p><strong>Finally,</strong> running gulp default will run the default task which itself runs the less task each time a file changes.</p><h3><strong>Going Further</strong></h3><p>At first, I didn’t want to start learning yet another tech in the ocean but boy, (believe me) it’s worth the time invested.</p><p>Gulp lets you automate tons of things, like :</p><ul><li>File Minification / Beautification.</li><li>Auto prefixing for browser compatibility.</li><li>Browser refresh on save.</li><li>Many other time consuming tasks you’d better let Gulp handle for you 😃</li></ul><p>Also, VSCode has a Tasks tab from which you can run gulp tasks. That’s also why gulpfile.js naming is important.</p><p>Even further, VSCode lets you define keyboard shortcuts for running tasks so that typing a command or clicking on Tasks won’t be a pain for you anymore.</p><p><a href="https://code.visualstudio.com/docs/editor/tasks#_binding-keyboard-shortcuts-to-tasks">See this link for running tasks using keyboard shortcuts</a></p><blockquote>Note that running gulp default will keep running and watching files until you close the editor / command-line interpreter.</blockquote><h3>Thanks for reading</h3><p>Making my best to provide you with valuable content every week of this year.</p><p>I’d definitely appreciate some 50 claps 👼</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ba3PsUK8YXPcYJBs" /><figcaption>“Cappuccino in a white mug with white foam art on a wooden table” by <a href="https://unsplash.com/@takeshi2?utm_source=medium&amp;utm_medium=referral">wu yi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fa15bc7d954" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/visual-studio-code-auto-compile-less-to-css-on-save-using-gulp-2fa15bc7d954">Visual Studio Code : Auto-Compile Less To CSS On Save Using Gulp</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Track custom events on your website using Google Analytics]]></title>
            <link>https://itnext.io/track-custom-events-on-your-website-using-google-analytics-cc32ef5c608b?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc32ef5c608b</guid>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[google-analytics]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Thu, 09 Aug 2018 13:22:57 GMT</pubDate>
            <atom:updated>2024-11-09T16:31:23.203Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UDiUOhxkgyna79U5" /><figcaption>Photo by <a href="https://unsplash.com/@luxdamore?utm_source=medium&amp;utm_medium=referral">🐣 Luca Iaconelli 🦊</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Google Analytics is a very robust solution when it comes to tracking users. But, the tiny script everyone includes isn’t enough.</p><p>It might be critical for you to know how many users click a particular button (call-to-action), or visit pages using cross-selling strategies rather than direct navigation.<strong> Actually, you need custom events.</strong></p><blockquote>It is what this article is all about.</blockquote><p><strong>You will need:</strong></p><ul><li>Minimal knowledge of Javascript (listeners and handlers)</li><li>1 minute</li></ul><p><strong>It assumes that:</strong></p><ul><li>Google Analytics is already configured on your website ( snippet included with your UA-XXXXXXX identifier)</li><li>You’re familiar with the Google Analytics dashboard</li></ul><h3>Hands-on practical example</h3><p>Let’s say you’ve just built an incredible landing page for your product and you’d like to track how effective your call-to-actions are.</p><p>Something like that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P91TKxaYbbEMOqVuHtCYvw.png" /></figure><p>We will focus on the big purple button: <strong>Is it clicked frequently or not?</strong></p><blockquote>Three things cannot be long hidden: the sun, the moon, and the truth. — Buddha</blockquote><p><strong>There’s only one thing you need to know:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e428d33ee7be6be056daffa59fe9a7d/href">https://medium.com/media/3e428d33ee7be6be056daffa59fe9a7d/href</a></iframe><p><strong>Short explanation:</strong></p><ul><li>&#39;send&#39;: It is a command (known as hitType in the manual). It will ask Google Analytics to trigger “something”.</li><li>&#39;event&#39;: The “something” is an event. So you will trigger an event.</li><li>&#39;category&#39;: What has been interacted with. Quoting the manual: video, button, picture, etc.</li><li>&#39;Action&#39;: The kind of interaction. For instance: a video is played ( &#39;play&#39; action), an article is read ( &#39;read&#39; action), and so on.</li></ul><p><strong>Further details:</strong></p><ul><li>&#39;Label&#39;: Lets you categorize events. For instance, when an article is read you could provide the name of the article as a label. See later.</li><li>&#39;Value&#39;: A numeric value. For instance, when a download has ended you could track how long it has taken for the browser to download it. See later.</li></ul><h3>How it’s done</h3><p>Arching back to our call-to-action, we’d like to know how many times it’s been clicked.</p><p><strong>Snippet:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnTSiwjMSXOn7BYpuSix-A.png" /></figure><p><strong>It means:</strong></p><ul><li>Trigger a custom event in Google Analytics.</li><li>A button has been clicked.</li><li>This button is a Call-To-Action.</li></ul><p>Now, let’s imagine I have a second call-to-action further on my website.</p><p>I would like to know how it performs compared to the first one.</p><p><strong>Snippet:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DcUc4kjyTsJyONu3ZJ_JBQ.png" /></figure><p>This is how labels can prove to be useful.</p><h3>Another example</h3><p><em>You can leave or get straight to my article&#39;s ending if everything is already clear for you .</em></p><p>I’ll be using Promises this time (requires a bit more knowledge of Javascript).</p><p>Let’s say you want to know how long it has taken for a client to download a file.</p><p><strong>We’ll assume that the download function is an asynchronous request that returns a Promise.</strong></p><p><strong>Snippet:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rEjZ_VUwNPxKIAE0LIr9cA.png" /></figure><h3>Thanks for reading</h3><p>I hope this tutorial will let you improve your tracking experience using Google Analytics. It’s been very useful for me, and online tutorials seemed to be much harder for just a single line of Javascript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uvHxJT5h43Tz79Ip" /><figcaption>“Cappuccino in a white mug with white foam art on a wooden table” by <a href="https://unsplash.com/@takeshi2?utm_source=medium&amp;utm_medium=referral">wu yi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc32ef5c608b" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/track-custom-events-on-your-website-using-google-analytics-cc32ef5c608b">Track custom events on your website using Google Analytics</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Javascript : Convert HTML + CSS to PDF. Print HTML in seconds]]></title>
            <link>https://itnext.io/javascript-convert-html-css-to-pdf-print-supported-very-sharp-and-not-blurry-c5ffe441eb5e?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5ffe441eb5e</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[print]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Thu, 02 Aug 2018 09:21:55 GMT</pubDate>
            <atom:updated>2024-11-09T16:31:44.466Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GGBirGvjkcvRzuYc" /><figcaption>This could be your HTML</figcaption></figure><h3>Javascript : Convert HTML + CSS to PDF. Print HTML in Seconds</h3><p>A personal project I’m currently working on involves turning a styled HTML node tree into a printable PDF asset on client side.</p><p>I spent a long time searching for the definitive solution and went through a lot of hardships.</p><p>I will share with you my solution, which I believe is very easy to use, and I’ll go about pros / cons of other approaches.</p><p>It will take only two minutes of implementation.</p><h3>Setup</h3><blockquote><strong><em>FYI : </em></strong><em>I work with React so I’m using </em><em>npm / yarn to add libraries using the ES6 </em><em>import statement. Not using those package managers, you could integrate libraries using a simple </em><em>&lt;script&gt;&lt;/script&gt; tag.</em></blockquote><p>It will take you :</p><ul><li>Two Javascript libraries running on client side.</li><li>5 actual lines of code in Javascript</li></ul><p>It requires :</p><ul><li>Basic Javascript knowledge</li><li><strong>jsPDF : </strong>yarn add jspdf</li><li><strong>html2canvas :</strong> yarn add html2canvas</li></ul><h3>Snippet</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cda7581f4ac5fee9cc4220abc342220/href">https://medium.com/media/8cda7581f4ac5fee9cc4220abc342220/href</a></iframe><p>The process is as follows :</p><ul><li>The HTML node tree you want to transform into a PDF is <strong>first transformed into a canvas using </strong>html2canvas (line 4)</li><li>Then, <strong>an empty PDF structure is created using an A4 format. </strong>By the way, we tell jsPDF to use mm as the unit for the next operations (line 5)</li><li>Almost finished, we <strong>turn the canvas into a PNG image</strong> using canvas.toDataURL(&#39;image/png&#39;) (line 6).</li><li>This P<strong>NG image is then pasted onto the empty PDF</strong> at the coordinates (0,0) , resized at (211,298) (line 6). A4 format is 210 mm wide, and 297 mm tall so <strong>I’m using one more millimeter when pasting the image to avoid white strips on edges.</strong></li><li>Eventually, we prompt the browser to download the newly generated PDF using pdf.save(filename) (line 7).</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cda7581f4ac5fee9cc4220abc342220/href">https://medium.com/media/8cda7581f4ac5fee9cc4220abc342220/href</a></iframe><p>The other function taking quality as a parameter starting at 1 (default quality) allows you to get much more sharper PDF with an SVG look.</p><p>This quality is just the scale used to first turn the HTML node tree into a canvas. The greater it is, the sharper and the heavier the PDF will get (using quality = 4 on a complex node structure of mine produces 60 MB PDFs, while quality = 1 produces 800 KB PDFs).</p><h3>Considerations</h3><p>This technique lets you print HTML based PDFs in seconds using 5 lines of code.</p><p>It has been tested on multiple browsers and as of the 1st of August 2018, no issue was encountered using my Chrome browser.</p><p><strong>Nevertheless, consider the following few points :</strong></p><ul><li>It is an image into a PDF. Not actual text.</li><li>Those generated PDF files won’t let you select / copy / paste text as there isn’t text inside of it. Same goes for hyperlinks, etc.</li><li>Your PDFs might get very heavy as the quality increases.</li></ul><p><strong>Still :</strong></p><ul><li>Dead easy implementation</li><li>Neither code reorganization nor tweaking.</li><li>Works like charm on client side, leveraging on two battle-tested libraries (jsPDF and html2canvas).</li><li>Using 3 or 4 as the quality modifier, your PDFs will look like SVG files. Ultra sharp with no blurriness.</li><li>Not many libraries allow a direct HTML + CSS to PDF conversion.</li></ul><h3>Thanks for reading</h3><p>Tell me if it saved your life as it saved mine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FjLuOLwV2eSjHJWj" /><figcaption>“Cappuccino in a white mug with white foam art on a wooden table” by <a href="https://unsplash.com/@takeshi2?utm_source=medium&amp;utm_medium=referral">wu yi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5ffe441eb5e" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/javascript-convert-html-css-to-pdf-print-supported-very-sharp-and-not-blurry-c5ffe441eb5e">Javascript : Convert HTML + CSS to PDF. Print HTML in seconds</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Disable Categories, Tags and Author Pages on Your WordPress Website]]></title>
            <link>https://itnext.io/disable-categories-tags-and-author-pages-on-your-wordpress-website-7d2166f9b613?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d2166f9b613</guid>
            <category><![CDATA[website]]></category>
            <category><![CDATA[blog]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[wordpress]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Fri, 27 Jul 2018 09:55:01 GMT</pubDate>
            <atom:updated>2024-11-09T16:32:05.596Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8Gf3kTBh9n14Fa8k" /><figcaption>Photo by <a href="https://unsplash.com/@arnelhasanovic?utm_source=medium&amp;utm_medium=referral">Arnel Hasanovic</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I couldn’t find any straightforward super-fast solution online so, this is mine.</p><p>It will take you:</p><ul><li>1 actual line of code</li><li>1 minute</li></ul><p>It assumes that :</p><ul><li>Your WordPress website is hosted on an Apache server</li><li>Your Apache server supports mod_rewrite</li><li>You have full access to .htaccess</li></ul><p>It will let you redirect users to the home page in case they try to access a category / tag / author page.</p><h3>Step by Step</h3><ol><li>Connect via FTP to your web server.</li><li>Download the .htaccess file at the root of your WordPress installation (usually /www)</li><li>Open the file for edition.</li><li>Copy-Paste this block at the beginning of the file :</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57374c44a7ae4643c858278ae6ed4011/href">https://medium.com/media/57374c44a7ae4643c858278ae6ed4011/href</a></iframe><p>5. Save, close and upload the file to your web server.</p><h3>How it works</h3><p><em>Should you have 1 minute to dig a little bit into a short explanation, this is the right place.</em></p><ul><li>Line 1 and 4 : Tells Apache to execute the block only if the mod_rewrite module is present.</li><li>Line 2 : Tells Apache to activate the Rewrite Engine. This engine can rewrite URLs on the go.</li><li>Line 3 : We define a rule following this common syntax :</li></ul><p>RewriteRule patternToMatchAgainst whereToRedirect [Options]</p><ul><li>^(author|tag|category)\/.+$ : This is the pattern to match against.</li></ul><blockquote>If you’re not familiar with regular expressions, take a look to <a href="https://itnext.io/regular-expressions-tricks-you-should-know-2976c7bd1be3">this article</a></blockquote><p><strong>This pattern means :</strong> If the request looks like /author/anything or /tag/anything or /category/anything then, redirect somewhere.</p><ul><li>/ : This is the place we redirect the user in case the pattern is matched. It is the root of your WordPress website. <strong>It means that if someone tries to navigate to a category / tag / author page, he will be redirected to the home page.</strong></li></ul><h3>Thanks for reading</h3><p>I hope this short tutorial has been helpful to you and solved this common need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L-3O7t56mmRc91Q3" /><figcaption>“Cappuccino in a white mug with white foam art on a wooden table” by <a href="https://unsplash.com/@takeshi2?utm_source=medium&amp;utm_medium=referral">wu yi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d2166f9b613" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/disable-categories-tags-and-author-pages-on-your-wordpress-website-7d2166f9b613">Disable Categories, Tags and Author Pages on Your WordPress Website</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Easiest Tutorial on React Router v4 You'll Ever Find  -  Build a Single-Page-Application in…]]></title>
            <link>https://itnext.io/the-easiest-tutorial-on-react-router-v4-youll-ever-find-build-a-single-page-application-in-44c453f4123b?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/44c453f4123b</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 09:32:57 GMT</pubDate>
            <atom:updated>2024-11-09T16:32:29.171Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eAeFAvVHGTKsXDk8" /><figcaption>“Woman standing alone looking down at her phone” by <a href="https://unsplash.com/@epicantus?utm_source=medium&amp;utm_medium=referral">Daria Nepriakhina</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Easiest Tutorial on React Router v4 You’ll Ever Find — Build a Single-Page-Application in seconds.</h3><p>I strongly belive that ReactJS is well-suited for Single-Page-Applications (SPA).</p><p>I was looking around for almost a whole day before clearly understanding how React Router would help me building my first SPA and, here I am.</p><p>This article will provide you a short one-file running snippet to launch a Single-Page-Application in seconds.</p><h3>The Code</h3><p><strong>Demonstration :</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fembed%2Fpreview%2FQBpWpE%3Fheight%3D600%26slug-hash%3DQBpWpE%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fpen%2FQBpWpE&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2056496.QBpWpE.small.99c2b6da-60f5-4014-bfaf-17c8d234d8ba.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/994b1499ec42bddd6a4c217d1813220d/href">https://medium.com/media/994b1499ec42bddd6a4c217d1813220d/href</a></iframe><p><strong>Structure of an SPA :</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*umSWKahkpWUFWH7uvblYvA.png" /></figure><p>The <strong>Menu </strong>is just a list of links.</p><p>The <strong>Dynamic Content </strong>is what changes according to how the user navigates.</p><p>For instance, if I click on a link “Home” it would take me back to the <strong>Home panel</strong>. Then if I click on a link “Marketing” it would take me to the <strong>Marketing panel.</strong></p><p><strong>Notice that I don’t use the word “page”!</strong></p><p>Thanks to React Router, <strong>the actual page never changes,</strong> but <strong>the dynamic content does</strong>. (refer to my Codepen demonstration).</p><p><strong>How it works :</strong></p><ul><li><strong>First :</strong> You need to install react-router-dom . It is the package used to implement the routing process in your web application.</li></ul><p>yarn add react-router-dom</p><ul><li><strong>Second : </strong>You will import the meaningful parts from this package.</li></ul><p>import { BrowserRouter } from &#39;react-router-dom&#39; in index.js</p><p>import { NavLink } from &#39;react-router-dom&#39; in your navigation component</p><p>import { Route } from &#39;react-router-dom&#39; in your display component</p><ul><li><strong>Third : </strong>Wrap your App component (inside index.js) inside a BrowserRouter</li></ul><p>&lt;BrowserRouter&gt;<br> &lt;App /&gt;<br>&lt;/BrowserRouter&gt;</p><p>This is how the magic happens. React Router uses this component to make your application aware of the navigation (history, current path, etc).</p><ul><li><strong>Fourth : </strong>Fill your navigation component using NavLink items.</li></ul><p>&lt;NavLink exact to=&quot;/url&quot;&gt;Menu item&lt;/NavLink&gt;</p><p>NavLink is different from Link because it handles the active class-naming. It lets you customize appearance of active links based on the current URL, automatically.</p><p>The exact property will tell React Router to add active to the link only if the path is identical as the one given in the to property.</p><p>The to property is where the user will be redirected when clicking this link.</p><ul><li><strong>Finally : </strong>Fill your display component with Route items.</li></ul><p>&lt;Route exact path=&quot;/url&quot; component={Component} /&gt;</p><p>Route is just a conditional rendering component.</p><p>It will render the Component given in the component property, only if the current path is identical ( exact ) to the path property.</p><p>Putting exact on each Route lets you render only one component at a time. (essentially because you’d put a different exact path for each Route )</p><h3>That’s it</h3><p>It is that easy hopefully !</p><p>As you can see, it is a simple three-step process :</p><ul><li>Wrap the main component inside a BrowserRouter</li><li>Fill the navigation with NavLink items</li><li>Fill the display with Route items</li></ul><p>Yet, there is more to know about this awesome package. <a href="https://reacttraining.com/react-router/web/guides/philosophy">See by yourself</a>.</p><h3>Thanks for reading</h3><p>I hope this was useful to you !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SqxF9aBNTaWgofe7" /><figcaption>“Cappuccino in a white mug with white foam art on a wooden table” by <a href="https://unsplash.com/@takeshi2?utm_source=medium&amp;utm_medium=referral">wu yi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44c453f4123b" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/the-easiest-tutorial-on-react-router-v4-youll-ever-find-build-a-single-page-application-in-44c453f4123b">The Easiest Tutorial on React Router v4 You&#39;ll Ever Find  -  Build a Single-Page-Application in…</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handcrafted Email Signatures for the 21st Century]]></title>
            <link>https://medium.com/@barneyatkins/handcrafted-email-signatures-for-the-21st-century-a4987ea07faa?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4987ea07faa</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[branding]]></category>
            <category><![CDATA[freelancing]]></category>
            <category><![CDATA[email-marketing]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Wed, 11 Jul 2018 10:04:05 GMT</pubDate>
            <atom:updated>2024-11-09T16:33:41.562Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oregk6bx9i97A4op" /><figcaption>Photo by <a href="https://unsplash.com/@rawpixel?utm_source=medium&amp;utm_medium=referral">rawpixel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Freelancing is yet another adventure I wish everyone could live, and branding is a crucial part of it.</p><p>You want people to work with you, and you’d better find a way to stand out from the crowd.</p><p>From tiny little things to blockbusters in your portfolio, almost anything can add value to your profile.</p><p>This article will teach you how to make an impact with your email signature.</p><h3>First, what’s in it ?</h3><p>In my opinion, your email signature should contain:</p><ul><li><strong>Your name and Your Position.</strong></li><li><strong>Enough information to reach you out of the mailbox : </strong>phone number, personal website.</li><li><strong>Something that emphasizes your presence online :</strong> social media, platforms where your work is showcased (Github, Medium, Behance, Dribble)</li><li><strong>Perhaps your profile picture : </strong>it makes conversations more human, even more if you’re giving a big smile.</li><li><strong>Perhaps something related to your work area : </strong>If you’re a designer for instance, maybe should you include cool graphics, bright colors, funny shapes, etc.</li></ul><p>You should refrain from including:</p><ul><li><strong>Your email address : </strong>It’s an email signature, they already know your email address. <strong>However,</strong> you could add a secondary email address if you have one.</li><li><strong>Your personal address : </strong>No one needs to know where you live. <strong>However, </strong>indicating where your office is located might be useful.</li></ul><h3>How to stand out from the crowd ?</h3><p>Animations are definitely what makes me stare at an email signature for minutes, but there’s more :</p><ul><li><strong>Use easy-to-read fonts : </strong>No one wants to lose an eye at looking for your phone number. Search online for popular fonts, and use <a href="https://fonts.google.com/">Google Fonts </a>if you want.</li><li><strong>Follow business cards principles : </strong>Keep sober and elegant. Spaced paragraphs are easier to read, and font size should not be too small.</li><li><strong>Make your best : </strong>People will be more keen on working with someone who gets the job done without weird glitches.</li></ul><h3>How it’s made ?</h3><p>I am a developer so I coded my email signature to animate it easily with HTML &amp; CSS.</p><p>Those are the main approaches :</p><ul><li><strong>Using code (what I did) : </strong>You might have an email signature done in under an hour, yet experience taught me that basic HTML5 + CSS3 is not well supported by email clients (especially animations). The workaround is to capture a GIF (what I did) of your running code.</li><li><strong>Using a design software (with or without animation features) : </strong>Images and GIFs are supported by email clients out of the box so it will be rendered as expected.</li><li><strong>Using an online email signature generator :</strong> You might have less features available, yet your email should be compatible with any email client if the generator is reliable.<strong> Benefit : </strong>Clickable links and smaller emails.</li></ul><p>Regarding GIFs and Images :</p><p><strong>Small caveat :</strong> links are not clickable + emails might be a little bigger (my signature adds an extra 400 KB)</p><p><strong>Benefit : </strong>Images are resized so your signature is automatically responsive.</p><h3>Does it make an impact ?</h3><p>The short answer is, <strong>yes it does</strong>.</p><p>I sometimes receive emails from customers asking how I managed to have an animated signature with shadows, emojis and so on.</p><p>The other short answer is : <strong>The devil is in the details.</strong></p><p>By comparing your profile with others, customers might see that you pay big attention to small details. ⬅️ <strong>It makes the difference.</strong></p><h3>Thanks for reading</h3><p>Making my best to share weekly valuable content. ❤️💙</p><p>Feel free to ask me if you want your own custom email signature.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4987ea07faa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Pizzas Can Teach You About Object Oriented Programming]]></title>
            <link>https://itnext.io/what-pizzas-can-teach-you-about-object-oriented-programming-3570143aef3f?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/3570143aef3f</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[design-patterns]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Mon, 09 Jul 2018 12:17:05 GMT</pubDate>
            <atom:updated>2024-11-09T16:34:02.816Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qLEaUzbt5_ZYABGJ" /><figcaption>“Box of Margherita pizza delivered for dinner” by <a href="https://unsplash.com/@alexagorn?utm_source=medium&amp;utm_medium=referral">Alexandra Gorn</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Last week I had the opportunity to give a course entitled “<strong>Introduction to Object Oriented Programming</strong> <strong>and UML with Java.”</strong> I was in front of 10 students coming from very different backgrounds, aged from 20 to 40.</p><p><em>If you’re reading this, big up to you guys! Free coffee &amp; Mario Kart did it all.<br>☕️ 🎮</em></p><p>A big challenge was to find consistent examples to explain design patterns with simple words that everyone could understand.</p><p><strong>Believe it or not, pizzas are much more than food.</strong></p><p>This article will guide you through some very useful design patterns widely implemented, explained with pizzas and one-file snippets.</p><h3><strong>Design Pattern Observer</strong></h3><p>Running a pizza business isn’t easy and one of the difficulties that come with managing food is ensuring that your food is still fresh for customers.</p><p>In real life, pizzas won’t tell you they’re out of date.</p><p>In programming they will.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ea1b120c43f43b5e76e329acabefe37/href">https://medium.com/media/1ea1b120c43f43b5e76e329acabefe37/href</a></iframe><p>Margherita is an Observable : Something another object can observe.</p><p>Chef is an Observer : An object that can observe another.</p><p>Margherita can have multiple Observer using addObserver .</p><p>setChanged() will let notifyObservers() happen. Not using this function will make notifyObservers() have no effect at all.</p><p>notifyObservers() can take a parameter often used to describe what kind of change happened.</p><p>update() is called with two parameters. The modified Observable instance and the optional details parameter fromnotifyObservers() .</p><p><strong>Design Pattern Observer lets you make an object react to the changes of another with low coupling and minimal boilerplate code. An analogy with front-end development is Javascript listeners. A Java use-case is </strong><strong>KeyListener.</strong></p><p>Also called : <strong>Listener / Handler.</strong></p><h3><strong>Design Pattern Decorator</strong></h3><p>Running a pizza business involves managing different kinds of pizza like Margherita, Marinara, etc.</p><p>Still, most companies let you make your own custom pizza.</p><p>This is how it works both in real life and in programming.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a509e24474c677312323f7be7d7f72bb/href">https://medium.com/media/a509e24474c677312323f7be7d7f72bb/href</a></iframe><p>Pizza is an object we want to add attributes / methods to, dynamically at run-time.</p><p>There is a base class Pizza that holds another Pizza given in the constructor with parameters.</p><p>There are child classes extending Pizza : WithGarlic | WithOnions | WithPepperonis . These classes are instantiated using the constructor with parameters.</p><p>Those child classes do only one thing: overriding the cost() function to get the base cost and adding an extra cost on top of it.</p><p>The important thing is that : As a Pizza can hold another Pizza that holds another Pizza and so on, the total cost is computed in a cascade style using this.base.cost()+XXX.</p><p>Usually there are 3 kinds of implementation of the design pattern <strong>Decorator </strong>:</p><ul><li><strong>Using inheritance and composition</strong>, just like I did. Semantically, telling that a pizza contains another pizza is unbelievable, yet we’re in programming and this kind of thing happens very often.</li><li><strong>Using interfaces :</strong> More flexible as Java doesn’t support multiple inheritances, yet it supports implementing multiple interfaces. Since Java 8, interfaces can hold default methods easing this process. Still do I believe that implementation should be done by actual objects. Also to note that interfaces can’t hold instance members.</li><li><strong>Using inheritance, composition and abstract classes : </strong>Like I did, making Pizza abstract. It would ensure that no one could write Pizza p = new Pizza(new Pizza()) which would be a total nonsense as there can only be one very base.</li></ul><p>Each kind of implementation has pros and cons, but I think the one I provided is definitely the most straightforward and easiest to understand.</p><p>Looking at how online tutorials are designed, I think there are too much complex boilerplate code a complete beginner would struggle with.</p><p><strong>Design Pattern Decorator lets you dynamically add attributes and functionalities to an object at run-time, without using big if-else statements and without changing the base class behavior. A Java use-case is </strong><strong>IO with InputStream | BufferedInputStream | FileInputStream, etc</strong></p><p>I hope this article has been valuable to you and helped you to understand those simple and frequently used design patterns.</p><p>Pizzas turn out to be very useful at explaining programming stuff, just like concrete examples help understanding conceptual notions.</p><p>I had a very nice time explaining those two design patterns during my class, illustrated with ice creams and game characters.</p><p>Wondering how to run my snippets ? Use this <a href="https://www.tutorialspoint.com/compile_java_online.php">Online Java Compiler</a></p><h3>Thanks for reading</h3><p>My articles take root from your claps and encouragements.</p><p>I’m making my best at maintaining a 1-article-per-week basis, and if you weren’t that many readers reaching out to tell me what was great / awful, I wouldn’t be there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HKvyRzzPkaigv4ve" /><figcaption>“Cappuccino in a white mug with white foam art on a wooden table” by <a href="https://unsplash.com/@takeshi2?utm_source=medium&amp;utm_medium=referral">wu yi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3570143aef3f" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/what-pizzas-can-teach-you-about-object-oriented-programming-3570143aef3f">What Pizzas Can Teach You About Object Oriented Programming</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thanks for reading]]></title>
            <link>https://itnext.io/shaping-modern-age-my-tiny-journey-designing-a-business-card-with-code-by-hand-59ceeb271427?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/59ceeb271427</guid>
            <category><![CDATA[business]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[branding]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Fri, 29 Jun 2018 16:53:33 GMT</pubDate>
            <atom:updated>2024-11-09T16:35:06.209Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ozE2cbY7rNOJ3w4Z" /></figure><p>My stories keep bringing an ever-growing community and I have no words to tell how grateful I am. More than encouraging, it motivates me in writing more and sharing as much valuable knowledge as I can.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59ceeb271427" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/shaping-modern-age-my-tiny-journey-designing-a-business-card-with-code-by-hand-59ceeb271427">Thanks for reading</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Short List Of Handmade React Components That Will Fit Your Daily Needs]]></title>
            <link>https://itnext.io/a-short-list-of-handmade-react-components-that-will-fit-your-daily-needs-81a1e2c9e032?source=rss-989cea540270------2</link>
            <guid isPermaLink="false">https://medium.com/p/81a1e2c9e032</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Barney Atkins]]></dc:creator>
            <pubDate>Tue, 19 Jun 2018 13:46:59 GMT</pubDate>
            <atom:updated>2024-11-09T16:35:36.509Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*32OlZNekjAz0qRoN" /><figcaption>Photo by <a href="https://unsplash.com/@jeshoots?utm_source=medium&amp;utm_medium=referral">JESHOOTS.COM</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’ve been working with React for a while now and I’m still surprised how it lacks packages for everyday components that help building robust and intuitive interfaces.</p><p>I figured out that in spite of how big the React community is, I was losing much more time searching for a community-made component than making it on my own.</p><p>This article will go about a short list of tiny components that solve daily needs in front-end development.</p><p>No library, just handmade stuff you can customize and tailor as you go.<br>Full source code provided with Codepen demonstrations.</p><h3>1. Erasable input</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/1*J5P2jQtYXSUHCuJtY27YDw.png" /><figcaption>The cross shows only if the input isn’t empty</figcaption></figure><p><strong>How it works:</strong></p><ul><li>A div contains an input and a span</li><li>The input takes all the space and has padding to prevent text from going under the delete button.</li><li>The span is the delete button, positioned on top of the input and shown conditionally. When clicked, the input is cleaned and it disappears.</li></ul><p><strong>Problems solved / Advantages:</strong></p><ul><li>Getting rid of the keyboard on desktop and on mobile.</li><li>On mobile overall, it is a pain to touch the input and keep pushing the delete key till everything is cleaned.</li></ul><p><strong>Demonstration:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fembed%2Fpreview%2FyEPpJE%3Fheight%3D600%26slug-hash%3DyEPpJE%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fpen%2FyEPpJE&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2056496.yEPpJE.small.ac32b503-41ac-4237-bfb4-69a7a4104754.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/044599fb271e1f3248b76a1eca495e9f/href">https://medium.com/media/044599fb271e1f3248b76a1eca495e9f/href</a></iframe><h3>2. Cards</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GX6qlAS__wN7oM6lP_vYEQ.png" /><figcaption>Those fancy gradients come from <a href="https://webgradients.com/">https://webgradients.com/</a></figcaption></figure><p>Cards were undoubtedly made popular thanks to material design and it’s worth using.</p><p><strong>How it works:</strong></p><ul><li>A card is just a rectangle with a box-shadow</li><li>The delete button <em>(optional)</em> is positioned relatively to the card, on the top right corner (<a href="https://dmware.fr/4-css-tricks-ive-learnt-the-hard-way/">see this to know how it works</a>)</li></ul><p><strong>Problems solved / Advantages:</strong></p><ul><li>Displaying a list of similar packed information.</li><li>Very versatile component (it can host buttons, images, tags, and even more).</li><li>Using CSS Flexbox or CSS Grid it is very easy to provide a responsive structured layout.</li><li>Easy to animate and to customize, adaptable to any kind of content (employee detail, flight information, travel showcase, feed)</li></ul><p><strong>Demonstration:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fembed%2Fpreview%2Foyopdx%3Fheight%3D600%26slug-hash%3Doyopdx%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fpen%2Foyopdx&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2056496.oyopdx.small.522423c4-eb20-4899-aa48-aa3ae19b0d7f.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/8921d37cef13b64f9607b1e8bfaf0677/href">https://medium.com/media/8921d37cef13b64f9607b1e8bfaf0677/href</a></iframe><h3>3. Drop-down menu</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*Ft82RvAGbmZCQLNOOzXg7w.png" /><figcaption>You can toggle it with the top right ellipsis button | Material-ish-ness</figcaption></figure><p>I combined it with a card ⬜️.</p><p><strong>How it works:</strong></p><ul><li>A div has a child div which is the toggle button and another child div which is the actual menu.</li><li>The toggle button is a div with some padding to make clicking easier (i.e on a bigger surface). When clicked, the component’s state toggle an active property that determines whether the menu is shown or not and whether the toggle button has a gray background or not.</li><li>The menu is a div that contains a ul . The active state’s property determines if this div is expanded or collapsed (aka shown or hidden).</li><li><strong>The menu items are passed by property using an array of objects that hold: </strong><strong>label | icon | onClick with </strong><strong>onClick being an actual function.</strong></li></ul><p><strong>Problems solved / Advantages:</strong></p><ul><li>Provide an easy to integrate menu to any component (kind of a contextual menu)</li><li>Useful when there is no more available space to display a menu.</li><li>Unobtrusive and easy to customize.</li></ul><p><strong>Demonstration:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fembed%2Fpreview%2FKeyLrw%3Fheight%3D600%26slug-hash%3DKeyLrw%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fpen%2FKeyLrw&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2056496.KeyLrw.small.38bbf051-414a-450c-b782-a3a2702da9c1.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f94d8cd91047dbc24fa19445b9583dd/href">https://medium.com/media/3f94d8cd91047dbc24fa19445b9583dd/href</a></iframe><h3>4. Tabbed pane</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_M8yOPB4VcEPOwCcZ41nDg.png" /><figcaption>Navigation bar with automatically generated buttons and active styling</figcaption></figure><p><strong>Warning:</strong></p><p>My approach renders only one component at once.</p><p>It means that if you fill a form and change tab, the form will be empty when coming back.</p><p>It is very easy to circumvent, just like with the navigation buttons you could do this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*80QAlQA10p5esf9KBL3WOQ.png" /></figure><p><strong>How it works:</strong></p><ul><li>A TabbedPane has a tabs component’s property, and an active state’s property that determines which tab is being shown.</li><li>tabs is an array of objects represented by : label | component with component being an actual JSX component. label determines what is shown in the navigation bar.</li><li>Only one tab is <strong>rendered </strong>at once, and navigation buttons update the active state’s property</li></ul><p><strong>Problems solved / advantages:</strong></p><ul><li>Display multiple boards without having to change page.</li><li>Well adapted to multi-step processes like registration (personal details, company details, bank details).</li><li>Could be used with any kind of navigation (side bar, top bar, bottom bar).</li><li>Works out of the box with active link styling handled.</li></ul><p><strong>Demonstration:</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fembed%2Fpreview%2FYvYPZy%3Fheight%3D600%26slug-hash%3DYvYPZy%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fdavidmellul%2Fpen%2FYvYPZy&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F2056496.YvYPZy.small.dde81d4f-405f-4895-8fdc-d28473167484.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/6c8a90cbc5c34c5b37a395658c0b3cf4/href">https://medium.com/media/6c8a90cbc5c34c5b37a395658c0b3cf4/href</a></iframe><p>Libraries might exist for some of the components I’m sharing but:</p><ul><li>Having control over what you are using is a real game-changer, from customization to functionality.</li><li>If something breaks you’re the only responsible.</li><li>If you want to extend a component you’ll know how to because you did it on your own.</li></ul><h3>Thanks for reading</h3><p>I’m happy to share those components and hope it will help you 👌.</p><p>May I suggest you to give a glance to my last article ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qVCcE-K2x0Murucw" /><figcaption>“Cappuccino in a white mug with white foam art on a wooden table” by <a href="https://unsplash.com/@takeshi2?utm_source=medium&amp;utm_medium=referral">wu yi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81a1e2c9e032" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/a-short-list-of-handmade-react-components-that-will-fit-your-daily-needs-81a1e2c9e032">A Short List Of Handmade React Components That Will Fit Your Daily Needs</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>