Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from Oct 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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