docs(download): add download button with hubspot form

This commit is contained in:
d.strigo 2020-07-10 13:00:07 +03:00
parent b232c95a6e
commit 70c407dac4
15 changed files with 302 additions and 25 deletions

View file

@ -0,0 +1,3 @@
<button matRipple (click)="openDialog()" class="btn btn-download">
Download
</button>

View file

@ -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 '../../../@theme/styles/themes';
@import '~@nebular/theme/styles/global/breakpoints';
@include nb-install-component() {
.btn {
font-family: nb-theme(font-main), sans-serif;
border-radius: 3px;
border: none;
background: #ffffff;
color: #000000;
padding: 1.125rem 0;
box-shadow: nb-theme(shadow-default);
cursor: pointer;
text-transform: uppercase;
&.btn-download {
margin-left: 1em;
color: #ffffff;
background-color: nb-theme(color-active-fg);
box-shadow: nb-theme(shadow-btn);
&:hover {
box-shadow: nb-theme(shadow-hover-green-btn);
}
&:active {
box-shadow: nb-theme(shadow-active-green-btn);
}
}
&.btn-download {
margin-left: 0;
margin-top: 1rem;
width: 100%;
}
&:hover {
box-shadow: nb-theme(shadow-hover-btn);
}
&:active {
box-shadow: nb-theme(shadow-active-btn);
}
}
@include media-breakpoint-down(md) {
.btn {
font-size: 0.7rem;
padding-bottom: 1rem;
padding-top: 1rem;
}
}
}

View file

@ -0,0 +1,24 @@
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { Component } from '@angular/core';
import { NbDialogService } from '@nebular/theme';
import { DownloadFormComponent } from '../download-form/download-form.component';
@Component({
selector: 'ngx-download-admin',
templateUrl: './download-admin.component.html',
styleUrls: ['./download-admin.component.scss'],
})
export class DownloadAdminComponent {
constructor(private dialogService: NbDialogService) {
}
openDialog() {
this.dialogService.open(DownloadFormComponent);
}
}

View file

@ -0,0 +1,8 @@
<nb-card>
<nb-card-body>
<div class="close-icon" (click)="closeDialog()">
<i [innerHTML]="'close' | eva: { width: 26, height: 26, fill: '#222b45' }"></i>
</div>
<div id="hubspotForm"></div>
</nb-card-body>
</nb-card>

View file

@ -0,0 +1,93 @@
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
@import '~@nebular/theme/styles/global/breakpoints';
@import '../../../@theme/styles/themes';
@include nb-install-component() {
nb-card-body {
position: relative;
}
.close-icon {
cursor: pointer;
position: absolute;
right: 0.1rem;
top: 0.1rem;
}
::ng-deep .custom-form {
.modal-header {
display: none;
}
.modal-body {
padding-bottom: 0;
}
.actions {
display: flex;
justify-content: flex-end;
}
input.hs-input {
width: 100%;
font-size: nb-theme(font-size-sm);
padding: 0.75rem 1rem !important;
border: 1px solid #e4e9f2;
box-shadow: nb-theme(shadow-default);
border-radius: 0.25rem;
&.invalid {
box-shadow: 0 0 1.25rem 0 rgba(210, 45, 45, 0.6);
}
&::placeholder {
color: #434a59;
opacity: 0.24;
}
&:focus {
outline: none;
}
}
.hs-error-msgs {
list-style-type: none;
padding: 0;
}
.hs-form-required, .hs-error-msg {
color: #f2545b;
}
.hs_error_rollup {
display: none;
}
.btn {
margin-top: 2rem;
font-family: nb-theme(font-main), sans-serif;
border-radius: 3px;
border: none;
background-color: nb-theme(color-active-fg);
color: #ffffff;
padding: 1rem 2rem;
box-shadow: nb-theme(shadow-btn);
cursor: pointer;
text-transform: uppercase;
&:hover {
box-shadow: nb-theme(shadow-hover-green-btn);
}
&:active {
box-shadow: nb-theme(shadow-active-green-btn);
}
}
}
}

View file

@ -0,0 +1,36 @@
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { AfterViewInit, Component, Inject } from '@angular/core';
import { NB_WINDOW, NbDialogRef } from '@nebular/theme';
@Component({
selector: 'ngx-download-form',
templateUrl: './download-form.component.html',
styleUrls: ['./download-form.component.scss'],
})
export class DownloadFormComponent implements AfterViewInit {
constructor(@Inject(NB_WINDOW) private window,
protected ref: NbDialogRef<DownloadFormComponent>) {
}
ngAfterViewInit() {
hbspt.forms.create({
portalId: '2452262',
formId: '93007d7b-5f11-4dd8-bcfd-f8b99d31f31e',
target: '#hubspotForm',
submitButtonClass: 'btn',
css: '',
cssClass: 'custom-form',
redirectUrl: 'https://github.com/akveo/ngx-admin',
});
}
closeDialog() {
this.ref.close();
}
}

View file

@ -1,3 +1,9 @@
/**
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { Component, ViewChild, AfterViewInit, Input } from '@angular/core';
import { coerceBooleanProperty } from '@angular/cdk/coercion';
import { NbPopoverDirective } from '@nebular/theme';