<section class="usage-guides">

<section class="overview">

## Overview

Cardinal icons establish a TA branded look-and-feel giving applications greater visual cohesion across products.

</section>

<section class="usage-guides">

<hr>

## Usage

### Installation

<hr class="ta-shortDivider">

Please consult the <a href="http://dds.us.aegon.com/implementation" target="_blank" rel="noopener noreferrer">Implementation</a> section before continuing with component specific instructions.

Install @cardinal/iconography with `$ npm install --save @cardinal/iconography`

The source files included are written in <a href="http://sass-lang.com/" target="_blank" rel="noopener noreferrer">Sass</a>. Point the sass include-path to the node_modules directory and import with:

```javascript
@import "node_modules/@cardinal/iconography/iconography";
```

</section>

<section class="usage-guides">

### Classes

<hr class="ta-shortDivider">

The font icons are dependent on `@font-face`. As an alternative, use the provided sprite.svg file to employ .svg icons directly.

Utilizing classes can be accomplished in two ways, using an `<i></i>` element or `.ta-icon` on appropriate elements.

<!-- begin code example -->
<section class="code-example">
<div class="ta-row -justify-content-center">
<div class="ta-col -xs4 -px-md -py-4xl ta-grey500Bg">
<h5 class="-light"><i class="ta-search-icon ta-white100Txt -mr-sm -mb-md" aria-hidden="true"></i>Search</h5>
<h5 class="-uppercase"><span class="ta-icon ta-email-icon ta-white100Txt -mr-sm" aria-hidden="true"></span>Email Cardinal</h5>
</div>
</div>
</section>
<!-- end begin code example -->

<!-- begin code snippets -->
```html
<div class="ta-row -justify-content-center">
<div class="ta-col -xs4 -px-md -py-4xl ta-grey500Bg">
<h5 class="-light"><i class="ta-search-icon ta-white100Txt -mr-sm -mb-md" aria-hidden="true"></i>Search</h5>
<h5 class="-uppercase"><span class="ta-icon ta-email-icon ta-white100Txt -mr-sm" aria-hidden="true"></span>Email Cardinal</h5>
</div>
</div>
```
<!-- end code snippets -->

<section class="usage-guides">

### Sass Variables

<hr class="ta-shortDivider">

When using icon variables in elements without than `<i></i>`, include the `.ta-icon` on the element.
<!-- begin code example -->
<section class="code-example">
<span class="ta-icon ta-email-icon ta-blue500Txt -centerText"></span>
</section>
<!-- end begin code example -->

<!-- begin code snippet -->
```html
<span class="ta-icon ta-email-icon ta-blue500Txt -centerText"></span>
```
<!-- end code snippet -->

```css
span.email {
  font-size: 1.2em;

  &::before {
    content: $ta-email-icon;
    color: $ta-blue500;
  }
}
```

<p class="note"><span>Note:</span> Where an .svg file name may change, use a semantic approach instead.</p>

<!-- begin code snippet -->
```css
  content: $ta-email-icon;
```
<!-- end code snippet -->

Some utility icon classes may match utility classes for colors. All icons in the informative family use an identifier appended of `-icon`.

For example `$ta-error` is utilized as `$ta-error-icon`.

<!-- begin code snippet -->
```css
  content: $ta-error-icon;
```
<!-- end code snippet -->

</section>

<section class="usage-guides">

### Sass Functions

<hr class="ta-shortDivider">

`ta-icon($name)`

Use the `ta-icon()` sass function to pass in a string value for different icons.

```css
i.search {
  &::before {
    content: ta-icon('search');
  }
}
```

<p class="note"><span>Note:</span> Before inserting an icon, first check the complete list of icons to verify its existence.</p>

<section class="usage-guides">

<hr>

## Accessibility

### Using Font Icons

<hr class="ta-shortDivider">

The most reliable way to hide extra content from a screen reader, but not from a sighted user, is to use `aria-hidden="true"`. This approach requires the use of a separate HTML element for icons, which rules out the use of `:before` or `:after` on a parent element.

The HTML and CSS looks like:

```html
<style>
  .icon-star::before {
    content: $ta-search;
    color: $ta-white100;
  }
</style>

<span><i class="ta-search-icon" aria-hidden="true"></i>Favorite</span>
```

The VoiceOver software should read this as "favorite" preserving the Cardinal visual style.

<p class="note"><span>Note:</span>As browsers are distinct, test first for best results. </p>

<section class="usage-guides">

### Using Font Icons as links

<hr class="ta-shortDivider">

```html
<a href="https://www.facebook.com/#" target="_blank" rel="noopener noreferrer" title="Your title">
  <i class="ta-facebook-icon" aria-hidden="true"></i>
  <span class="icon-screen-reader-text">We are on Facebook</span>
</a>
```

Refer to <a href="https://www.w3.org/WAI/GL/wiki/Icon_Font_with_an_On-Screen_Text_Alternative" target="_blank" rel="noopener noreferrer">this article</a> for more information.

</section>

<section class="usage-guides">

### Fallbacks for Font Icons

<hr class="ta-shortDivider">

For a good understanding on fallbacks please see: <a href="https://github.com/filamentgroup/a-font-garde" target="_blank" rel="noopener noreferrer">filamentgroup/a-font-garde</a>. Also, there is a great write-up by Chris Coyier on <a href="https://css-tricks.com/can-make-icon-system-accessible/" target="_blank" rel="noopener noreferrer">How Can I Make My Icon System Accessible</a>.

</section>
