Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How to build a fully functioning app with Polymer and Firebase

How to build a fully functioning app with Polymer and Firebase

Vinay Raghu

May 06, 2015
Tweet

More Decks by Vinay Raghu

Other Decks in Technology

Transcript

  1. About Me • New Haven • Design, UX and frontend

    coding • I love meetups • @rvinay88 • http://viii.in
  2. About this talk • https://github.com/rvinay88/cards-ui • Introduction to Web components

    • Introduction to Polymer • Polymer overview • Building progressively complex components • A little bit about v0.8 and Firebase
  3. Web Components • Best new technology 2014 • Built on

    standards • HTML Imports • Templates • Custom elements • Shadow DOM Source: http://webcomponents.org/
  4. Idea of components • React, Polymer, Atomic design, OOCSS •

    Self contained components that can be shared and reused • Each element gets its own interface • Building a system of components
  5. Bootstrap Buttons • Interaction states - Normal, Focus, Hover, Active

    • Contextual states - Info button, danger button, warning button • Physical states - Tiny, small, medium, large, block level • "Weirdness of HTML and CSS" states - Using it with <a> tag, <button> tag and <input> tags.
  6. Polymer 101 • It’s an HTML document - Markup, style

    and scripts • Everything related to a component lives in that one file • Define and use • Custom elements have to include a hyphen
  7. Polymer 101 • Polymer != Web components • Material design

    != Polymer • Webcomponents.js Polyfill • HTML import on Polymer library (HTML file not a JS file)
  8. Polymer 102 • Content insertion • Lifecycle callbacks • Node

    finding using this.$. • Communicating between elements
  9. Getting started • Install Node • npm install -g yo

    • npm install -g generator-polymer • yo polymer • Removing cruft
  10. A simple component 1. Define markup 2. Abstract data 3.

    Define polymer element 4. Import and use
  11. A simple component 1. Define markup 2. Abstract data context:

    { name: "Looney Tunes", image: "http://i.imgur.com/8uo3vrm.png" }
  12. A simple component 1. Define markup 2. Abstract data 3.

    Define <card-context> element 4. Use the component
  13. Issues • Data should be organized and stored better •

    context - contextID • author - authorID • tags - listOfTags • content - contentID • comments – arrayOfCommentIDs • Too many cases of 2 way bindings
  14. Firebase • Firebase element - link • Firebase login •

    Arrays are bad for data storage • Asynchronous calls <firebase-element id="base" location="https://YOUR.firebaseio.com/" data="{{data}}" keys="{{keys}}"></firebase-element> <template repeat="{{key in keys}}"> <p>{{key}}: {{data[key]}}</p> </template>
  15. Firebase • Firebase element - link • Firebase login •

    Arrays are bad for data storage • Asynchronous calls
  16. Let’s talk about 0.8 // Declared properties MyElement = Polymer({

    is: 'my-element', properties: { user: String, isHappy: Boolean, count: { type: Number, readOnly: true, notify: true, reflectToAttribute: true
  17. Let’s talk about 0.8 Can’t do {{ something }} Have

    to do <span>{{ something }}</span> Or <div>{{ something }}</div>
  18. Let’s talk about 0.8 • Migration guide • Closer to

    using in Production • More mature framework • Implements a lot of ES6 items
  19. Further Reading • Rob Dodson's polycasts • Divshot • Firebase's

    documentation are a pleasure to read • Polymer documentation