Skip to content

Commit c7e3def

Browse files
committed
refactor(item): Create .icon-accessory and remove auto nav icons, closes #1061
BREAKING CHANGE: The developer should be stating exactly how an icon should show, but previously the right nav arrow icon violates this by automatically showing a right arrow when an item was an anchor or button. Instead of using the `:after` item selector, which was always applied by default, it uses the same markup as `item-icon-right`, which is easier to understand, customizable and not a hard coded default. This change removes the `:after` nav icon styling, and creates a new class, `icon-accessory`, based off of similar CSS. The change makes a nav arrow highly customizable, allows RTL developers to easily control the arrow direction, and the accessory class is something that's reusable. An example of right side arrow using `ion-chevron-right` as the icon: <a class="item item-icon-right" href="#"> Check mail <i class="icon ion-chevron-right icon-accessory"></i> </a>
1 parent 518e54e commit c7e3def

File tree

3 files changed

+40
-66
lines changed

3 files changed

+40
-66
lines changed

Diff for: scss/_items.scss

+12-53
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,18 @@ a.item-content {
300300
left: auto;
301301
}
302302

303+
.item-icon-left .icon-accessory,
304+
.item-icon-right .icon-accessory {
305+
color: $item-icon-accessory-color;
306+
font-size: $item-icon-accessory-font-size;
307+
}
308+
.item-icon-left .icon-accessory {
309+
left: round($item-padding / 5);
310+
}
311+
.item-icon-right .icon-accessory {
312+
right: round($item-padding / 5);
313+
}
314+
303315

304316
/**
305317
* Item Button
@@ -375,59 +387,6 @@ button.item.item-button-right {
375387
}
376388

377389

378-
/**
379-
* Auto Right Arrow Icon
380-
* --------------------------------------------------
381-
* By default, if an .item is created out of an <a> or <button>
382-
* then a arrow will be added to the right side of the item.
383-
*/
384-
385-
a.item,
386-
button.item,
387-
.item[href] .item-content,
388-
.item[ng-click] .item-content {
389-
padding-right: (($item-padding * 3) - 5);
390-
391-
&:after {
392-
// By default, both <a> and <button> have right side arrow icons
393-
@include font-smoothing(antialiased);
394-
position: absolute;
395-
top: 50%;
396-
right: $item-padding - 4;
397-
display: block;
398-
margin-top: -8px;
399-
color: #ccc;
400-
content: "\f125"; // ion-chevron-right
401-
text-transform: none;
402-
font-weight: normal;
403-
font-style: normal;
404-
font-variant: normal;
405-
font-size: 16px;
406-
font-family: 'Ionicons';
407-
line-height: 1;
408-
speak: none;
409-
}
410-
}
411-
412-
.grade-c {
413-
a.item:after,
414-
button.item:after,
415-
.item[href] .item-content:after,
416-
.item[ng-click] .item-content:after {
417-
@include font-smoothing(none);
418-
}
419-
}
420-
421-
// do not show the default right arrow when they want their own right side icon
422-
a.item-icon-right:after,
423-
button.item-icon-right:after,
424-
a.item-button-right:after,
425-
button.item-button-right:after,
426-
.item a.item-content:after {
427-
display: none;
428-
}
429-
430-
431390
// Item Avatar
432391
// -------------------------------
433392

Diff for: scss/_variables.scss

+3
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ $item-button-line-height: 32px !default;
289289
$item-icon-font-size: 32px !default;
290290
$item-icon-fill-font-size: 28px !default;
291291

292+
$item-icon-accessory-color: #ccc !default;
293+
$item-icon-accessory-font-size: 16px !default;
294+
292295
$item-avatar-width: 40px !default;
293296
$item-avatar-height: 40px !default;
294297

Diff for: test/html/lists.html

+25-13
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,20 @@ <h1 class="title">Lists</h1>
3636
Check mail
3737
</a>
3838

39-
<a href="#" class="item item-icon-left">
39+
<a href="#" class="item item-icon-left item-icon-right">
4040
<i class="icon ion-chatbubble-working"></i>
4141
Call Ma
42+
<i class="icon ion-chevron-right icon-accessory"></i>
43+
</a>
44+
45+
<a href="#" class="item item-icon-right">
46+
Right side nav icon
47+
<i class="icon ion-chevron-right icon-accessory"></i>
48+
</a>
49+
50+
<a href="#" class="item item-icon-left">
51+
<i class="icon ion-chevron-left icon-accessory"></i>
52+
Left side nav icon
4253
</a>
4354

4455
</div>
@@ -49,10 +60,11 @@ <h1 class="title">Lists</h1>
4960
Work
5061
</div>
5162

