From ddd61248021c3d9344ccae2614c992b24d450d29 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Mon, 21 May 2018 12:55:22 +0100 Subject: [PATCH] feat(aio): display code-tabs in a Material Design "card" (#24027) This helps to connect the "content" of the tab to its label. Closes #23985 PR Close #24027 --- .../code/code-tabs.component.ts | 30 ++++++++++--------- .../custom-elements/code/code-tabs.module.ts | 4 +-- aio/src/styles/2-modules/_code.scss | 15 ++++++++-- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/aio/src/app/custom-elements/code/code-tabs.component.ts b/aio/src/app/custom-elements/code/code-tabs.component.ts index fc585e7198..d7759955c2 100644 --- a/aio/src/app/custom-elements/code/code-tabs.component.ts +++ b/aio/src/app/custom-elements/code/code-tabs.component.ts @@ -25,20 +25,22 @@ export interface TabInfo {
- - - - {{ tab.title }} - - - - - + + + + + {{ tab.title }} + + + + + + `, }) export class CodeTabsComponent implements OnInit, AfterViewInit { diff --git a/aio/src/app/custom-elements/code/code-tabs.module.ts b/aio/src/app/custom-elements/code/code-tabs.module.ts index 7dffaa19b6..eac0e29b37 100644 --- a/aio/src/app/custom-elements/code/code-tabs.module.ts +++ b/aio/src/app/custom-elements/code/code-tabs.module.ts @@ -1,12 +1,12 @@ import { NgModule, Type } from '@angular/core'; import { CommonModule } from '@angular/common'; import { CodeTabsComponent } from './code-tabs.component'; -import { MatTabsModule } from '@angular/material'; +import { MatCardModule, MatTabsModule } from '@angular/material'; import { CodeModule } from './code.module'; import { WithCustomElementComponent } from '../element-registry'; @NgModule({ - imports: [ CommonModule, MatTabsModule, CodeModule ], + imports: [ CommonModule, MatCardModule, MatTabsModule, CodeModule ], declarations: [ CodeTabsComponent ], exports: [ CodeTabsComponent ], entryComponents: [ CodeTabsComponent ] diff --git a/aio/src/styles/2-modules/_code.scss b/aio/src/styles/2-modules/_code.scss index 0e788ae48f..166b6ef114 100644 --- a/aio/src/styles/2-modules/_code.scss +++ b/aio/src/styles/2-modules/_code.scss @@ -3,8 +3,9 @@ code-example, code-tabs { display: block; } -code-example, -code-tabs mat-tab-body { +code-example { + + &:not(.no-box) { background-color: rgba($backgroundgray, 0.2); border: 0.5px solid $lightgray; @@ -27,6 +28,16 @@ code-tabs mat-tab-body { } } +code-example, code-tabs { + .mat-card { + padding: 0; + border-radius: 5px; + } + code { + overflow: auto; + } +} + // TERMINAL / SHELL TEXT STYLES code-example.code-shell, code-example[language=sh], code-example[language=bash] {