This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial implementation of button-large component TODO: - unit tests - documentation/demo tweaks - visual tests * Add unit tests for button large unit tests TODO: - docs - visual tests * visual tests for large button * Update to use action-button instead of button-large * Fix tslint error * Update documentation for action buttons * Add tabindex="0" and enter press
- Loading branch information
1 parent
3c4f8bf
commit 78ba2d0
Showing
25 changed files
with
527 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/app/components/action-button/action-button-demo.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<div> | ||
<sky-action-button | ||
(actionClick)="filterActionClick()"> | ||
<sky-action-button-icon | ||
iconType="filter" | ||
></sky-action-button-icon> | ||
<sky-action-button-header> | ||
Build a new list | ||
</sky-action-button-header> | ||
<sky-action-button-details> | ||
Start from scratch and fine-tune with filters | ||
</sky-action-button-details> | ||
</sky-action-button> | ||
|
||
<sky-action-button | ||
(actionClick)="openActionClick()"> | ||
<sky-action-button-icon | ||
iconType="folder-open-o"> | ||
</sky-action-button-icon> | ||
<sky-action-button-header> | ||
Open a saved list | ||
</sky-action-button-header> | ||
<sky-action-button-details> | ||
Open a list with filters saved in the web view | ||
</sky-action-button-details> | ||
</sky-action-button> | ||
</div> |
15 changes: 15 additions & 0 deletions
15
src/app/components/action-button/action-button-demo.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sky-action-button-demo', | ||
templateUrl: './action-button-demo.component.html' | ||
}) | ||
export class SkyActionButtonDemoComponent { | ||
public filterActionClick() { | ||
alert('Filter action clicked'); | ||
} | ||
|
||
public openActionClick() { | ||
alert('Open action clicked'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<sky-demo-page title="Action button"> | ||
<sky-demo-page-summary> | ||
<p> | ||
The action button component creates a large button with an icon, header, and details. These buttons can be used to allow users to pick an action during a branching point in the system. | ||
</p> | ||
<p> | ||
The <code>sky-action-button</code> component consists of three inner components: <code>sky-action-button-icon</code>, <code>sky-action-button-header</code>, and <code>sky-action-button-details</code>. | ||
</p> | ||
</sky-demo-page-summary> | ||
|
||
<sky-demo-page-properties sectionHeading="Action button events"> | ||
<sky-demo-page-property | ||
propertyName="actionClick"> | ||
Fires when the user clicks the action button. | ||
</sky-demo-page-property> | ||
</sky-demo-page-properties> | ||
|
||
<sky-demo-page-properties sectionHeading="Action button icon properties"> | ||
<sky-demo-page-property | ||
propertyName="iconType"> | ||
Specifies an icon to be used from the Font Awesome library. For example, to use the <code>fa-filter</code> icon, use <code>filter</code> as the <code>iconType</code>. | ||
</sky-demo-page-property> | ||
</sky-demo-page-properties> | ||
<sky-demo-page-example> | ||
<sky-action-button-demo></sky-action-button-demo> | ||
<sky-demo-page-code demoName="Action button"></sky-demo-page-code> | ||
</sky-demo-page-example> | ||
</sky-demo-page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/modules/action-button/action-button-details.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { | ||
Component | ||
} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sky-action-button-details', | ||
templateUrl: '../shared/simple-content.html' | ||
}) | ||
export class SkyActionButtonDetailsComponent { | ||
} |
3 changes: 3 additions & 0 deletions
3
src/modules/action-button/action-button-header.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="sky-action-button-header sky-section-heading"> | ||
<ng-content></ng-content> | ||
</div> |
19 changes: 19 additions & 0 deletions
19
src/modules/action-button/action-button-header.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@import '../../scss/mixins'; | ||
|
||
.sky-action-button-header { | ||
display: inline-block; | ||
} | ||
|
||
@media (max-width: $sky-screen-xs-max) { | ||
.sky-action-button-header { | ||
margin-left: $sky-margin-half; | ||
margin-right: $sky-margin-half; | ||
} | ||
} | ||
|
||
@media (min-width: $sky-screen-sm-min) { | ||
.sky-action-button-header { | ||
display: block; | ||
margin-bottom: $sky-margin-double; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/modules/action-button/action-button-header.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { | ||
Component | ||
} from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'sky-action-button-header', | ||
styleUrls: ['./action-button-header.component.scss'], | ||
templateUrl: './action-button-header.component.html' | ||
}) | ||
export class SkyActionButtonHeaderComponent { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<span class="sky-action-button-icon-container"> | ||
<i | ||
class="fa sky-action-button-icon" | ||
[ngClass]="['fa-' + iconType, fontSizeClass]"> | ||
</i> | ||
</span> |
23 changes: 23 additions & 0 deletions
23
src/modules/action-button/action-button-icon.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@import '../../scss/mixins'; | ||
|
||
.sky-action-button-icon-container { | ||
display: inline-block; | ||
} | ||
|
||
@media (max-width: $sky-screen-xs-max) { | ||
.sky-action-button-icon-container { | ||
margin-left: $sky-margin-half; | ||
margin-right: $sky-margin-half; | ||
} | ||
} | ||
|
||
@media (min-width: $sky-screen-sm-min) { | ||
.sky-action-button-icon-container { | ||
display: block; | ||
margin-bottom: $sky-margin-double; | ||
} | ||
} | ||
|
||
.sky-action-button-icon { | ||
color: $sky-color-blue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { | ||
Component, | ||
Input, | ||
OnDestroy | ||
} from '@angular/core'; | ||
|
||
import { | ||
SkyMediaQueryService, | ||
SkyMediaBreakpoints | ||
} from '../media-queries'; | ||
|
||
import { | ||
Subscription | ||
} from 'rxjs'; | ||
|
||
@Component({ | ||
selector: 'sky-action-button-icon', | ||
styleUrls: ['./action-button-icon.component.scss'], | ||
templateUrl: './action-button-icon.component.html' | ||
}) | ||
export class SkyActionButtonIconComponent implements OnDestroy { | ||
|
||
@Input() | ||
public iconType: string; | ||
|
||
public fontSizeClass: string; | ||
|
||
private subscription: Subscription; | ||
|
||
constructor(private mediaQueryService: SkyMediaQueryService) { | ||
this.subscription = this.mediaQueryService.subscribe((args: SkyMediaBreakpoints) => { | ||
if (args === SkyMediaBreakpoints.xs) { | ||
this.fontSizeClass = 'fa-2x'; | ||
} else { | ||
this.fontSizeClass = 'fa-3x'; | ||
} | ||
}); | ||
} | ||
|
||
public ngOnDestroy() { | ||
this.subscription.unsubscribe(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div | ||
class="sky-action-button" | ||
role="button" | ||
(click)="buttonClicked()" | ||
(keyup)="enterPress($event)" | ||
tabindex="0" | ||
> | ||
<div class="sky-action-button-icon-header-container"> | ||
<ng-content select="sky-action-button-icon"></ng-content> | ||
<ng-content select="sky-action-button-header"></ng-content> | ||
</div> | ||
<ng-content select="sky-action-button-details"></ng-content> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@import '../../scss/mixins'; | ||
|
||
.sky-action-button { | ||
@include sky-button-variant($sky-text-color, $sky-color-white, $sky-color-gray-lighter); | ||
@include sky-border(dark, top, bottom, left, right); | ||
max-width: 236px; | ||
border-radius: 3px; | ||
margin-top: $sky-margin-double; | ||
margin-right: $sky-margin-double; | ||
cursor: pointer; | ||
display: inline-block; | ||
padding-top: 20px; | ||
padding-right: 20px; | ||
padding-left: 20px; | ||
padding-bottom: 30px; | ||
text-align: center; | ||
} | ||
|
||
@media (min-width: $sky-screen-sm-min) { | ||
.sky-action-button { | ||
padding: 30px 20px; | ||
} | ||
} | ||
|
||
@media (max-width: $sky-screen-xs-max) { | ||
.sky-action-button-icon-header-container { | ||
margin-bottom: $sky-margin-double; | ||
} | ||
} | ||
|
Oops, something went wrong.