Skip to content

Commit

Permalink
Added Share button share the link
Browse files Browse the repository at this point in the history
  • Loading branch information
Varshithvhegde committed Oct 19, 2023
1 parent b5c7efd commit 2915f68
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { MatIconModule } from '@angular/material/icon';
import { ContentResolver } from './ContentService/contentresolver.service';
import { NavigationComponent } from './navigation/navigation.component';
import { PasswordComponent } from './password/password.component';
import { MatTooltipModule } from '@angular/material/tooltip';
// import {c}

@NgModule({
Expand All @@ -44,6 +45,7 @@ import { PasswordComponent } from './password/password.component';
MatButtonModule,
MatToolbarModule,
MatIconModule,
MatTooltipModule,
provideFirebaseApp(() =>
initializeApp({
projectId: environment.FIREBASE_PROJECT_ID,
Expand Down
14 changes: 7 additions & 7 deletions src/app/navigation/navigation.component.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<mat-toolbar color="primary">

<span>NOTECODE</span>
<span>NotePage</span>
<span class="spacer"></span>
<button mat-icon-button>
<mat-icon>lock</mat-icon>
<button mat-icon-button matTooltip="Lock the Page">
<mat-icon>lock</mat-icon>
</button>
<button mat-icon-button>
<mat-icon>account_circle</mat-icon>
<button mat-icon-button matTooltip="Share the Link" (click)="sharePage()">
<mat-icon>share</mat-icon>
</button>
</mat-toolbar>
</mat-toolbar>

15 changes: 14 additions & 1 deletion src/app/navigation/navigation.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';

@Component({
selector: 'app-navigation',
templateUrl: './navigation.component.html',
styleUrls: ['./navigation.component.css']
styleUrls: ['./navigation.component.css'],
})
export class NavigationComponent {
constructor(private router: Router, private route: ActivatedRoute) {}

sharePage() {
// OPen share menu of the browser when the share button is clicked
navigator
.share({
title: 'Note Page',
text: 'Check out this note page',
url: window.location.href,
})
.then(() => console.log('Successful share'))
.catch((error) => console.log('Error sharing', error));
}
}

0 comments on commit 2915f68

Please sign in to comment.