Skip to content

Commit 8890fee

Browse files
committed
Usage: Dynamically load other markdown files
1 parent b9e24af commit 8890fee

File tree

7 files changed

+25
-8
lines changed

7 files changed

+25
-8
lines changed

src/app/app-routing.module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const routes: Routes = [
1414
{ path: 'circular-heatmap', component: CircularHeatmapComponent },
1515
{ path: 'activity-description', component: ActivityDescriptionComponent },
1616
{ path: 'mapping', component: MappingComponent },
17-
{ path: 'usage', component: UsageComponent },
17+
{ path: 'usage', redirectTo: 'usage/' },
18+
{ path: 'usage/:page', component: UsageComponent },
1819
{ path: 'teams', component: TeamsComponent },
1920
{ path: 'about', component: AboutUsComponent },
2021
{ path: 'userday', component: UserdayComponent },

src/app/component/readme-to-html/readme-to-html.component.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
/*background-color: aqua;*/
33
padding: 30px;
44
padding-top: 0px;
5-
6-
}
5+
max-width: 40rem;
6+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div class="main-section">
2-
<div [innerHTML]="toRender"></div>
2+
<article [innerHTML]="toRender"></article>
33
</div>

src/app/component/teams/teams.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export class TeamsComponent implements OnInit {
1313
teamGroups: Map<string, string[]> = new Map();
1414

1515
constructor(private yaml: ymlService) {}
16+
1617
ngOnInit(): void {
1718
this.yaml.setURI('./assets/YAML/meta.yaml');
1819
// Function sets column header
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<app-top-header section="Usage"></app-top-header>
2-
<app-readme-to-html MDFile="./assets/Markdown Files/USAGE.md">
2+
<app-readme-to-html class="usage-{{ page }}" MDFile="./assets/Markdown Files/{{ page }}.md">
33
</app-readme-to-html>
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
import { Component } from '@angular/core';
1+
import { Component, OnInit } from '@angular/core';
2+
import { ActivatedRoute } from '@angular/router';
23

34
@Component({
45
selector: 'app-usage',
56
templateUrl: './usage.component.html',
67
styleUrls: ['./usage.component.css'],
78
})
8-
export class UsageComponent {
9-
constructor() {}
9+
export class UsageComponent implements OnInit {
10+
page: string = 'USAGE';
11+
constructor(private route: ActivatedRoute) {}
12+
13+
ngOnInit() {
14+
this.route.params.subscribe(params => {
15+
let page = params['page'];
16+
if (page.match(/^[\w.-]+$/)) {
17+
this.page = page;
18+
}
19+
});
20+
}
1021
}

src/styles.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ body { margin: 0; font-family: Roboto, "Helvetica Neue", sans-serif; }
1616
max-height: 100px;
1717
float: left;
1818
margin-right: 10px;
19+
}
20+
21+
.usage-dimensions img {
22+
max-width: 40rem;
1923
}

0 commit comments

Comments
 (0)