Skip to content

Commit

Permalink
feat(info icon): styles and guidance for help text
Browse files Browse the repository at this point in the history
  • Loading branch information
corykon committed Jun 12, 2024
1 parent 113efe1 commit 155f036
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 0 deletions.
12 changes: 12 additions & 0 deletions projects/cashmere/src/lib/sass/_icons.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@import './colors';
@import './mixins';

$ico-chev-right: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMjAgNTEyIj48IS0tIEZvbnQgQXdlc29tZSBGcmVlIDUuMTUuMyBieSBAZm9udGF3ZXNvbWUgLSBodHRwczovL2ZvbnRhd2Vzb21lLmNvbSBMaWNlbnNlIC0gaHR0cHM6Ly9mb250YXdlc29tZS5jb20vbGljZW5zZS9mcmVlIChJY29uczogQ0MgQlkgNC4wLCBGb250czogU0lMIE9GTCAxLjEsIENvZGU6IE1JVCBMaWNlbnNlKSAtLT48cGF0aCBkPSJNMjg1LjQ3NiAyNzIuOTcxTDkxLjEzMiA0NjcuMzE0Yy05LjM3MyA5LjM3My0yNC41NjkgOS4zNzMtMzMuOTQxIDBsLTIyLjY2Ny0yMi42NjdjLTkuMzU3LTkuMzU3LTkuMzc1LTI0LjUyMi0uMDQtMzMuOTAxTDE4OC41MDUgMjU2IDM0LjQ4NCAxMDEuMjU1Yy05LjMzNS05LjM3OS05LjMxNy0yNC41NDQuMDQtMzMuOTAxbDIyLjY2Ny0yMi42NjdjOS4zNzMtOS4zNzMgMjQuNTY5LTkuMzczIDMzLjk0MSAwTDI4NS40NzUgMjM5LjAzYzkuMzczIDkuMzcyIDkuMzczIDI0LjU2OC4wMDEgMzMuOTQxeiIvPjwvc3ZnPg==';
$ico-chev-right-blue: 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI5LjA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LS4wNCAzMy45bC0yMi42NyAyMi42N2MtOS4zNyA5LjM3LTI0LjU3IDkuMzctMzMuOTQgMEwzNC41MiAyNzIuOTdjLTkuMzctOS4zNy05LjM3LTI0LjU3IDAtMzMuOTR6Ii8+PC9zdmc+';
Expand Down Expand Up @@ -50,3 +53,12 @@ $ico-cog-blue: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcm
.hc-icon-right {
margin-left: 5px;
}

.hc-info-ico {
@include fontSize(16px);
color: $gray-300;
cursor: pointer;
&:hover {
color: $gray-400;
}
}
91 changes: 91 additions & 0 deletions src/app/styles/info-icons/info-icons-demo.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<div class="demo-content">
<h1>Info Icons & Help Text</h1>
<h6>Last updated Jun 12, 2024</h6>

<hc-tile>
<h5 id="intro">Why Info Icons?<span class="hc-icon-right hc-info-ico fa fa-info-circle" hcTooltip="To give extra context!"></span></h5>
<p>Information icons provide in-context UI help. They're ideal for cases where the supplmental info is A) not critical, or B) verbose enough that it would clutter the UI if displayed all the time.</p>

<p>Use them generously in form controls, in tables, or in any other place where the user may benefit from some additional context.</p>

<h4>To use Cashmere styled info icons:</h4>
<ol>
<li>Add the <code>.hc-info-ico</code> class to a <code>span</code> or <code>hc-icon</code> with an appropriate icon.</li>
<li>Use <code>[hcTooltip]</code> or <code>[hcPop]</code>, or trigger a modal to deliver the helpful info.</li>
</ol>

<br><br>
<div id="tooltipExample"></div>
</hc-tile>

<hc-tile>
<h5 id="intro">Use with HcTooltip</h5>
<hc-form-field>
<hc-form-field>
<hc-label>Name <span class="hc-icon-right hc-info-ico fa fa-info-circle" hcTooltip="Some helpful context"></span></hc-label>
<input hcInput placeholder="Enter name"/>
</hc-form-field>
</hc-form-field>

<pre><code>
&lt;hc-form-field&gt;
&lt;hc-form-field&gt;
&lt;hc-label&gt;
Name
&lt;span class=&quot;hc-icon-left hc-info-ico fa fa-info-circle&quot;
hcTooltip=&quot;Some helpful context&quot;&gt;
&lt;/span&gt;&lt;/hc-label&gt;
&lt;input hcInput placeholder=&quot;Enter name&quot;/&gt;
&lt;/hc-form-field&gt;
&lt;/hc-form-field&gt;
</code></pre>
</hc-tile>

