Skip to content

Commit

Permalink
fix(module: codebox): fix show code window back title always show '返回' (
Browse files Browse the repository at this point in the history
#35)

* fix(module: codebox): fix show code window back title always show '返回'

* fix(module:codebox): format code
  • Loading branch information
Guoyuanqiang committed Oct 12, 2018
1 parent 97639fc commit 0720fdc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
Expand Up @@ -15,7 +15,7 @@
[nzWidth]="nzWidth"
[nzTitle]="nzTitle"
[nzCancelText]="null"
[nzOkText]="'返回'"
[nzOkText]="nzOkText()"
(nzOnCancel)="handleCancel()"
(nzOnOk)="handleOk()"
>
Expand All @@ -24,19 +24,19 @@
</span>
</nz-tooltip>
</section>
<div class="code-box-actions" style="position: relative; top: 0">
<nz-tooltip [nzTitle]="'Edit On StackBlitz'">
<i nz-tooltip class="anticon anticon-form code-box-code-copy" style="opacity: 1;" (click)="openOnStackBlitz()"></i>
</nz-tooltip>
<nz-tooltip [nzTitle]="'Copy Code'">
<i nz-tooltip class="anticon anticon-copy code-box-code-copy" style="opacity: 1;" [class.anticon-copy]="!_copied" [class.anticon-check]="_copied" [class.ant-tooltip-open]="_copied" (click)="copyCode(nzRawCode)"></i>
</nz-tooltip>
<nz-tooltip [nzTitle]="'Copy Generate Command'" *ngIf="nzGenerateCommand">
<i nz-tooltip class="anticon anticon-code-o code-box-code-copy" style="opacity: 1;" [class.anticon-code-o]="!_commandCopied" [class.anticon-check]="_commandCopied" [class.ant-tooltip-open]="_commandCopied" (click)="copyGenerateCommand(nzGenerateCommand)"></i>
</nz-tooltip>
</div>
<section class="highlight-wrapper" [ngClass]="{'highlight-wrapper-expand':true}">
<div class="highlight">
<div class="code-box-actions">
<nz-tooltip [nzTitle]="'Edit On StackBlitz'">
<i nz-tooltip class="anticon anticon-form code-box-code-copy" (click)="openOnStackBlitz()"></i>
</nz-tooltip>
<nz-tooltip [nzTitle]="'Copy Code'">
<i nz-tooltip class="anticon anticon-copy code-box-code-copy" [class.anticon-copy]="!_copied" [class.anticon-check]="_copied" [class.ant-tooltip-open]="_copied" (click)="copyCode(nzRawCode)"></i>
</nz-tooltip>
<nz-tooltip [nzTitle]="'Copy Generate Command'" *ngIf="nzGenerateCommand">
<i nz-tooltip class="anticon anticon-code-o code-box-code-copy" [class.anticon-code-o]="!_commandCopied" [class.anticon-check]="_commandCopied" [class.ant-tooltip-open]="_commandCopied" (click)="copyGenerateCommand(nzGenerateCommand)"></i>
</nz-tooltip>
</div>
<ng-content select="[code]"></ng-content>
<nz-highlight [nzCode]="_code" [nzLanguage]="'typescript'"></nz-highlight>
</div>
Expand Down
Expand Up @@ -69,6 +69,14 @@ export class NzCodeBoxComponent implements OnInit {
this.nzExpanded = false;
}

nzOkText() {
if (window.location.href.split('/').splice(-1)[0] === 'zh') {
return '返回';
} else {
return 'Back';
}
}

copyGenerateCommand(command) {
this.copy(command).then(() => {
this._commandCopied = true;
Expand Down
2 changes: 1 addition & 1 deletion scripts/site/_site/src/style/demo.less
Expand Up @@ -138,7 +138,7 @@
text-align: center;
font-size: 14px;
font-weight: bold;
border: 1px solid #ededed;
border: 1px solid #ccc;
padding: 8px;
border-radius: 16px;
background-color: rgba(256, 256, 256, 0.6);
Expand Down

0 comments on commit 0720fdc

Please sign in to comment.