Top Banner
47

Theming Ext JS 4

May 08, 2015

Download

Technology

Sencha

Ext JS 4 has a new CSS architecture which uses SASS & Compass. This will enable developers to easily create new themes. During this session you will learn how the Ext JS 4 theme was constructed, how to quickly customize the look and feel of your application and how to optimize your stylesheets for faster downloads.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Theming Ext JS 4
Page 2: Theming Ext JS 4

Theming Ext JS 4

ROBERT DOUGAN, SENCHA

Page 3: Theming Ext JS 4
Page 4: Theming Ext JS 4
Page 5: Theming Ext JS 4

Ext JS 4 ThemeCSS3

Component TemplatesSASS

Theming Ext JS 4Demo

Page 6: Theming Ext JS 4

CSS3

Page 7: Theming Ext JS 4
Page 8: Theming Ext JS 4

CurrentlyDesign itChop it

Sprite the imagesAdd the CSS

For every state!

Page 9: Theming Ext JS 4

With CSS3Design it

Add the CSS

Page 10: Theming Ext JS 4

Every Component!

Page 11: Theming Ext JS 4

Component Templates

Page 12: Theming Ext JS 4
Page 13: Theming Ext JS 4

<table id="ext-comp-1003" cellspacing="0" class="x-btn x-btn-noicon" style="width: auto; "> <tbody class="x-btn-small x-btn-icon-small-left"> <tr> <td class="x-btn-tl"> <i>&nbsp;</i> </td> <td class="x-btn-tc"></td> <td class="x-btn-tr"> <i>&nbsp;</i> </td> </tr> <tr> <td class="x-btn-ml"> <i>&nbsp;</i> </td> <td class="x-btn-mc"> <em class="" unselectable="on"> <button type="button" id="ext-gen9" class=" x-btn-text">Add User</button> </em> </td> <td class="x-btn-mr"> <i>&nbsp;</i> </td> </tr> <tr> <td class="x-btn-bl"> <i>&nbsp;</i> </td> <td class="x-btn-bc"></td> <td class="x-btn-br"> <i>&nbsp;</i> </td> </tr> </tbody></table>

Page 14: Theming Ext JS 4

<div id="button-1003" class="x-btn x-btn-small x-gray x-btn-icon-small-left x-btn-noicon"> <button type="button" role="button" id="ext-gen1004">Add User</button></div>

Page 15: Theming Ext JS 4

Every Component!

Page 16: Theming Ext JS 4

Legacy Browsers?

Page 17: Theming Ext JS 4

SASShttp://sass-lang.com

Page 18: Theming Ext JS 4

/* line 4, ../src/test.scss */.example1 { border-color:#3bbfce;}

/* line 8, ../src/test.scss */.example2 { margin:16px; color:#3bbfce;}

$blue:#3bbfce;$margin:16px;

.example1 { border-color:$blue;}

.example2 { margin:$margin;

color:$blue;}

VariablesSCSS CSS

Page 19: Theming Ext JS 4

/* line 3, ../src/test.scss */.example.test { color:black;}

/* line 9, ../src/test.scss */.example.foo { color:black;}

$str:‘test’;

.example.#{$str} { color:black;}

$str:‘foo’;

.example.#{$str} { color:black;}

Inline VariablesSCSS CSS

Page 20: Theming Ext JS 4

Math FunctionsSCSS CSS

/* line 5, ../src/test.scss */.example1 { border: 1px solid 4px;}

/* line 9, ../src/test.scss */.example2 { margin: 48px;}

$one:8px;$two:16px;$three:3px;

.example1 { border:1px solid $one / 2;}

.example2 { margin:$two * $three;}

Page 21: Theming Ext JS 4

Color FunctionsSCSS CSS

/* line 1, ../src/test.scss */.example1 { color: #cccc00; background: #9999ff; border-color: #aa0000;}

/* line 9, ../src/test.scss */.example2 { background: #ff7f00;}

.example1 { color:darken(yellow, 10); background:lighten(blue, 30); border-color:saturate(#aa0000, 10);}

.example2 { background:mix(yellow, red);}

Page 22: Theming Ext JS 4

/* line 6, ../src/test.scss */.example { color: blue; background-color: #000;

.child { padding: 5px; }}

@mixin add-stuff($color) { color:$color; background-color:#000; .child { padding:5px; }}

.example { @include add-stuff(blue);}

MixinsSCSS CSS

Page 23: Theming Ext JS 4

CombinedSCSS CSS

/* line 2, ../src/test.scss */.btn.tangy { background: yellow; border: 1px solid; border-color: #cccc00; color: #666666;}

/* line 2, ../src/test.scss */.btn.pale { background: blue; border: 1px solid; border-color: #0000cc; color: #666666;}

@mixin style-btn($name, $color) { .btn.#{$name} { background:$color; border:1px solid; border-color:darken($color, 10); color:lighten($color, 40); }}

@include style-btn(‘tangy’, yellow);@include style-btn(‘pale’, blue);

Page 24: Theming Ext JS 4

Compass

Page 25: Theming Ext JS 4

Compass

/* line 3, ../src/test.scss */.example1 { -moz-border-radius: 5px; -webkit-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px;}

@import 'compass';

.example1 { @include border-radius(5px);}

SCSS CSS

Page 26: Theming Ext JS 4

Theming Ext JS 4

Page 27: Theming Ext JS 4
Page 28: Theming Ext JS 4

Neptune

Page 29: Theming Ext JS 4
Page 30: Theming Ext JS 4
Page 31: Theming Ext JS 4
Page 32: Theming Ext JS 4
Page 33: Theming Ext JS 4
Page 34: Theming Ext JS 4
Page 35: Theming Ext JS 4

Variables

Page 36: Theming Ext JS 4

$base-color: #cc0000;

Page 37: Theming Ext JS 4

$frame-base-color: #333;$frame-border-radius: 10px;

$frame-font-size: 14px;

Page 38: Theming Ext JS 4

Mixins

Page 39: Theming Ext JS 4

@include extjs-button-color(‘yellow’, darken(#ddaa00, 13));

Page 40: Theming Ext JS 4

Optimization

Page 41: Theming Ext JS 4

/*include extjs components*/@include extjs-button;@include extjs-form;@include extjs-panel;@include extjs-qtip;@include extjs-toolbar;@include extjs-window;

Page 42: Theming Ext JS 4

/*include extjs components*/@include extjs-button;@include extjs-panel;@include extjs-toolbar;@include extjs-window;

Page 43: Theming Ext JS 4

Documentation

Page 44: Theming Ext JS 4

Demo

Page 45: Theming Ext JS 4

Questions?

Page 46: Theming Ext JS 4

Thanks!

Page 47: Theming Ext JS 4

@[email protected]://rwd.me

@senchainc