Skip to content

Commit

Permalink
feat: #12 add circle list-style support
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Apr 3, 2020
1 parent cc768d2 commit 7a8be71
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 6 deletions.
20 changes: 20 additions & 0 deletions src/app/presentation/ledge-helper/ledge-helper.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@ export class LedgeHelperComponent implements OnInit {
content = `
# Syntax Test
\`\`\`list-style
- 开源工具采用
- 商业采购
- 自研研发交通平台
config: {"type": "circle"}
\`\`\`
\`\`\`list-style
- 基于开源方案遇到困难
- 性能瓶颈
- 业务需求⽇益多元化,但团队规模有限
- 扩展更多的能力
- 更多元化的代码质量检查
- 审计需求
- 二进制、镜像安全扫描
config: {"type": "group-square"}
\`\`\`
\`\`\`echarts
{
"series": [
Expand Down
8 changes: 8 additions & 0 deletions src/app/shared/ledge-render/ledge-render.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
</div>
</div>

<div *ngSwitchCase="'list-style'">
<div class="list-style list-style-{{item.config.type}}">
<div *ngFor="let listItem of item.data;let index = index;" class="list-style-item item-{{index}}">
{{listItem.name}}
</div>
</div>
</div>

<div *ngSwitchCase="'heading'">
<h1 *ngIf="item.depth === 1">{{item.text}}</h1>
<h2 *ngIf="item.depth === 2">{{item.text}}</h2>
Expand Down
9 changes: 9 additions & 0 deletions src/app/shared/ledge-render/ledge-render.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ export class LedgeRenderComponent implements OnInit, AfterViewInit, OnChanges {
case 'echarts':
this.markdownData.push({ type: 'echarts', data: codeBlock.text });
break;
case 'list-style':
const listData = LedgeMarkdownConverter.toJson(codeBlock.text);
console.log(listData.lists);
this.markdownData.push({
type: 'list-style',
data: listData.lists[0].children,
config: listData.config,
});
break;
default:
this.markdownData.push(token);
break;
Expand Down
14 changes: 8 additions & 6 deletions src/styles/mdstyles/_list-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
text-align: center;

.list-style-item {
&.item-1 {background: #A1763A;}
&.item-2 {background: #1c4c78;}
&.item-3 {background: #994538;}
&.item-0 {background: #A1763A;}
&.item-1 {background: #1c4c78;}
&.item-2 {background: #994538;}
&.item-3 {background: red;}

width: 200px;
height: 200px;
Expand All @@ -25,9 +26,10 @@
text-align: center;

> .list-style-item {
&.item-1 {background: #A1763A;}
&.item-2 {background: #1c4c78;}
&.item-3 {background: #994538;}
&.item-0 {background: #A1763A;}
&.item-1 {background: #1c4c78;}
&.item-2 {background: #994538;}
&.item-3 {background: red;}

width: 320px;
height: 240px;
Expand Down

0 comments on commit 7a8be71

Please sign in to comment.