Skip to content

Commit

Permalink
feat: add record last case study
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Mar 13, 2020
1 parent 2a6a8fa commit 1d30b18
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
20 changes: 17 additions & 3 deletions src/app/presentation/case-study/case-study.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Component, OnInit} from '@angular/core';
import {Title} from '@angular/platform-browser';
import {StorageMap} from '@ngx-pwa/local-storage';

@Component({
selector: 'app-case-study',
Expand All @@ -13,18 +14,31 @@ export class CaseStudyComponent implements OnInit {
{displayName: '招商银行', source: 'cmb'},
{displayName: 'HP', source: 'hp'},
];
src = `assets/docs/casestudies/meituan.md`;
currentSource = 'meituan';
src = this.buildSrc(this.currentSource);

constructor(title: Title) {
constructor(title: Title, private storage: StorageMap) {
title.setTitle('DevOps 学习平台 Ledge - 案例学习');
this.storage.get('casestudy.last').subscribe((value: string) => {
if (!!value) {
this.currentSource = value;
this.src = this.buildSrc(this.currentSource);
}
});
}

ngOnInit(): void {

}

clickCase(source: string) {
this.src = `assets/docs/casestudies/${source}.md`;
this.src = this.buildSrc(source);
this.currentSource = source;

this.storage.set('casestudy.last', source).subscribe();
}

private buildSrc(source: string) {
return `assets/docs/casestudies/${source}.md`;
}
}
4 changes: 2 additions & 2 deletions src/styles/_process-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
background: #3498db;
text-align: center;
padding: 0 8px 0 0;
margin: 0 10px 0 0;
margin: 0 8px 0 0;

&:after {
content: "";
Expand All @@ -107,7 +107,7 @@
border-left: 22px solid #3498db;
position: absolute;
right: -22px;
top: -1px;
top: 0;
z-index: 1;
}

Expand Down

0 comments on commit 1d30b18

Please sign in to comment.