From 4d0c8b27099e47d641e82937cbe22d9dfb96b3bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philippe=20Lafreni=C3=A8re?=
<53181414+PhilippeLafreniere18@users.noreply.github.com>
Date: Fri, 15 Oct 2021 10:44:53 -0400
Subject: [PATCH] feat(home-button): add home-button component to library
(#923)
* feat(home-button): add home-button component to library
* refactor(home-button): transfer home button to common package
---
gulpfile.js | 1 +
.../home-button/home-button.component.html | 9 +++++++
.../home-button/home-button.component.scss | 8 ++++++
.../lib/home-button/home-button.component.ts | 17 ++++++++++++
.../src/lib/home-button/home-button.module.ts | 26 +++++++++++++++++++
.../lib/home-button/home-button.theming.scss | 16 ++++++++++++
packages/common/src/lib/home-button/index.ts | 1 +
packages/common/src/public_api.ts | 2 ++
packages/common/src/style/common.theming.scss | 1 +
9 files changed, 81 insertions(+)
create mode 100644 packages/common/src/lib/home-button/home-button.component.html
create mode 100644 packages/common/src/lib/home-button/home-button.component.scss
create mode 100644 packages/common/src/lib/home-button/home-button.component.ts
create mode 100644 packages/common/src/lib/home-button/home-button.module.ts
create mode 100644 packages/common/src/lib/home-button/home-button.theming.scss
create mode 100644 packages/common/src/lib/home-button/index.ts
diff --git a/gulpfile.js b/gulpfile.js
index 731e6b98b1..e37206b332 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -173,6 +173,7 @@ gulp.task('core:concatStyles', done => {
'./packages/common/src/lib/collapsible/collapsible.theming.scss',
'./packages/common/src/lib/entity/entity.theming.scss',
'./packages/common/src/lib/entity/entity-table/entity-table.theming.scss',
+ './packages/common/src/lib/home-button/home-button.theming.scss',
'./packages/common/src/lib/list/list.theming.scss',
'./packages/common/src/lib/panel/panel.theming.scss',
'./packages/common/src/lib/tool/tool.theming.scss',
diff --git a/packages/common/src/lib/home-button/home-button.component.html b/packages/common/src/lib/home-button/home-button.component.html
new file mode 100644
index 0000000000..dd8c10fdf5
--- /dev/null
+++ b/packages/common/src/lib/home-button/home-button.component.html
@@ -0,0 +1,9 @@
+
diff --git a/packages/common/src/lib/home-button/home-button.component.scss b/packages/common/src/lib/home-button/home-button.component.scss
new file mode 100644
index 0000000000..e1af0c892a
--- /dev/null
+++ b/packages/common/src/lib/home-button/home-button.component.scss
@@ -0,0 +1,8 @@
+#homeButton {
+ position: absolute;
+ top: 50px;
+ left: 0px;
+ border-radius: 0;
+ height: 46px;
+ width: 48px;
+}
diff --git a/packages/common/src/lib/home-button/home-button.component.ts b/packages/common/src/lib/home-button/home-button.component.ts
new file mode 100644
index 0000000000..01a996c413
--- /dev/null
+++ b/packages/common/src/lib/home-button/home-button.component.ts
@@ -0,0 +1,17 @@
+import { Component, EventEmitter, Output } from '@angular/core';
+
+@Component({
+ selector: 'igo-home-button',
+ templateUrl: './home-button.component.html',
+ styleUrls: ['./home-button.component.scss']
+})
+export class HomeButtonComponent {
+
+ @Output() unselectButton = new EventEmitter();
+
+ constructor() {}
+
+ onUnselectButtonClick() {
+ this.unselectButton.emit();
+ }
+}
diff --git a/packages/common/src/lib/home-button/home-button.module.ts b/packages/common/src/lib/home-button/home-button.module.ts
new file mode 100644
index 0000000000..4fe6d82801
--- /dev/null
+++ b/packages/common/src/lib/home-button/home-button.module.ts
@@ -0,0 +1,26 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { IgoLanguageModule } from '@igo2/core';
+
+import { MatButtonModule } from '@angular/material/button';
+import { MatIconModule } from '@angular/material/icon';
+import { MatTooltipModule } from '@angular/material/tooltip';
+
+import { HomeButtonComponent } from './home-button.component';
+
+/**
+ * @ignore
+ */
+@NgModule({
+ imports: [
+ CommonModule,
+ MatIconModule,
+ MatButtonModule,
+ MatTooltipModule,
+ IgoLanguageModule
+ ],
+ exports: [HomeButtonComponent],
+ declarations: [HomeButtonComponent],
+ providers: []
+})
+export class IgoHomeButtonModule {}
diff --git a/packages/common/src/lib/home-button/home-button.theming.scss b/packages/common/src/lib/home-button/home-button.theming.scss
new file mode 100644
index 0000000000..8a1403e480
--- /dev/null
+++ b/packages/common/src/lib/home-button/home-button.theming.scss
@@ -0,0 +1,16 @@
+@mixin igo-home-button-theming($theme) {
+ $primary: map-get($theme, primary);
+ $accent: map-get($theme, accent);
+ $foreground: map-get($theme, foreground);
+
+ igo-home-button > #homeButton {
+ background-color: mat.get-color-from-palette($primary);
+ color: mat.get-color-from-palette($primary, default-contrast);
+
+ &:hover {
+ background-color: mat.get-color-from-palette($accent, lighter);
+ color: black;
+ }
+ }
+}
+
diff --git a/packages/common/src/lib/home-button/index.ts b/packages/common/src/lib/home-button/index.ts
new file mode 100644
index 0000000000..2c0a11ffdb
--- /dev/null
+++ b/packages/common/src/lib/home-button/index.ts
@@ -0,0 +1 @@
+export * from './home-button.component';
diff --git a/packages/common/src/public_api.ts b/packages/common/src/public_api.ts
index 1b2669180d..88856f2605 100644
--- a/packages/common/src/public_api.ts
+++ b/packages/common/src/public_api.ts
@@ -18,6 +18,7 @@ export * from './lib/dynamic-component/dynamic-outlet/dynamic-outlet.module';
export * from './lib/flexible/flexible.module';
export * from './lib/form/form.module';
export * from './lib/form/form/form.module';
+export * from './lib/home-button/home-button.module';
export * from './lib/form/form-field/form-field.module';
export * from './lib/form/form-group/form-group.module';
export * from './lib/entity/entity.module';
@@ -54,6 +55,7 @@ export * from './lib/custom-html';
export * from './lib/drag-drop';
export * from './lib/dynamic-component';
export * from './lib/form';
+export * from './lib/home-button';
export * from './lib/entity';
export * from './lib/flexible';
export * from './lib/image';
diff --git a/packages/common/src/style/common.theming.scss b/packages/common/src/style/common.theming.scss
index 8ec9856cea..d943edfca7 100644
--- a/packages/common/src/style/common.theming.scss
+++ b/packages/common/src/style/common.theming.scss
@@ -8,4 +8,5 @@
@include igo-panel-theming($theme);
@include igo-tool-theming($theme);
@include igo-tour-theming($theme);
+ @include igo-home-button-theming($theme);
}