<hc-tile>
<h5 id="intro">Use with HcPop</h5>
<hc-tile>
<strong>Sepsis Dashboard<span class="hc-icon-right hc-info-ico fa fa-info-circle" [hcPop]="helpPop"></span></strong>
</hc-tile>
<hc-pop #helpPop>
<strong>Helpful Context</strong>
<p>Some <strong>helpful context</strong> that the user might need to know.</p>
<button hc-button>Thanks for the help!</button>
</hc-pop>

<pre><code>
&lt;hc-form-field&gt;
&lt;hc-form-field&gt;
&lt;hc-label&gt;
Name
&lt;span class=&quot;hc-icon-left hc-info-ico fa fa-info-circle&quot;
hcPop=&quot;helpPop&quot;&gt;
&lt;/span&gt;&lt;/hc-label&gt;
&lt;input hcInput placeholder=&quot;Enter name&quot;/&gt;
&lt;/hc-form-field&gt;
&lt;/hc-form-field&gt;

&lt;hc-pop #helpPop&gt;
&lt;strong&gt;Helpful Context&lt;/strong&gt;
&lt;p&gt;Some &lt;strong&gt;helpful context&lt;/strong&gt; that the user might need to know.&lt;/p&gt;
&lt;button hc-button&gt;Thanks for the help!&lt;/button&gt;
&lt;/hc-pop&gt;
</code></pre>
</hc-tile>

<hc-tile>
<h5 id="intro">Other Options for Help Text</h5>
<h3>HTML <code>title</code> attributes:</h3>
<p>Use these for less intrusive hover tooltips. They're great for quick,
one-line explanations &mdash; "hover to discover" style. If the user hesitates on a button you can explain to them in another
way the ramifications of clicking that button. You should almost always include these on clickable elements by default
if you're not already using an <code>hcTooltip</code>.
</p>
<div id="titleAttributeExample"></div>

<h3>On-Screen Help</h3>
<p>For cases where the guidance is critical for success, and isn't easily learnable in any other way,
it's good to just include the helpful instructions there in place. Be sure to keep it as quick and concise as possible.
</p>
<div id="inContextHelp"></div>
</hc-tile>
</div>
26 changes: 26 additions & 0 deletions src/app/styles/info-icons/info-icons-demo.component.scss

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions src/app/styles/info-icons/info-icons-demo.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {Component} from '@angular/core';
import {SectionService} from 'src/app/shared/section.service';
import {BaseDemoComponent} from '../../shared/base-demo.component';

@Component({
selector: 'hc-info-icons-demo',
templateUrl: './info-icons-demo.component.html',
styleUrls: ['./info-icons-demo.component.scss']
})
export class InfoIconsDemoComponent extends BaseDemoComponent {
constructor(sectionService: SectionService) {
super(sectionService);
}
}
6 changes: 6 additions & 0 deletions src/app/styles/styles-routes.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {TableDemoComponent} from './table/table-demo.component';
import {MarkdownContentComponent} from '../shared/markdown-content.component';
import {IESupportComponent} from './ie-support/ie-support.component';
import {ChartDemoComponent} from './chart/chart-demo.component';
import { InfoIconsDemoComponent } from './info-icons/info-icons-demo.component';

const routes: Routes = [
{
Expand Down Expand Up @@ -81,6 +82,11 @@ const routes: Routes = [
document: require('../../../guides/styles/file-icons.md')
}
},
{
path: 'info-icons',
component: InfoIconsDemoComponent,
data: { title: 'Info Icons & Help Text', category: 'User Interface' }
},
{
path: 'table',
component: TableDemoComponent,
Expand Down
2 changes: 2 additions & 0 deletions src/app/styles/styles.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {AboutModalComponent} from './about/about-modal.component';
import {TableDemoComponent} from './table/table-demo.component';
import {IESupportComponent} from './ie-support/ie-support.component';
import {ChartDemoComponent} from '../styles/chart/chart-demo.component';
import { InfoIconsDemoComponent } from './info-icons/info-icons-demo.component';

@NgModule({
imports: [SharedModule, StylesRoutesModule],
Expand All @@ -15,6 +16,7 @@ import {ChartDemoComponent} from '../styles/chart/chart-demo.component';
StylesComponent,
AboutModalComponent,
TableDemoComponent,
InfoIconsDemoComponent,
IESupportComponent,
ChartDemoComponent
]
Expand Down

0 comments on commit 155f036

Please sign in to comment.