forked from akveo/nebular
-
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.
chore(docs): add for business section (akveo#2683)
- Loading branch information
Showing
12 changed files
with
291 additions
and
51 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
docs/app/@theme/components/for-business/for-business.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,90 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
@import '../../styles/themes'; | ||
|
||
:host { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 55.625rem; | ||
overflow: hidden; | ||
|
||
background: nb-theme(background-basic-color-1); | ||
border: 1px solid nb-theme(border-basic-color-3); | ||
border-radius: nb-theme(border-radius); | ||
} | ||
|
||
.left, | ||
.right { | ||
padding: 2rem; | ||
} | ||
|
||
.left { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
$grad-start: nb-theme(color-primary-500); | ||
$grad-end: nb-theme(color-primary-400); | ||
background: linear-gradient(86.61deg, $grad-start 0.85%, $grad-end 99.82%); | ||
} | ||
|
||
.heading { | ||
text-align: center; | ||
} | ||
|
||
.submit { | ||
margin: auto auto 0; | ||
|
||
&.appearance-filled.status-control { | ||
color: nb-theme(text-primary-color); | ||
text-transform: none; | ||
} | ||
} | ||
|
||
.offerings-title { | ||
color: rgba(nb-theme(color-fg-heading), 0.5); | ||
} | ||
|
||
.offerings { | ||
margin: 1.5rem 0 0; | ||
padding: 0; | ||
list-style: none; | ||
} | ||
|
||
.offering { | ||
margin-bottom: 0.5rem; | ||
|
||
&::before { | ||
content: '•'; | ||
margin-right: 0.15rem; | ||
} | ||
} | ||
|
||
@include media-breakpoint-up(md) { | ||
:host { | ||
flex-direction: row; | ||
} | ||
|
||
.left { | ||
max-width: 21rem; | ||
padding: 3rem; | ||
} | ||
|
||
.right { | ||
padding: 3.625rem 2.25rem; | ||
} | ||
|
||
.offerings-title-second-line { | ||
display: block; | ||
} | ||
} | ||
|
||
@include media-breakpoint-up(lg) { | ||
.offerings { | ||
columns: 2; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
docs/app/@theme/components/for-business/for-business.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,59 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { ChangeDetectionStrategy, Component } from '@angular/core'; | ||
import { NbDialogService } from '@nebular/theme'; | ||
|
||
import { NgdHubspotFormDialogComponent } from '../hubspot-form-dialog/hubspot-form-dialog.component'; | ||
|
||
@Component({ | ||
selector: 'ngd-for-business', | ||
template: ` | ||
<div class="left"> | ||
<h2 [attr.id]="headingId" class="heading h1 text-control">Nebular for business</h2> | ||
<button (click)="openDialog()" class="submit" nbButton status="control">Submit your request</button> | ||
</div> | ||
<div class="right"> | ||
<p class="h6 offerings-title"> | ||
If you use Nebular for business, | ||
<span class="offerings-title-second-line">we'd like to offer you:</span> | ||
</p> | ||
<ul class="offerings"> | ||
<li class="offering text-hint" *ngFor="let offering of offerings">{{ offering }}</li> | ||
</ul> | ||
</div> | ||
`, | ||
exportAs: 'ngdForBusiness', | ||
styleUrls: ['./for-business.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class NgdForBusinessComponent { | ||
readonly headingId: string = 'ngd-for-business-heading'; | ||
|
||
offerings: string[] = [ | ||
'A custom template development', | ||
'Developers, designers, analytics, QA, PM & marketing', | ||
'Nebular customization services', | ||
'The review of your project', | ||
]; | ||
|
||
constructor(private dialogService: NbDialogService) { | ||
} | ||
|
||
openDialog(): void { | ||
const context = { | ||
title: 'Nebular for business', | ||
formConfig: { | ||
portalId: '2452262', | ||
formId: '40c56c10-9b41-4d12-95dd-e6c186ac4273', | ||
}, | ||
}; | ||
|
||
this.dialogService.open(NgdHubspotFormDialogComponent, { context }); | ||
} | ||
} |
46 changes: 0 additions & 46 deletions
46
docs/app/@theme/components/hero/download-dialog.component.ts
This file was deleted.
Oops, something went wrong.
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
7 changes: 7 additions & 0 deletions
7
...nents/hero/download-dialog.component.scss → ...dialog/hubspot-form-dialog.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
89 changes: 89 additions & 0 deletions
89
docs/app/@theme/components/hubspot-form-dialog/hubspot-form-dialog.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,89 @@ | ||
/** | ||
* @license | ||
* Copyright Akveo. All Rights Reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*/ | ||
|
||
import { AfterViewInit, ChangeDetectorRef, Component, ElementRef, Inject, OnInit, ViewChild } from '@angular/core'; | ||
import { NB_WINDOW, NbDialogRef } from '@nebular/theme'; | ||
|
||
let formContainerUniqueId = 0; | ||
|
||
@Component({ | ||
template: ` | ||
<nb-card> | ||
<nb-card-header> | ||
<span>{{ title }}</span> | ||
<button nbButton appearance="ghost" class="close-button" (click)="closeDialog()"> | ||
<nb-icon icon="close" pack="eva"></nb-icon> | ||
</button> | ||
</nb-card-header> | ||
<nb-card-body [nbSpinner]="showSpinner"> | ||
<div #formContainer [attr.id]="formContainerId"></div> | ||
</nb-card-body> | ||
</nb-card> | ||
`, | ||
styleUrls: ['./hubspot-form-dialog.component.scss'], | ||
}) | ||
export class NgdHubspotFormDialogComponent implements OnInit, AfterViewInit { | ||
|
||
protected readonly defaultConfig = { | ||
submitButtonClass: 'hs-submit-btn btn', | ||
css: '', | ||
cssClass: 'hs-custom-form', | ||
}; | ||
|
||
showSpinner: boolean = false; | ||
|
||
formContainerId: string = `hubspot-form-container-id-${formContainerUniqueId++}`; | ||
title: string; | ||
formConfig; | ||
|
||
@ViewChild('formContainer') formContainer: ElementRef<HTMLDivElement>; | ||
|
||
constructor( | ||
protected ref: NbDialogRef<NgdHubspotFormDialogComponent>, | ||
protected cd: ChangeDetectorRef, | ||
@Inject(NB_WINDOW) protected window, | ||
) {} | ||
|
||
ngOnInit() { | ||
this.showSpinner = this.couldEnableSpinner(); | ||
} | ||
|
||
ngAfterViewInit() { | ||
const config = this.createConfig(); | ||
|
||
if (this.showSpinner) { | ||
this.listenFormInit(); | ||
} | ||
|
||
(window as unknown as { hbspt: any }).hbspt.forms.create(config); | ||
} | ||
|
||
closeDialog(): void { | ||
this.ref.close(); | ||
} | ||
|
||
private createConfig() { | ||
const config = { ...this.defaultConfig, ...this.formConfig }; | ||
if (!config.target) { | ||
config.target = '#' + this.formContainerId; | ||
} | ||
return config; | ||
} | ||
|
||
protected couldEnableSpinner(): boolean { | ||
return !!this.window.MutationObserver; | ||
} | ||
|
||
protected listenFormInit(): void { | ||
const observer = new MutationObserver(() => { | ||
this.showSpinner = false; | ||
this.cd.markForCheck(); | ||
observer.disconnect(); | ||
}); | ||
|
||
observer.observe(this.formContainer.nativeElement, { childList: true }); | ||
} | ||
} |
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
Oops, something went wrong.