Twitter uses image sprite and JavaScript to produce Like button animation. We would be giving same effect to checkbox by using Lightning component. Combination of Checkbox, Label and Box property of CSS3 is used to give final result.
Lightning Component will contain only declaration of checkbox as shown below.
TwitterLove.cmp
<aura:component > <input id="toggle-heart" type="checkbox" /> <label for="toggle-heart">❤</label> </aura:component>
Note : In above source code, heart UTF icon is getting replaced by emoji code, so refer this screen to see exact code written for Lightning Component.
We have used Sassy CSS (SCSS) in this demo, as it would be little bit hard to write pure CSS with animation. Once SCSS is written, we can use this online tool to convert it to CSS. All these are explained and build live on my channel. Continue reading “Twitter’s Like button as Salesforce Lightning Component- pure CSS3 with Video”