Skip to content

Commit

Permalink
feat: card header support secondary size
Browse files Browse the repository at this point in the history
  • Loading branch information
fengtianze committed May 10, 2022
1 parent e4efe38 commit 45db1b0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/card/card.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@ $b: aui-card;
@include card-shadow;

&__header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0;
font-weight: use-var(font-weight-bold);
@include text-set(xxl, main);

font-weight: use-var(font-weight-bold);
&--secondary {
@include text-set(xl);
}

+ .#{$b}__content {
margin-top: use-var(spacing-xl);
Expand Down
8 changes: 6 additions & 2 deletions src/card/helper-directives.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Directive } from '@angular/core';
import { Directive, Input } from '@angular/core';

@Directive({
selector: '[auiCardHeader]',
host: {
'[class.aui-card__header]': 'true',
'[class.aui-card__header--secondary]': 'size === "secondary"',
},
})
export class CardHeaderDirective {}
export class CardHeaderDirective {
@Input()
size: 'default' | 'secondary' = 'default';
}

@Directive({
selector: '[auiCardFooter]',
Expand Down
12 changes: 12 additions & 0 deletions stories/card/card.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,18 @@ import { CardModule } from '@alauda/ui';
</div>
<div auiCardFooter>footer</div>
</aui-card>
<aui-card [divider]="false">
<div
auiCardHeader
size="secondary"
>
secondary header
</div>
<div style="line-height: 64px; background-color: #ededed;">
content
</div>
<div auiCardFooter>footer</div>
</aui-card>
`,
}}
</Story>
Expand Down

0 comments on commit 45db1b0

Please sign in to comment.