forked from NationalBankBelgium/stark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stark-ui): action Bar Component
ISSUES CLOSED: NationalBankBelgium#481
- Loading branch information
Showing
51 changed files
with
969 additions
and
97 deletions.
There are no files selected for viewing
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
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
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
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,8 @@ | ||
$tablet-query: "(min-width: 600px)"; | ||
$tablet-screen-query: "screen and (min-width: 600px)"; | ||
$desktop-query: "(min-width: 960px)"; | ||
$desktop-screen-query: "screen and (min-width: 960px)"; | ||
$mobile-only-query: "(max-width: 599px)"; | ||
$mobile-only-screen-query: "screen and (max-width: 599px)"; | ||
$tablet-only-query: "(min-width: 600px) and (max-width: 959px)"; | ||
$tablet-only-screen-query: "screen and (min-width: 600px) and (max-width: 959px)"; |
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
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 |
---|---|---|
|
@@ -200,9 +200,9 @@ $typography-theme: ( | |
500 | ||
), | ||
subheading-2: ( | ||
13px, | ||
16px, | ||
28px, | ||
400 | ||
500 | ||
), | ||
subheading-1: ( | ||
15px, | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.mat-menu-content .mat-menu-item { | ||
color: mat-color(map-get($base-theme, primary-palette)); | ||
.mat-icon { | ||
color: inherit; | ||
svg { | ||
height: 20px; | ||
width: 20px; | ||
} | ||
} | ||
&[disabled] { | ||
color: map-get($mat-light-theme-foreground, disabled-button); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./modules/action-bar"; | ||
export * from "./modules/app-logo"; | ||
export * from "./modules/slider"; | ||
export * from "./modules/svg-view-box"; |
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,2 @@ | ||
export * from "./action-bar/action-bar.module"; | ||
export * from "./action-bar/components"; |
13 changes: 13 additions & 0 deletions
13
packages/stark-ui/src/modules/action-bar/action-bar.module.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,13 @@ | ||
import { NgModule } from "@angular/core"; | ||
import { BrowserModule } from "@angular/platform-browser"; | ||
import { MatButtonModule, MatIconModule, MatMenuModule, MatTooltipModule } from "@angular/material"; | ||
import { StarkSvgViewBoxModule } from "../svg-view-box/svg-view-box.module"; | ||
import { StarkActionBarComponent } from "./components"; | ||
import { TranslateModule } from "@ngx-translate/core"; | ||
|
||
@NgModule({ | ||
declarations: [StarkActionBarComponent], | ||
imports: [BrowserModule, StarkSvgViewBoxModule, MatButtonModule, MatIconModule, MatMenuModule, MatTooltipModule, TranslateModule], | ||
exports: [StarkActionBarComponent] | ||
}) | ||
export class StarkActionBarModule {} |
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 @@ | ||
export * from "./components/action-bar.component"; | ||
export * from "./components/action.intf"; | ||
export * from "./components/action-bar-config.intf"; |
38 changes: 38 additions & 0 deletions
38
packages/stark-ui/src/modules/action-bar/components/_action-bar-theme.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,38 @@ | ||
.stark-action-bar { | ||
.mat-icon-button { | ||
@include stark-button-color(mat-color(map-get($base-theme, primary-palette))); | ||
} | ||
&.stark-action-bar-full { | ||
background-color: rgba(0, 0, 0, 0.85); | ||
color: rgba(255, 255, 255, 0.8); | ||
.mat-icon-button { | ||
@include stark-button-color(rgba($color: #fff, $alpha: 0.8)); | ||
} | ||
.action-label { | ||
&.disabled { | ||
color: rgba($color: #fff, $alpha: 0.25); | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media #{$tablet-query} { | ||
.stark-action-bar { | ||
color: $md-primary; | ||
&.stark-action-bar-full { | ||
background: none; | ||
color: mat-color(map-get($base-theme, primary-palette)); | ||
.mat-icon-button:not([disabled]) { | ||
@include stark-button-color(mat-color(map-get($base-theme, primary-palette))); | ||
} | ||
[disabled].mat-icon-button { | ||
@include stark-button-color(map-get($mat-light-theme-foreground, disabled-button)); | ||
} | ||
.action-label { | ||
&.disabled { | ||
color: map-get($mat-light-theme-foreground, disabled-button); | ||
} | ||
} | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
packages/stark-ui/src/modules/action-bar/components/_action-bar.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,62 @@ | ||
.stark-action-bar { | ||
display: flex; | ||
flex-wrap: nowrap; | ||
justify-content: space-between; | ||
max-height: 40px; | ||
overflow: hidden; | ||
transform-origin: bottom; | ||
.action-bar-wrapper { | ||
display: flex; | ||
align-items: center; | ||
flex-wrap: wrap; | ||
} | ||
.mat-icon-button { | ||
.mat-icon svg { | ||
height: 20px; | ||
width: 20px; | ||
} | ||
} | ||
&.stark-action-bar-full { | ||
bottom: 0; | ||
left: 0; | ||
margin-bottom: 0; | ||
padding: 4px 0; | ||
position: fixed; | ||
right: 0; | ||
z-index: 4; | ||
&.extended { | ||
transition: 0.3s ease; | ||
height: auto; | ||
max-height: 280px; | ||
overflow-y: scroll; | ||
.action-bar-wrapper { | ||
display: flex; | ||
align-items: flex-start; | ||
flex-direction: column; | ||
flex-wrap: nowrap; | ||
} | ||
} | ||
.action-label { | ||
font-size: 13px; | ||
padding-left: 15px; | ||
} | ||
} | ||
} | ||
|
||
@media #{$tablet-query} { | ||
.stark-action-bar { | ||
position: relative; | ||
height: auto; | ||
transition: 0.7s ease; | ||
&.stark-action-bar-full { | ||
position: relative; | ||
&.extended { | ||
max-height: 900px; | ||
} | ||
} | ||
} | ||
.stark-action-bar-compact { | ||
flex-wrap: nowrap; | ||
padding: 0; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/stark-ui/src/modules/action-bar/components/action-bar-config.intf.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,16 @@ | ||
import { StarkAction } from "./action.intf"; | ||
|
||
/** | ||
* Stark Action interface | ||
*/ | ||
export interface StarkActionBarConfig { | ||
/** | ||
* Array of actions (StarkAction config objects) to be included in the action bar | ||
*/ | ||
actions: StarkAction[]; | ||
|
||
/** | ||
* If false, then action bar will not be present on the page (optional) | ||
*/ | ||
isPresent?: boolean; | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/stark-ui/src/modules/action-bar/components/action-bar.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,34 @@ | ||
<div *ngIf="(actionBarConfig.isPresent === undefined || actionBarConfig.isPresent === true)" class="stark-action-bar" | ||
[ngClass]="{'extended': isExtended, 'stark-action-bar-full': mode === 'full', 'stark-action-bar-compact': mode === 'compact'}" [id]="actionBarId"> | ||
<div class="action-bar-wrapper"> | ||
<div *ngFor="let action of actionBarConfig.actions; trackBy: trackAction" [id]="actionBarId + '-' + action.id" | ||
(click)="onClick(action, $event)" class="stark-action-bar--action"> | ||
<ng-container *ngIf="action.isVisible !== false"> | ||
<button [ngClass]="action.className" [matTooltip]="action.labelSwitchFunction ? action.labelActivated : action.label" [disabled]="!action.isEnabled" mat-icon-button> | ||
<mat-icon starkSvgViewBox [svgIcon]="action.iconSwitchFunction ? action.iconActivated : action.icon"></mat-icon> | ||
</button> | ||
<label class="action-label" [ngClass]="{'disabled': !action.isEnabled}" *ngIf="isExtended" translate>{{ action.label }}</label> | ||
</ng-container> | ||
</div> | ||
</div> | ||
|
||
<div *ngIf="mode === 'full' || alternativeActions" class="alt-actions"> | ||
<button class="extend-action-bar" mat-icon-button *ngIf="mode === 'full'" (click)="toggleExtendedActionBar()"> | ||
<mat-icon starkSvgViewBox svgIcon="dots-horizontal"></mat-icon> | ||
</button> | ||
<button class="open-alt-actions" mat-icon-button *ngIf="alternativeActions" [matMenuTriggerFor]="menu"> | ||
<mat-icon starkSvgViewBox svgIcon="dots-vertical"></mat-icon> | ||
</button> | ||
<mat-menu #menu="matMenu" xPosition="before"> | ||
<div *ngFor="let action of alternativeActions; trackBy: trackAction" mat-menu-item [id]="actionBarId + '-alt-' + action.id" [disabled]="!action.isEnabled" | ||
(click)="onClick(action, $event)"> | ||
<ng-container *ngIf="action.isVisible !== false"> | ||
<div [ngClass]="action.className"> | ||
<mat-icon starkSvgViewBox [svgIcon]="action.icon"></mat-icon> | ||
<span translate>{{ action.label }}</span> | ||
</div> | ||
</ng-container> | ||
</div> | ||
</mat-menu> | ||
</div> | ||
</div> |
Oops, something went wrong.