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(card): make two smaller cards same height as one large #1821

Merged
merged 4 commits into from
Jul 25, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/app/playground-components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ export const PLAYGROUND_COMPONENTS: ComponentLink[] = [
component: 'CardWithoutBodyComponent',
name: 'Card Without Body',
},
{
path: 'card-sizes-combinations.component',
link: '/card/card-sizes-combinations.component',
component: 'CardSizesCombinationsComponent',
name: 'Card Sizes Combinations',
},
],
},
{
Expand Down
3 changes: 3 additions & 0 deletions src/framework/theme/components/card/card.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ export class NbCardFooterComponent {
* as well as combine it with `status`:
* @stacked-example(Accent Card, card/card-accents.component)
*
* Cards of smaller sizes could be combined and put on the same row with a bigger card so they have the same heights.
* @stacked-example(Card sizes combinations, card/card-sizes-combinations.component)
*
* @additional-example(Multiple Sizes, card/card-sizes.component)
*
* @styles
Expand Down
12 changes: 6 additions & 6 deletions src/framework/theme/styles/themes/_mapping.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ $eva-mapping: (
card-header-danger-background-color: color-danger-default,
card-header-danger-text-color: text-control-color,

card-height-tiny: 6rem,
card-height-small: 21rem,
card-height-medium: 28.5rem,
card-height-large: 36rem,
card-height-giant: 43.5rem,
card-margin-bottom: 1.5rem,
card-height-tiny: 13.5rem,
card-height-small: 21.1875rem,
card-height-medium: 28.875rem,
card-height-large: 36.5625rem,
card-height-giant: 44.25rem,
card-margin-bottom: 1.875rem,

card-scrollbar-color: scrollbar-color,
card-scrollbar-background-color: scrollbar-background-color,
Expand Down
5 changes: 5 additions & 0 deletions src/playground/with-layout/card/card-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { CardShowcaseComponent } from './card-showcase.component';
import { CardSizesComponent } from './card-sizes.component';
import { CardTestComponent } from './card-test.component';
import { CardWithoutBodyComponent } from './card-without-body.component';
import { CardSizesCombinationsComponent } from './card-sizes-combinations.component';

const routes: Route[] = [
{
Expand Down Expand Up @@ -43,6 +44,10 @@ const routes: Route[] = [
path: 'card-without-body.component',
component: CardWithoutBodyComponent,
},
{
path: 'card-sizes-combinations.component',
component: CardSizesCombinationsComponent,
},
];

@NgModule({
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<div class="card-row">
<div class="card-col">
<nb-card size="tiny">
<nb-card-header>Tiny card</nb-card-header>
</nb-card>
<nb-card size="tiny">
<nb-card-header>Tiny card</nb-card-header>
</nb-card>
</div>
<div class="card-col">
<nb-card size="medium">
<nb-card-header>Medium card</nb-card-header>
</nb-card>
</div>
</div>

<div class="card-row">
<div class="card-col">
<nb-card size="tiny">
<nb-card-header>Tiny card</nb-card-header>
</nb-card>
<nb-card size="small">
<nb-card-header>Small card</nb-card-header>
</nb-card>
</div>
<div class="card-col">
<nb-card size="large">
<nb-card-header>Large card</nb-card-header>
</nb-card>
</div>
</div>

<div class="card-row">
<div class="card-col">
<nb-card size="tiny">
<nb-card-header>Tiny card</nb-card-header>
</nb-card>
<nb-card size="medium">
<nb-card-header>Medium card</nb-card-header>
</nb-card>
</div>
<div class="card-col">
<nb-card size="giant">
<nb-card-header>Giant card</nb-card-header>
</nb-card>
</div>
</div>

<div class="card-row">
<div class="card-col">
<nb-card size="tiny">
<nb-card-header>Tiny card</nb-card-header>
</nb-card>
<nb-card size="tiny">
<nb-card-header>Tiny card</nb-card-header>
</nb-card>
<nb-card size="tiny">
<nb-card-header>Tiny card</nb-card-header>
</nb-card>
</div>
<div class="card-col">
<nb-card size="giant">
<nb-card-header>Giant card</nb-card-header>
</nb-card>
</div>
</div>

<div class="card-row">
<div class="card-col">
<nb-card size="small">
<nb-card-header>Small card</nb-card-header>
</nb-card>
<nb-card size="small">
<nb-card-header>Small card</nb-card-header>
</nb-card>
</div>
<div class="card-col">
<nb-card size="giant">
<nb-card-header>Giant card</nb-card-header>
</nb-card>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
:host {
display: block;
max-height: 25rem;
overflow-x: hidden;
overflow-y: auto;
}

.card-row {
display: flex;
margin: 0 -0.5rem;
}

.card-col {
flex: 1 0 calc(50% - 1rem);
margin: 0 0.5rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Component } from '@angular/core';

@Component({
templateUrl: './card-sizes-combinations.component.html',
styleUrls: ['./card-sizes-combinations.component.scss'],
})
export class CardSizesCombinationsComponent {}
2 changes: 2 additions & 0 deletions src/playground/with-layout/card/card.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { CardShowcaseComponent } from './card-showcase.component';
import { CardSizesComponent } from './card-sizes.component';
import { CardTestComponent } from './card-test.component';
import { CardWithoutBodyComponent } from './card-without-body.component';
import { CardSizesCombinationsComponent } from './card-sizes-combinations.component';

@NgModule({
declarations: [
Expand All @@ -25,6 +26,7 @@ import { CardWithoutBodyComponent } from './card-without-body.component';
CardSizesComponent,
CardTestComponent,
CardWithoutBodyComponent,
CardSizesCombinationsComponent,
],
imports: [
CommonModule,
Expand Down