SlideShare ist ein Scribd-Unternehmen logo
1 von 30
Downloaden Sie, um offline zu lesen
Clarity Design System
Inspiring builders to create better experiences
Jeeyun Lim
August 28th, 2017
How do we empower designers and engineers to build products
that are beautiful and functional?
vSphere Client (HTML5)
Clarity - Inspiring builders to create better experiences
Design Guidelines Sketch Templates
Clarity - Inspiring builders to create better experiences
SVG Icons Components
In November of 2016,
Clarity decided to go public.
Clarity’s Open Source Journey
Since November 15th 2016…
Clarity’s Open Source Journey
Since November 15th 2016…
1800+
Stars on GitHub
1,000,000+
Page Views
500+
Pull Requests
174+
Countries
40+
Weekly Release
120+
Languages
Engage with Us!
http://clarity.design @VMwareClarity
Hands-on: Building an application with Clarity
Hands-on: Building an application with Clarity
In this training session you’ll learn how to..
• Create an Angular + Clarity application
• Work with navigation and routing
• Create components
• Write and inject services
• Retrieve data using HTTP
Getting started with Clarity seed
• Prerequisite: Install Node.js, IDE such as Visual Studio Code (Optional)
# install angular-cli globally
npm install -g @angular/cli
# clone the latest version of Clarity seed
git clone https://github.com/vmware/clarity-seed.git
cd clarity-seed
# install the project’s dependencies
npm install
# start the application - it will watch for file changes for live-reload
ng serve
Angular-cli
• Command line interface tool for speedy Angular code generation
# install angular-cli globally
npm install -g @angular/cli
# generating a new component
ng g component my-new-component
# generating a new service
ng g service my-new-service
# to learn more about Angular-CLI commands and their usages
ng help
Creating a component
# generating a new component
ng g component test
# add a new route in app.routing.ts
export const ROUTES: Routes = [
…
{path: 'test', component: TestComponent}
];
# add a new navigation link in the template app.component.html
<div class="header-nav" [clr-nav-level]=“1">
…
<a class="nav-link" href="#" [routerLink]=“[‘/test']" routerLinkActive=“active">
<span class="nav-text">Test</span></a>
</div>
Setting up the page
• A grid provides a structure of rows and columns for aligning content
• Clarity uses a 12-column, responsive grid
• Replace the content of home.component.html with the following:
<div class="row">
<div class="col-sm-12 col-md-8">
<span>span 1</span>
</div>
<div class="col-sm-12 col-md-4">
<span>span 2</span>
</div>
</div>
Adding a datagrid
• Add the following to the first column div in home.component.html:
<h3>Pick your Star Wars captain</h3>
<clr-datagrid>
<clr-dg-column>User ID</clr-dg-column>
<clr-dg-column>Name</clr-dg-column>
<clr-dg-row *ngFor="let user of users">
<clr-dg-cell>{{user.id}}</clr-dg-cell>
<clr-dg-cell>{{user.name}}</clr-dg-cell>
</clr-dg-row>
<clr-dg-footer>{{users.length}} users</clr-dg-footer>
</clr-datagrid>
• Define users in home.component.ts:
users = [ { id: 1, name: “Alice" }, { id: 2, name: “Bob" } ];
Fetching data through a service
# generating a new service
ng g service people
# use Angular’s Http module to call this API in people.service.ts
import { Injectable } from '@angular/core';
import { Http } from "@angular/http";
import "rxjs/add/operator/map";
@Injectable()
export class PeopleService {
constructor(private http: Http) { }
get(page: number = 1) {
let restUrl = `https://swapi.co/api/people/?page=${page}`;
return this.http.get(restUrl).map(data => data.json());
}
• We’ll be using The Star Wars API to fetch data: https://swapi.co/
Consuming our service in the component
• In home.component.ts:
import {PeopleService} from "../people.service";
@Component({
…
providers: [PeopleService]
})
export class HomeComponent {
currentPage = 1;
people = [];
constructor(private peopleService: PeopleService) {
this.peopleService.get(this.currentPage).subscribe( data => {
console.log(data);
this.people = data.results;
});
}
}
Populating datagrid
• Modify home.component.html to display data from the service call:
<clr-datagrid>
<clr-dg-column>Name</clr-dg-column>
<clr-dg-column>Birth Year</clr-dg-column>
<clr-dg-column>Gender</clr-dg-column>
<clr-dg-row *ngFor="let person of people">
<clr-dg-cell>{{person.name}}</clr-dg-cell>
<clr-dg-cell>{{person.birth_year}}</clr-dg-cell>
<clr-dg-cell>{{person.gender}}</clr-dg-cell>
</clr-dg-row>
<clr-dg-footer>{{people.length}} people</clr-dg-footer>
</clr-datagrid>
Adding pagination - footer
• Modify the footer in home.component.html:
<clr-dg-footer>
{{pg.firstItem + 1}} - {{pg.lastItem + 1}} of {{pg.total}} people
<clr-dg-pagination #pg [(clrDgPage)]="currentPage"
[clrDgPageSize]=“10" [clrDgTotalItems]=“total">
</clr-dg-pagination>
</clr-dg-footer>
• Define total in home.component.ts:
…
total = 0;
constructor(private peopleService: PeopleService) {
this.peopleService.get(this.currentPage).subscribe( data => {
…
this.total = data.count;
});
}
Fetching data for another page - template
• Add datagrid’s properties in home.component.html:
<clr-datagrid
(clrDgRefresh)=“refresh($event)" [clrDgLoading]="loading">
…
<clr-dg-row *ngFor="let person of people">
<clr-dg-cell>{{person.name}}</clr-dg-cell>
…
</clr-dg-row>
…
</clr-datagrid>
Data direction Syntax
data source (class) to view target (html) {{expression}} or [target]=“expression”
view target (html) to data source (class) (target)=“statement”
Two-way [(target)]=“expression”
Fetching data for another page - component
• Define variables and refresh function in home.component.ts:
export class HomeComponent {
…
selected;
loading = true;
constructor(private peopleService: PeopleService) {}
refresh(state: State) {
this.loading = true;
this.peopleService.get(this.currentPage).subscribe( data => {
…
this.loading = false;
});
}}
Enabling selection
• Add datagrid’s properties for selection in home.component.html:
<clr-datagrid [(clrDgSingleSelected)]="selected"
(clrDgRefresh)=“refresh($event)" [clrDgLoading]="loading">
…
<clr-dg-row *ngFor="let person of people" [clrDgItem]=“person">
…
</clr-dg-row>
…
</clr-datagrid>
Displaying selection (1)
• Add a card to the other column in home.component.html:
<ng-container *ngIf="selected">
<h3>You've selected</h3>
<div class="card">
<div class="card-header">
{{selected.name}}
</div>
<div class="card-block">
...
</div>
<div class="card-footer">
...
</div>
</div>
</ng-container>
Displaying selection (2)
• Fill out card-block with data in home.component.html:
<div class="card">
…
<div class="card-block">
<ul>
<li>Height: {{selected.height}}</li>
<li>Mass: {{selected.mass}}</li>
<li>Hair Color: {{selected.hair_color}}</li>
<li>Eye Color: {{selected.eye_color}}</li>
</ul>
</div>
…
</div>
Displaying selection (3)
• Fill out card-block with data in home.component.html:
<div class="card">
...
<div class="card-footer">
<div class="row">
<div class="col-sm-6 col-md-6">
<clr-icon shape="car"></clr-icon>
{{selected.vehicles.length}} vehicles
</div>
<div class="col-sm-6 col-md-6">
<clr-icon shape="plane"></clr-icon>
{{selected.starships.length}} starships
</div>
</div>
</div>
</div>
Extra - adding a tooltip
• A tooltip can provide more information to the user:
<clr-dg-column>
Birth Year
<clr-tooltip>
<clr-icon clrTooltipTrigger shape="info-circle"></clr-icon>
<clr-tooltip-content clrPosition="right" clrSize="md" *clrIfOpen>
<span>BBY - Before the Battle of Yavin</span>
</clr-tooltip-content>
</clr-tooltip>
</clr-dg-column>
Extra - adding an alert inside the card
<div class="card-block">
<clr-alert *ngIf="selected.starships.length == 0"
[clrAlertSizeSmall]=“true" [clrAlertType]=“'warning'">
<div class="alert-item">
<span class="alert-text">
{{selected.name}} has no starships. May be difficult to get around.
</span>
</div>
</clr-alert>
...
</div>
The Final Product
Resources
git.io/vmworld-clarity bit.ly/vmworld-clarity
(branch: vmworld2017)
Thank You!
Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsAdégòkè Obasá
 
Scott Guthrie at Dot Net Startup meetup
Scott Guthrie at Dot Net Startup meetupScott Guthrie at Dot Net Startup meetup
Scott Guthrie at Dot Net Startup meetupMarcelo Calbucci
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8Smita B Kumar
 
SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013
SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013
SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013Mavention
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptwesley chun
 
Accessibility on SVG and SEO
Accessibility on SVG and SEOAccessibility on SVG and SEO
Accessibility on SVG and SEOReinaldo Ferraz
 
New Tools for Visualization in JavaScript - Sept. 2011
New Tools for Visualization in JavaScript - Sept. 2011New Tools for Visualization in JavaScript - Sept. 2011
New Tools for Visualization in JavaScript - Sept. 2011philogb
 
Grails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to OrbitGrails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to OrbitZachary Klein
 
GraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaGraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaVladimir Tsukur
 
Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagWebtrends
 
MSFT Dumaguete 061616 - Building High Performance Apps
MSFT Dumaguete 061616 - Building High Performance AppsMSFT Dumaguete 061616 - Building High Performance Apps
MSFT Dumaguete 061616 - Building High Performance AppsMarc Obaldo
 
Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012philogb
 
O365Engage17 - 20,000 leagues under azure ad connect
O365Engage17 - 20,000 leagues under azure ad connectO365Engage17 - 20,000 leagues under azure ad connect
O365Engage17 - 20,000 leagues under azure ad connectNCCOMMS
 
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 Cutting edge HTML5 API you can use today (by Bohdan Rusinka) Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)Binary Studio
 

Was ist angesagt? (20)

IndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web AppsIndexedDB and Push Notifications in Progressive Web Apps
IndexedDB and Push Notifications in Progressive Web Apps
 
Scott Guthrie at Dot Net Startup meetup
Scott Guthrie at Dot Net Startup meetupScott Guthrie at Dot Net Startup meetup
Scott Guthrie at Dot Net Startup meetup
 
Advance java session 8
Advance java session 8Advance java session 8
Advance java session 8
 
SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013
SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013
SP2013 WCM Bootcamp - DSN Designing for SharePoint 2013
 
Google Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScriptGoogle Apps Script: Accessing G Suite & other Google services with JavaScript
Google Apps Script: Accessing G Suite & other Google services with JavaScript
 
Accessibility on SVG and SEO
Accessibility on SVG and SEOAccessibility on SVG and SEO
Accessibility on SVG and SEO
 
New Tools for Visualization in JavaScript - Sept. 2011
New Tools for Visualization in JavaScript - Sept. 2011New Tools for Visualization in JavaScript - Sept. 2011
New Tools for Visualization in JavaScript - Sept. 2011
 
Web view
Web viewWeb view
Web view
 
Grails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to OrbitGrails Launchpad - From Ground Zero to Orbit
Grails Launchpad - From Ground Zero to Orbit
 
Ajax Introduction
Ajax IntroductionAjax Introduction
Ajax Introduction
 
A Look at ASP.NET MVC 4
A Look at ASP.NET MVC 4A Look at ASP.NET MVC 4
A Look at ASP.NET MVC 4
 
GraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with SangriaGraphQL APIs in Scala with Sangria
GraphQL APIs in Scala with Sangria
 
Android query
Android queryAndroid query
Android query
 
Engage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 TagEngage 2013 - Why Upgrade to v10 Tag
Engage 2013 - Why Upgrade to v10 Tag
 
MSFT Dumaguete 061616 - Building High Performance Apps
MSFT Dumaguete 061616 - Building High Performance AppsMSFT Dumaguete 061616 - Building High Performance Apps
MSFT Dumaguete 061616 - Building High Performance Apps
 
Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012
 
O365Engage17 - 20,000 leagues under azure ad connect
O365Engage17 - 20,000 leagues under azure ad connectO365Engage17 - 20,000 leagues under azure ad connect
O365Engage17 - 20,000 leagues under azure ad connect
 
Wireless pres ba
Wireless pres baWireless pres ba
Wireless pres ba
 
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 Cutting edge HTML5 API you can use today (by Bohdan Rusinka) Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
Cutting edge HTML5 API you can use today (by Bohdan Rusinka)
 
Vanjs backbone-powerpoint
Vanjs backbone-powerpointVanjs backbone-powerpoint
Vanjs backbone-powerpoint
 

Ähnlich wie VMWorld 2017 Hackathon training: Getting Started with Clarity

Polymer
Polymer Polymer
Polymer jskvara
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...DataLeader.io
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!David Gibbons
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event HandlingWebStackAcademy
 
Frameworkless Web Development in Clojure
Frameworkless Web Development in ClojureFrameworkless Web Development in Clojure
Frameworkless Web Development in ClojureKungi2342
 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015Pushkar Chivate
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training Patrick Schroeder
 
BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!Craig Schumann
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction DjangoWade Austin
 
The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196Mahmoud Samir Fayed
 
CPOSC Talk - The Gatsby, Contentful, Netlify Stack
CPOSC Talk - The Gatsby, Contentful, Netlify StackCPOSC Talk - The Gatsby, Contentful, Netlify Stack
CPOSC Talk - The Gatsby, Contentful, Netlify StackSarah Mogin
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4DEVCON
 
Untangling the web10
Untangling the web10Untangling the web10
Untangling the web10Derek Jacoby
 
e-suap - client technologies- english version
e-suap - client technologies- english versione-suap - client technologies- english version
e-suap - client technologies- english versionSabino Labarile
 

Ähnlich wie VMWorld 2017 Hackathon training: Getting Started with Clarity (20)

Angular js
Angular jsAngular js
Angular js
 
Polymer
Polymer Polymer
Polymer
 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directives
 
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
A Microsoft Silverlight User Group Starter Kit Made Available for Everyone to...
 
How to Webpack your Django!
How to Webpack your Django!How to Webpack your Django!
How to Webpack your Django!
 
AngularJS and SPA
AngularJS and SPAAngularJS and SPA
AngularJS and SPA
 
Angular - Chapter 4 - Data and Event Handling
 Angular - Chapter 4 - Data and Event Handling Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 4 - Data and Event Handling
 
Frameworkless Web Development in Clojure
Frameworkless Web Development in ClojureFrameworkless Web Development in Clojure
Frameworkless Web Development in Clojure
 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training
 
BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!BP204 - Take a REST and put your data to work with APIs!
BP204 - Take a REST and put your data to work with APIs!
 
Basics of AngularJS
Basics of AngularJSBasics of AngularJS
Basics of AngularJS
 
Couchbas for dummies
Couchbas for dummiesCouchbas for dummies
Couchbas for dummies
 
Introduction Django
Introduction DjangoIntroduction Django
Introduction Django
 
The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196The Ring programming language version 1.7 book - Part 47 of 196
The Ring programming language version 1.7 book - Part 47 of 196
 
CPOSC Talk - The Gatsby, Contentful, Netlify Stack
CPOSC Talk - The Gatsby, Contentful, Netlify StackCPOSC Talk - The Gatsby, Contentful, Netlify Stack
CPOSC Talk - The Gatsby, Contentful, Netlify Stack
 
Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4Python Code Camp for Professionals 1/4
Python Code Camp for Professionals 1/4
 
Untangling the web10
Untangling the web10Untangling the web10
Untangling the web10
 
e-suap - client technologies- english version
e-suap - client technologies- english versione-suap - client technologies- english version
e-suap - client technologies- english version
 
The MEAN stack
The MEAN stack The MEAN stack
The MEAN stack
 

Kürzlich hochgeladen

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfrs7054576148
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 

Kürzlich hochgeladen (20)

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Intro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdfIntro To Electric Vehicles PDF Notes.pdf
Intro To Electric Vehicles PDF Notes.pdf
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 

VMWorld 2017 Hackathon training: Getting Started with Clarity

  • 1. Clarity Design System Inspiring builders to create better experiences Jeeyun Lim August 28th, 2017
  • 2. How do we empower designers and engineers to build products that are beautiful and functional? vSphere Client (HTML5)
  • 3. Clarity - Inspiring builders to create better experiences Design Guidelines Sketch Templates
  • 4. Clarity - Inspiring builders to create better experiences SVG Icons Components
  • 5. In November of 2016, Clarity decided to go public.
  • 6. Clarity’s Open Source Journey Since November 15th 2016…
  • 7. Clarity’s Open Source Journey Since November 15th 2016… 1800+ Stars on GitHub 1,000,000+ Page Views 500+ Pull Requests 174+ Countries 40+ Weekly Release 120+ Languages
  • 9. Hands-on: Building an application with Clarity
  • 10. Hands-on: Building an application with Clarity In this training session you’ll learn how to.. • Create an Angular + Clarity application • Work with navigation and routing • Create components • Write and inject services • Retrieve data using HTTP
  • 11. Getting started with Clarity seed • Prerequisite: Install Node.js, IDE such as Visual Studio Code (Optional) # install angular-cli globally npm install -g @angular/cli # clone the latest version of Clarity seed git clone https://github.com/vmware/clarity-seed.git cd clarity-seed # install the project’s dependencies npm install # start the application - it will watch for file changes for live-reload ng serve
  • 12. Angular-cli • Command line interface tool for speedy Angular code generation # install angular-cli globally npm install -g @angular/cli # generating a new component ng g component my-new-component # generating a new service ng g service my-new-service # to learn more about Angular-CLI commands and their usages ng help
  • 13. Creating a component # generating a new component ng g component test # add a new route in app.routing.ts export const ROUTES: Routes = [ … {path: 'test', component: TestComponent} ]; # add a new navigation link in the template app.component.html <div class="header-nav" [clr-nav-level]=“1"> … <a class="nav-link" href="#" [routerLink]=“[‘/test']" routerLinkActive=“active"> <span class="nav-text">Test</span></a> </div>
  • 14. Setting up the page • A grid provides a structure of rows and columns for aligning content • Clarity uses a 12-column, responsive grid • Replace the content of home.component.html with the following: <div class="row"> <div class="col-sm-12 col-md-8"> <span>span 1</span> </div> <div class="col-sm-12 col-md-4"> <span>span 2</span> </div> </div>
  • 15. Adding a datagrid • Add the following to the first column div in home.component.html: <h3>Pick your Star Wars captain</h3> <clr-datagrid> <clr-dg-column>User ID</clr-dg-column> <clr-dg-column>Name</clr-dg-column> <clr-dg-row *ngFor="let user of users"> <clr-dg-cell>{{user.id}}</clr-dg-cell> <clr-dg-cell>{{user.name}}</clr-dg-cell> </clr-dg-row> <clr-dg-footer>{{users.length}} users</clr-dg-footer> </clr-datagrid> • Define users in home.component.ts: users = [ { id: 1, name: “Alice" }, { id: 2, name: “Bob" } ];
  • 16. Fetching data through a service # generating a new service ng g service people # use Angular’s Http module to call this API in people.service.ts import { Injectable } from '@angular/core'; import { Http } from "@angular/http"; import "rxjs/add/operator/map"; @Injectable() export class PeopleService { constructor(private http: Http) { } get(page: number = 1) { let restUrl = `https://swapi.co/api/people/?page=${page}`; return this.http.get(restUrl).map(data => data.json()); } • We’ll be using The Star Wars API to fetch data: https://swapi.co/
  • 17. Consuming our service in the component • In home.component.ts: import {PeopleService} from "../people.service"; @Component({ … providers: [PeopleService] }) export class HomeComponent { currentPage = 1; people = []; constructor(private peopleService: PeopleService) { this.peopleService.get(this.currentPage).subscribe( data => { console.log(data); this.people = data.results; }); } }
  • 18. Populating datagrid • Modify home.component.html to display data from the service call: <clr-datagrid> <clr-dg-column>Name</clr-dg-column> <clr-dg-column>Birth Year</clr-dg-column> <clr-dg-column>Gender</clr-dg-column> <clr-dg-row *ngFor="let person of people"> <clr-dg-cell>{{person.name}}</clr-dg-cell> <clr-dg-cell>{{person.birth_year}}</clr-dg-cell> <clr-dg-cell>{{person.gender}}</clr-dg-cell> </clr-dg-row> <clr-dg-footer>{{people.length}} people</clr-dg-footer> </clr-datagrid>
  • 19. Adding pagination - footer • Modify the footer in home.component.html: <clr-dg-footer> {{pg.firstItem + 1}} - {{pg.lastItem + 1}} of {{pg.total}} people <clr-dg-pagination #pg [(clrDgPage)]="currentPage" [clrDgPageSize]=“10" [clrDgTotalItems]=“total"> </clr-dg-pagination> </clr-dg-footer> • Define total in home.component.ts: … total = 0; constructor(private peopleService: PeopleService) { this.peopleService.get(this.currentPage).subscribe( data => { … this.total = data.count; }); }
  • 20. Fetching data for another page - template • Add datagrid’s properties in home.component.html: <clr-datagrid (clrDgRefresh)=“refresh($event)" [clrDgLoading]="loading"> … <clr-dg-row *ngFor="let person of people"> <clr-dg-cell>{{person.name}}</clr-dg-cell> … </clr-dg-row> … </clr-datagrid> Data direction Syntax data source (class) to view target (html) {{expression}} or [target]=“expression” view target (html) to data source (class) (target)=“statement” Two-way [(target)]=“expression”
  • 21. Fetching data for another page - component • Define variables and refresh function in home.component.ts: export class HomeComponent { … selected; loading = true; constructor(private peopleService: PeopleService) {} refresh(state: State) { this.loading = true; this.peopleService.get(this.currentPage).subscribe( data => { … this.loading = false; }); }}
  • 22. Enabling selection • Add datagrid’s properties for selection in home.component.html: <clr-datagrid [(clrDgSingleSelected)]="selected" (clrDgRefresh)=“refresh($event)" [clrDgLoading]="loading"> … <clr-dg-row *ngFor="let person of people" [clrDgItem]=“person"> … </clr-dg-row> … </clr-datagrid>
  • 23. Displaying selection (1) • Add a card to the other column in home.component.html: <ng-container *ngIf="selected"> <h3>You've selected</h3> <div class="card"> <div class="card-header"> {{selected.name}} </div> <div class="card-block"> ... </div> <div class="card-footer"> ... </div> </div> </ng-container>
  • 24. Displaying selection (2) • Fill out card-block with data in home.component.html: <div class="card"> … <div class="card-block"> <ul> <li>Height: {{selected.height}}</li> <li>Mass: {{selected.mass}}</li> <li>Hair Color: {{selected.hair_color}}</li> <li>Eye Color: {{selected.eye_color}}</li> </ul> </div> … </div>
  • 25. Displaying selection (3) • Fill out card-block with data in home.component.html: <div class="card"> ... <div class="card-footer"> <div class="row"> <div class="col-sm-6 col-md-6"> <clr-icon shape="car"></clr-icon> {{selected.vehicles.length}} vehicles </div> <div class="col-sm-6 col-md-6"> <clr-icon shape="plane"></clr-icon> {{selected.starships.length}} starships </div> </div> </div> </div>
  • 26. Extra - adding a tooltip • A tooltip can provide more information to the user: <clr-dg-column> Birth Year <clr-tooltip> <clr-icon clrTooltipTrigger shape="info-circle"></clr-icon> <clr-tooltip-content clrPosition="right" clrSize="md" *clrIfOpen> <span>BBY - Before the Battle of Yavin</span> </clr-tooltip-content> </clr-tooltip> </clr-dg-column>
  • 27. Extra - adding an alert inside the card <div class="card-block"> <clr-alert *ngIf="selected.starships.length == 0" [clrAlertSizeSmall]=“true" [clrAlertType]=“'warning'"> <div class="alert-item"> <span class="alert-text"> {{selected.name}} has no starships. May be difficult to get around. </span> </div> </clr-alert> ... </div>