52-
<a href="#" class="item item-icon-left">
63+
<a href="#" class="item item-icon-left item-icon-right">
5364
<i class="icon ion-email"></i>
5465
Check mail
5566
<span class="badge">5</span>
67+
<i class="icon ion-chevron-right icon-accessory"></i>
5668
</a>
5769

5870
<div class="item item-icon-left item-button-right">
@@ -364,15 +376,15 @@ <h3>List with card</h3>
364376
<div class="item-content">
365377
<i class="icon ion-heart brand-assertive fill-icon"></i>
366378
Madison, WI
367-
<i class="icon ion-chevron-right"></i>
379+
<i class="icon ion-chevron-right icon-accessory"></i>
368380
</div>
369381
</a>
370382

371383
<a href="#" class="item item-complex item-icon-left item-icon-right item-slider">
372384
<div class="item-content slide-left">
373385
<i class="icon ion-image brand-energized fill-icon"></i>
374386
Driving Directions
375-
<i class="icon ion-chevron-right"></i>
387+
<i class="icon ion-chevron-right icon-accessory"></i>
376388
</div>
377389
<div class="item-options">
378390
<button class="button">Button</button>
@@ -383,7 +395,7 @@ <h3>List with card</h3>
383395
<div class="item-content slide-right">
384396
<i class="icon ion-ios7-cog gray fill-icon"></i>
385397
Settings
386-
<i class="icon ion-chevron-right"></i>
398+
<i class="icon ion-chevron-right icon-accessory"></i>
387399
</div>
388400
</a>
389401

@@ -418,15 +430,15 @@ <h3>List with card</h3>
418430
Default has no wrap! This is a list item with really really really really really
419431
really really really really long long long long long long
420432
text text text texxxxxttt text testy text!!!
421-
<i class="icon ion-chevron-right"></i>
433+
<i class="icon ion-chevron-right icon-accessory"></i>
422434
</a>
423435

424436
<a href="#" class="item item-icon-left item-icon-right item-text-wrap">
425437
<i class="icon ion-ios7-cog gray fill-icon"></i>
426438
Assigned "item-text-wrap". This is a list item with really really really really really
427439
really really really really long long long long long long
428440
text text text texxxxxttt text testy text!!!
429-
<i class="icon ion-chevron-right"></i>
441+
<i class="icon ion-chevron-right icon-accessory"></i>
430442
</a>
431443

432444
<a href="#" class="item item-complex item-icon-left item-icon-right item-slider">
@@ -435,7 +447,7 @@ <h3>List with card</h3>
435447
Default no wrap and has item-content! This is a list item with really really really really really
436448
really really really really long long long long long long
437449
text text text texxxxxttt text testy text!!!
438-
<i class="icon ion-chevron-right"></i>
450+
<i class="icon ion-chevron-right icon-accessory"></i>
439451
</div>
440452
<div class="item-options">
441453
<button class="button">Button</button>
@@ -448,7 +460,7 @@ <h3>List with card</h3>
448460
Assigned "item-text-wrap" and has item-content. This is a list item with really really really really really
449461
really really really really long long long long long long
450462
text text text texxxxxttt text testy text!!!
451-
<i class="icon ion-chevron-right"></i>
463+
<i class="icon ion-chevron-right icon-accessory"></i>
452464
</div>
453465
<div class="item-options">
454466
<button class="button">Button</button>
@@ -465,31 +477,31 @@ <h3>List with card</h3>
465477
<h3>Thumbnails .item-thumbnail</h3>
466478
<div class="list">
467479

468-
<a href="#" class="item item-avatar">
480+
<a href="#" class="item item-avatar-left">
469481
<div class="item-content">
470482
<img src="http://ecx.images-amazon.com/images/I/41D5vU4I1NL.jpg">
471483
<h2>Pretty Hate Machine</h2>
472484
<p>Nine Inch Nails</p>
473485
</div>
474486
</a>
475487

476-
<a href="#" class="item item-avatar">
488+
<a href="#" class="item item-avatar-left">
477489
<div class="item-content">
478490
<img src="http://ecx.images-amazon.com/images/I/51tr3o4kd9L.jpg">
479491
<h2>Nevermind</h2>
480492
<p>Nirvana</p>
481493
</div>
482494
</a>
483495

484-
<a href="#" class="item item-avatar">
496+
<a href="#" class="item item-avatar-left">
485497
<div class="item-content">
486498
<img src="http://ecx.images-amazon.com/images/I/51j-SggaWSL.jpg">
487499
<h2>License To Ill</h2>
488500
<p>Bestie Boys</p>
489501
</div>
490502
</a>
491503

492-
<a href="#" class="item item-avatar">
504+
<a href="#" class="item item-avatar-left">
493505
<div class="item-content">
494506
<img src="http://ecx.images-amazon.com/images/I/61e6mUocZNL.jpg">
495507
<h2>gjpqy</h2>

0 commit comments

Comments
 (0)