Skip to content

Commit

Permalink
feat: add basic left case support
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 12, 2020
1 parent ddbecae commit 57c7c3f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/app/presentation/case-study/case-study.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<div class="markdown title center">
<h1>案例学习</h1>
</div>

<component-markdown-render [src]="'assets/docs/casestudies/daocloud.md'"></component-markdown-render>
<component-markdown-render [src]="'assets/docs/casestudies/cmb.md'"></component-markdown-render>
<mat-drawer-container class="case-study">
<mat-drawer mode="side" opened class="left-drawer">
<h2>案例(源自互联网收集)</h2>
<ul>
<li *ngFor="let case of cases" (click)="clickCase(case.source)">{{case.displayName}}</li>
</ul>
</mat-drawer>
<mat-drawer-content>
<component-markdown-render [src]="src"></component-markdown-render>
</mat-drawer-content>
</mat-drawer-container>
23 changes: 23 additions & 0 deletions src/app/presentation/case-study/case-study.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.case-study {
min-height: 600px;
height: 100%;
}

.left-drawer {
width: 15%;
min-width: 200px;
padding-left: 20px;
min-height: 100vh;
height: 100vh;

h2 {
margin-top: 20px;
text-align: center;
}

li {
font-size: 1.2rem;
padding: 1rem;
display: block;
}
}
11 changes: 10 additions & 1 deletion src/app/presentation/case-study/case-study.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';

@Component({
Expand All @@ -7,6 +7,12 @@ import {Title} from '@angular/platform-browser';
styleUrls: ['./case-study.component.scss']
})
export class CaseStudyComponent implements OnInit {
cases = [
{displayName: 'DaoCloud', source: 'daocloud'},
{displayName: '美团外卖', source: 'meituan'},
{displayName: '招商银行', source: 'cmb'},
];
src = `assets/docs/casestudies/meituan.md`;

constructor(title: Title) {
title.setTitle('DevOps 学习平台 Ledge - 案例学习');
Expand All @@ -15,4 +21,7 @@ export class CaseStudyComponent implements OnInit {
ngOnInit(): void {
}

clickCase(source: string) {
this.src = `assets/docs/casestudies/${source}.md`;
}
}
2 changes: 2 additions & 0 deletions src/app/shared/custom-material.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { MatButtonModule } from '@angular/material/button';
import { MatMenuModule } from '@angular/material/menu';
import {MatProgressSpinnerModule} from '@angular/material/progress-spinner';
import {MatSliderModule} from '@angular/material/slider';
import {MatDrawer, MatSidenavModule} from '@angular/material/sidenav';

const modules = [
MatToolbarModule,
MatButtonModule,
MatMenuModule,
MatProgressSpinnerModule,
MatSliderModule,
MatSidenavModule
];

@NgModule({
Expand Down

0 comments on commit 57c7c3f

Please sign in to comment.