Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Flag Component * β Add Flag Component tests * Fixed styling to please tests * π Update flag examples * π π Fix showcase-properties inputValues formatting * π π Add wrapping to avatar color examples * π Add `xxxxs` size * π Replace hardcoded px values with tokens * π Use flag component in item examples * π Refactor styling * β»οΈ Replace size directive with HostBinding * β Update tests * βͺ Revert * π¨ Clean up Co-authored-by: Christian K. Ibsen <jb7612@jyskebank.dk> Co-authored-by: Jakob Engelbrecht <jakob@basher.dk>
- Loading branch information
1 parent
9b847fc
commit a3e249e
Showing
27 changed files
with
382 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
apps/cookbook/src/app/examples/flag-example/examples/colors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
const config = { | ||
selector: 'cookbook-flag-example-colors', | ||
template: `<kirby-flag themeColor="success">Success</kirby-flag> | ||
<kirby-flag themeColor="warning">Warning</kirby-flag> | ||
<kirby-flag themeColor="danger">Danger</kirby-flag> | ||
<kirby-flag themeColor="semi-light">Semi-Light</kirby-flag> | ||
<kirby-flag themeColor="transparent" title="(default)">Transparent</kirby-flag>`, | ||
}; | ||
|
||
@Component({ | ||
selector: config.selector, | ||
template: config.template, | ||
styleUrls: ['./flag-examples.shared.scss'], | ||
}) | ||
export class FlagExampleColorsComponent { | ||
template: string = config.template; | ||
} |
40 changes: 40 additions & 0 deletions
40
apps/cookbook/src/app/examples/flag-example/examples/flag-examples.shared.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@import './libs/designsystem/src/lib/scss/utils'; | ||
|
||
:host { | ||
display: flex; | ||
align-items: flex-end; | ||
margin-bottom: size('s'); | ||
|
||
> * { | ||
margin-right: size('s'); | ||
margin-bottom: size('s'); | ||
} | ||
|
||
flex-wrap: wrap; | ||
|
||
&.align-top { | ||
align-items: flex-start; | ||
} | ||
} | ||
|
||
kirby-flag { | ||
position: relative; | ||
} | ||
|
||
kirby-flag[title] { | ||
margin-bottom: size('s'); | ||
|
||
&::before { | ||
content: ''; | ||
width: 100%; | ||
position: absolute; | ||
bottom: 0; | ||
transform: translateY(100%); | ||
font-size: font-size('xs'); | ||
text-align: center; | ||
} | ||
|
||
&[title='(default)']::before { | ||
content: '(default)'; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
apps/cookbook/src/app/examples/flag-example/examples/sizes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
const config = { | ||
selector: 'cookbook-flag-example-sizes', | ||
template: `<kirby-flag size="xs">Extra Small (xs)</kirby-flag> | ||
<kirby-flag size="sm">Small (sm)</kirby-flag> | ||
<kirby-flag size="md" title="(default)">Medium (md)</kirby-flag>`, | ||
}; | ||
|
||
@Component({ | ||
selector: config.selector, | ||
template: config.template, | ||
styleUrls: ['./flag-examples.shared.scss'], | ||
}) | ||
export class FlagExampleSizesComponent { | ||
template: string = config.template; | ||
} |
5 changes: 5 additions & 0 deletions
5
apps/cookbook/src/app/examples/flag-example/flag-example.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h2>Colors</h2> | ||
<cookbook-flag-example-colors></cookbook-flag-example-colors> | ||
|
||
<h2>Sizes</h2> | ||
<cookbook-flag-example-sizes></cookbook-flag-example-sizes> |
1 change: 1 addition & 0 deletions
1
apps/cookbook/src/app/examples/flag-example/flag-example.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import '../examples.shared'; |
8 changes: 8 additions & 0 deletions
8
apps/cookbook/src/app/examples/flag-example/flag-example.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'cookbook-flag-example', | ||
templateUrl: './flag-example.component.html', | ||
styleUrls: ['./flag-example.component.scss'], | ||
}) | ||
export class FlagExampleComponent {} |
16 changes: 16 additions & 0 deletions
16
apps/cookbook/src/app/examples/flag-example/flag-example.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
|
||
import { KirbyModule } from '@kirbydesign/designsystem'; | ||
|
||
import { FlagExampleColorsComponent } from './examples/colors'; | ||
import { FlagExampleSizesComponent } from './examples/sizes'; | ||
|
||
const COMPONENT_DECLARATIONS = [FlagExampleColorsComponent, FlagExampleSizesComponent]; | ||
|
||
@NgModule({ | ||
imports: [CommonModule, KirbyModule], | ||
declarations: COMPONENT_DECLARATIONS, | ||
exports: COMPONENT_DECLARATIONS, | ||
}) | ||
export class FlagExampleModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
apps/cookbook/src/app/showcase/flag-showcase/flag-showcase.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="example"> | ||
<h2>Colors</h2> | ||
<cookbook-example-viewer [html]="colorsExample.template"> | ||
<cookbook-flag-example-colors #colorsExample></cookbook-flag-example-colors> | ||
</cookbook-example-viewer> | ||
<h2>Sizes</h2> | ||
<cookbook-example-viewer [html]="sizesExample.template"> | ||
<cookbook-flag-example-sizes #sizesExample></cookbook-flag-example-sizes> | ||
</cookbook-example-viewer> | ||
|
||
<h4>Properties:</h4> | ||
<cookbook-showcase-properties [properties]="properties"></cookbook-showcase-properties> | ||
</div> |
1 change: 1 addition & 0 deletions
1
apps/cookbook/src/app/showcase/flag-showcase/flag-showcase.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import '../showcase.shared'; |
25 changes: 25 additions & 0 deletions
25
apps/cookbook/src/app/showcase/flag-showcase/flag-showcase.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
import { ShowcaseProperty } from '~/app/shared/showcase-properties/showcase-property'; | ||
|
||
@Component({ | ||
selector: 'cookbook-flag-showcase', | ||
templateUrl: './flag-showcase.component.html', | ||
styleUrls: ['./flag-showcase.component.scss'], | ||
}) | ||
export class FlagShowcaseComponent { | ||
properties: ShowcaseProperty[] = [ | ||
{ | ||
name: 'themeColor', | ||
description: 'Sets which color the flag should use.', | ||
defaultValue: 'transparent', | ||
inputValues: ['success', 'warning', 'danger', 'semi-light', 'transparent'], | ||
}, | ||
{ | ||
name: 'size', | ||
description: 'Sets the size of the flag.', | ||
defaultValue: 'md', | ||
inputValues: ['xs', 'sm', 'md'], | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
libs/designsystem/src/lib/components/flag/flag.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
@import '../../scss/utils'; | ||
|
||
:host { | ||
display: inline-block; | ||
background-color: var(--kirby-flag-background-color, transparent); | ||
color: var(--kirby-flag-color, get-color('white-contrast')); | ||
border: 1px solid var(--kirby-flag-border-color, get-color('medium')); | ||
border-radius: size('xxxs'); | ||
|
||
font-size: font-size('n'); | ||
|
||
padding-top: size('xxxxs'); | ||
padding-bottom: size('xxxxs'); | ||
padding-left: size('xxs'); | ||
padding-right: size('xxs'); | ||
|
||
&.sm { | ||
font-size: font-size('s'); | ||
} | ||
|
||
&.xs { | ||
font-size: font-size('xs'); | ||
padding-left: size('xxxs'); | ||
padding-right: size('xxxs'); | ||
} | ||
} | ||
|
||
@each $color-name, | ||
$color-value | ||
in map-merge( | ||
$notification-colors, | ||
( | ||
'semi-light': get-color('semi-light'), | ||
) | ||
) | ||
{ | ||
:host(.#{$color-name}) { | ||
--kirby-flag-background-color: #{get-color($color-name)}; | ||
--kirby-flag-color: #{get-color($color-name + '-contrast')}; | ||
--kirby-flag-border-color: #{get-color($color-name)}; | ||
} | ||
} |
Oops, something went wrong.