<?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 Paolo Cavanna on Medium]]></title>
        <description><![CDATA[Stories by Paolo Cavanna on Medium]]></description>
        <link>https://medium.com/@PaoloCavanna?source=rss-75a530b635bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dZDju9F4Jou4Tw4TsYRrow.jpeg</url>
            <title>Stories by Paolo Cavanna on Medium</title>
            <link>https://medium.com/@PaoloCavanna?source=rss-75a530b635bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 07:56:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@PaoloCavanna/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[Empty state loader for Vue.js app]]></title>
            <link>https://medium.com/@PaoloCavanna/empty-state-loader-for-vue-js-app-d5bb9febfd19?source=rss-75a530b635bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5bb9febfd19</guid>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[css-animation]]></category>
            <dc:creator><![CDATA[Paolo Cavanna]]></dc:creator>
            <pubDate>Thu, 15 Mar 2018 17:08:17 GMT</pubDate>
            <atom:updated>2018-03-19T08:27:45.765Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mWdTf5WL3r2qampBFrSI8w.png" /><figcaption>CSS animation for the loader</figcaption></figure><p>I’d like to share a nice, little trick that helped me a lot while developing an application with <strong>Vue.js</strong> for <a href="https://www.motork.io/">MotorK</a>. Well, it works with any JavaScript application that gets hydrated by the client, regardless of the framework of choice (if any).</p><p>Most of the time (always?) you begin with this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c96dbac998241358912403e97b15552a/href">https://medium.com/media/c96dbac998241358912403e97b15552a/href</a></iframe><p>All you have is an empty container, acting as the mounting point for your app. <br>A few data fetch later and life flows into your app: cool, but we’ve gone a bit too far.<br>Let’s step back a little and consider those few moments in which the browser requested your page, the server responded and the user is staring at a blank, uncommunicative page. <br>A <em>de facto</em> standard pattern in UX is to provide a state <em>signifier</em> in the form of a loader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*inYwyq37FdvRPLRphTqwBA.gif" /><figcaption>Loading gif</figcaption></figure><p>Nice, but… a bit too old school. Since nowadays we can exploit CSS3 at its full potential, let’s reach out for this tool.</p><p>By combining <strong>CSS animations</strong> and a pseudo-selector (:empty), it’s possible to create a lightweight, clean and portable loader indicator.<br>First of all, let’s put in place the keyframes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/15f28f297d7a381290042f50a01c345a/href">https://medium.com/media/15f28f297d7a381290042f50a01c345a/href</a></iframe><p>And now the selector to which the animation applies:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/39daa6a7a3e167865cf45bde697593ea/href">https://medium.com/media/39daa6a7a3e167865cf45bde697593ea/href</a></iframe><p>In the gist above, @include center-object(all) is just a <em>mixin</em> useful to center an element on an axis (or both, as in this case) and ease(in-out-circ)is a utility function reading a SASS map with common easing functions and returning the corresponding one.</p><p>For the Vue part, we just need a very basic example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5001db5f51fba67be39b76f46e6974b8/href">https://medium.com/media/5001db5f51fba67be39b76f46e6974b8/href</a></iframe><p>After putting it all together, the result is this one:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fpaolocavanna%2Fembed%2Fpreview%2FNYGLwG%3Fheight%3D600%26slug-hash%3DNYGLwG%26default-tabs%3Dcss%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fpaolocavanna%2Fpen%2FNYGLwG%2F&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F29251.NYGLwG.small.0a407fd5-2a14-467b-8a94-f45fe7a25115.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/5aba16775cf8760147d17d0256c5930d/href">https://medium.com/media/5aba16775cf8760147d17d0256c5930d/href</a></iframe><p>Easy and clean!</p><p>Just a few side notes:</p><ul><li>the :empty pseudo-selector works if and only if the element to which applies is completely empty: no comment nor whitespaces inside, as per <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:empty">spec</a>.</li><li>the Vue.js code in the example serves as a mere concept, it doesn’t follow any best practice nor can it be considered production-ready.</li><li>I used SCSS just because I’m lazy and I grabbed the code directly from my source, but making it in pure CSS is absolutely fine.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5bb9febfd19" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>