Skip to content

Commit

Permalink
feat(selectable-card): add retail selectable card (#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and GitHub Enterprise committed May 18, 2021
1 parent ef5713f commit b55c00a
Show file tree
Hide file tree
Showing 31 changed files with 564 additions and 327 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@ import { NxCardModule } from '@aposin/ng-aquila/card';

import { NgModule } from '@angular/core';
import { CardExampleComponent } from './card/card-example';
import { CardFooterExampleComponent } from './card-footer/card-footer-example';
import { SelectableCardBasicExampleComponent } from './selectable-card-basic/selectable-card-basic-example';
import { SelectableCardDynamicExampleComponent } from './selectable-card-dynamic/selectable-card-dynamic-example';
import { SelectableCardReactiveExampleComponent } from './selectable-card-reactive/selectable-card-reactive-example';
import { SelectableCardStatesExampleComponent } from './selectable-card-states/selectable-card-states-example';
import { ExamplesSharedModule } from '../examples-shared.module';
import { NxPopoverModule } from '@aposin/ng-aquila/popover';
import { SelectableCardProductExampleComponent } from './selectable-card-product/selectable-card-product-example';
import { SelectableCardExpertExampleComponent } from './selectable-card-expert/selectable-card-expert-example';

const EXAMPLES = [
CardExampleComponent,
CardFooterExampleComponent,
SelectableCardBasicExampleComponent,
SelectableCardDynamicExampleComponent,
SelectableCardReactiveExampleComponent,
SelectableCardStatesExampleComponent
SelectableCardStatesExampleComponent,
SelectableCardProductExampleComponent,
SelectableCardExpertExampleComponent
];

@NgModule({
imports: [
NxCardModule,
NxIconModule,
NxLinkModule,
NxPopoverModule,
ExamplesSharedModule,
RouterModule
],
Expand All @@ -36,11 +40,12 @@ export class CardExamplesModule {
static components() {
return {
'card': CardExampleComponent,
'card-footer': CardFooterExampleComponent,
'selectable-card-basic': SelectableCardBasicExampleComponent,
'selectable-card-dynamic': SelectableCardDynamicExampleComponent,
'selectable-card-reactive': SelectableCardReactiveExampleComponent,
'selectable-card-states': SelectableCardStatesExampleComponent,
'selectable-card-product': SelectableCardProductExampleComponent,
'selectable-card-expert': SelectableCardExpertExampleComponent,
};
}
}

This file was deleted.

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nx-selectable-card>
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit</p>
<nx-selectable-card class="nx-margin-bottom-2m">
<div class="content"></div>
</nx-selectable-card>

<nx-selectable-card checked>
<div class="content"></div>
</nx-selectable-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.content {
height: 100px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'selectable-card-basic-example',
templateUrl: './selectable-card-basic-example.html',
styleUrls: ['./selectable-card-basic-example.css']
styleUrls: ['./selectable-card-basic-example.scss']
})
export class SelectableCardBasicExampleComponent {
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,9 @@
<form [formGroup]="myFormGroup">
<div nxRow formArrayName="cards">
<div *ngFor="let card of cards.controls; index as i"
nxCol="12,12,12,3">
nxCol="12,12,12,4">
<nx-selectable-card [formControlName]="i" class="nx-margin-bottom-xs">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet,
consectetur, adipisci velit
</p>
<h3 nxCopytext class="nx-margin-bottom-2m">Card headline</h3>
</nx-selectable-card>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<nx-selectable-card class="nx-margin-bottom-2m" appearance="expert">
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
<p nxCopytext>Default selectable card</p>
</nx-selectable-card>

<nx-selectable-card class="nx-margin-bottom-2m" checked appearance="expert">
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
<p nxCopytext>Checked selectable card</p>
</nx-selectable-card>

<nx-selectable-card class="nx-margin-bottom-2m" appearance="expert" disabled>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
<p nxCopytext>Disabled selectable card</p>
</nx-selectable-card>

<nx-selectable-card class="nx-margin-bottom-2m" checked appearance="expert" disabled>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
<p nxCopytext>Disabled checked selectable card</p>
</nx-selectable-card>

<form [formGroup]="formGroup">
<nx-selectable-card formControlName="card" appearance="expert">
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
<p nxCopytext>Required selectable card</p>
<nx-error appearance="text">
This card must be selected.
</nx-error>
</nx-selectable-card>
</form>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

/**
* @title Selectable cards expert example
*/
@Component({
selector: 'selectable-card-expert-example',
templateUrl: './selectable-card-expert-example.html',
styleUrls: ['./selectable-card-expert-example.css']
})
export class SelectableCardExpertExampleComponent {
formGroup: FormGroup;

constructor(private fb: FormBuilder) {
this.createForm();
}

createForm() {
this.formGroup = this.fb.group({
card: [false, Validators.requiredTrue]
});
this.formGroup.markAllAsTouched();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<nx-selectable-card>
<div class="card">
<img height="56" src="/assets/images/selectable-card.svg" alt="product image" />
<div class="content">
<div>
<h3 nxCopytext class="nx-font-weight-semibold nx-margin-bottom-2xs">
Card headline
</h3>
<p nxCopytext="medium" class="nx-margin-bottom-2xs">
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet,<br/> consectetur, adipisci velit
</p>
<span nxCopytext>$ 10 /monthly</span>
</div>
<button nxPlainButton class="nx-margin-left-xs" [nxPopoverTriggerFor]="popover" nxPopoverTrigger="click">
<nx-icon size="s" name="info-circle-o"></nx-icon>
<nx-popover #popover>
<span nxCopytext>Trigger by click</span>
</nx-popover>
</button>
</div>
</div>
</nx-selectable-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.card {
display: flex;
}

img {
flex: 0 0 auto;
margin-right: 16px;
}

.content {
display: flex;
align-items: flex-start;
justify-content: space-between;
flex-basis: 100%;
}

@media (max-width: 703px) {
.card {
display: block;
}

img {
margin-right: 0;
margin-bottom: 8px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Component } from '@angular/core';

/**
* @title Selectable cards product example
*/
@Component({
selector: 'selectable-card-product-example',
templateUrl: './selectable-card-product-example.html',
styleUrls: ['./selectable-card-product-example.scss']
})
export class SelectableCardProductExampleComponent {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.content {
height: 100px;
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
<form [formGroup]="testForm">
<nx-selectable-card formControlName="selectableCardTestReactive">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit</p>
<nx-error appearance="text">
<div class="content"></div>
<nx-error>
This card must be selected.
</nx-error>
</nx-selectable-card>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.content {
height: 124px;
}
Original file line number Diff line number Diff line change
@@ -1,55 +1,40 @@
<nx-selectable-card class="nx-margin-bottom-xs">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Default selectable card</p>
</nx-selectable-card>

<nx-selectable-card checked class="nx-margin-bottom-xs">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Checked selectable card</p>
</nx-selectable-card>

<nx-selectable-card disabled class="nx-margin-bottom-xs">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Disabled selectable card</p>
</nx-selectable-card>

<nx-selectable-card disabled checked class="nx-margin-bottom-xs">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Disabled and checked selectable card</p>
</nx-selectable-card>

<form [formGroup]="formGroup">
<nx-selectable-card required formControlName="errorCard" class="nx-margin-bottom-xs">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Selectable card with error</p>
<nx-error appearance="text">
This card must be selected.
</nx-error>
</nx-selectable-card>

<nx-selectable-card required formControlName="errorCard2" class="nx-margin-bottom-xs">
<nx-card-header>
<h3 nxHeadline="subsection-small">Card headline</h3>
<hr>
</nx-card-header>
<p>Checked selectable card with error</p>
<nx-error appearance="text">
This card must not be selected.
</nx-error>
</nx-selectable-card>
<form [formGroup]="formGroup" nxLayout="grid">
<div nxRow>
<div nxCol="12,12,6,6">
<nx-selectable-card class="nx-margin-bottom-2m">
<h3 nxCopytext class="content">Default selectable card</h3>
</nx-selectable-card>
</div>
<div nxCol="12,12,6,6">
<nx-selectable-card checked class="nx-margin-bottom-2m">
<h3 nxCopytext class="content">Checked selectable card</h3>
</nx-selectable-card>
</div>
<div nxCol="12,12,6,6">
<nx-selectable-card disabled class="nx-margin-bottom-2m">
<h3 nxCopytext class="content">Disabled selectable card</h3>
</nx-selectable-card>
</div>
<div nxCol="12,12,6,6">
<nx-selectable-card disabled checked class="nx-margin-bottom-2m">
<h3 nxCopytext class="content">Disabled and checked selectable card</h3>
</nx-selectable-card>
</div>
<div nxCol="12,12,6,6">
<nx-selectable-card formControlName="errorCard" class="nx-margin-bottom-2m">
<h3 nxCopytext class="content">Selectable card with error</h3>
<nx-error>
This card must be selected.
</nx-error>
</nx-selectable-card>
</div>
<div nxCol="12,12,6,6">
<nx-selectable-card formControlName="errorCard2">
<h3 nxCopytext class="content">This card must not be selected.</h3>
<nx-error>
This card must not be selected.
</nx-error>
</nx-selectable-card>
</div>
</div>
</form>
4 changes: 4 additions & 0 deletions projects/ng-aquila/src/card/card-footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';

/**
* @deprecated Place all your content directly into the <nx-card> or <nx-selectable-card> instead.
* @deletion-target 13.0.0
*/
@Component({
selector: 'nx-card-footer',
templateUrl: './card-footer.component.html',
Expand Down
Loading

0 comments on commit b55c00a

Please sign in to comment.