Skip to content

Commit

Permalink
update from review
Browse files Browse the repository at this point in the history
  • Loading branch information
bagrub committed Sep 17, 2024
1 parent 6b15e6b commit 696d10d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
12 changes: 10 additions & 2 deletions packages/web-components/src/components/cbp-card/cbp-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@
* @prop --cbp-banner-card-color-body-background-dark: var(--cbp-color-gray-cool-60);
* @prop --cbp-banner-card-color-border: var(--cbp-color-base-neutral-lighter);
* @prop --cbp-banner-card-color-border-dark: var(--cbp-color-gray-cool-50);
* @prop --cbp-flag-card-min-width: 7rem;
* @prop --cbp-flag-card-color: var(--cbp-color-text-lighter);
* @prop --cbp-flag-card-color-dark: var(--cbp-color-text-darker);
* @prop --cbp-flag-card-color-background: var(--cbp-color-gray-cool-60);
* @prop --cbp-flag-card-color-background-dark: var(--cbp-color-gray-cool-30);
*/

:root {
Expand All @@ -34,6 +40,7 @@
--cbp-banner-card-color-border: var(--cbp-color-base-neutral-lighter);
--cbp-banner-card-color-border-dark: var(--cbp-color-gray-cool-50);

--cbp-flag-card-min-width: 7rem;
--cbp-flag-card-color: var(--cbp-color-text-lighter);
--cbp-flag-card-color-dark: var(--cbp-color-text-darker);
--cbp-flag-card-color-background: var(--cbp-color-gray-cool-60);
Expand Down Expand Up @@ -73,6 +80,7 @@ cbp-card {
width: 100%;
max-width: 100%;
flex-grow: 1;
overflow: auto;

:last-child {
margin-bottom: 0;
Expand Down Expand Up @@ -239,11 +247,11 @@ cbp-card {
}
}

&[flag]{
&[variant=flag]{
flex-direction: row;

.cbp-card-flag{
width: 7rem;
min-width: var(--cbp-flag-card-min-width);
align-content: center;
text-align: center;
color: var(--cbp-flag-card-color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const BannerTemplate = ({ title, color, bodyText, withIcon, context, sx }) => {
const FlagTemplate = ({ title, color, flag, bodyText, withIcon, context, sx }) => {
return `
<cbp-card
flag='true'
variant='flag'
${color ? `color=${color}` : ''}
${context && context != 'light-inverts' ? `context=${context}` : ''}
${sx ? 'sx=' + JSON.stringify(sx) : ''}
Expand Down Expand Up @@ -304,7 +304,7 @@ BannerCard.args = {
export const FlagCard = FlagTemplate.bind({});
FlagCard.args = {
// flag: '<cbp-icon name="globe" size="3rem"> </cbp-icon>',
flag: '<img src="https://api.dicebear.com/9.x/pixel-art/svg" />', //documentation for dicebear https://www.dicebear.com/how-to-use/http-api/
flag: '<img src="https://api.dicebear.com/9.x/personas/svg" />', //documentation for dicebear https://www.dicebear.com/how-to-use/http-api/
title: 'Card Title',
bodyText: 'Here is an example of some body text for this purely informational card',
};
Expand Down
9 changes: 5 additions & 4 deletions packages/web-components/src/components/cbp-card/cbp-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ export class CbpCard {
@Prop({ reflect: true }) color: 'info' | 'success' | 'warning' | 'danger';

/** Specifies optional variants with difference from the default card. */
@Prop({ reflect: true }) variant: 'banner' | 'decision';
@Prop({ reflect: true }) variant: 'banner' | 'decision' | 'flag';

/** When present, the card will have a slot avaliable to display an img/icon flag for the card */
@Prop({ reflect: true }) flag: boolean = false;
// @Prop({ reflect: true }) flag: boolean = false;

/** When present, the card will stretch vertically to fill its parent container; most useful when placed in an equally sized grid or row of cards. */
@Prop({ reflect: true }) stretch: boolean = false;
Expand All @@ -43,11 +43,12 @@ export class CbpCard {
render() {
return (
<Host>
{this.flag ?
{/* {this.variant == 'flag' ?
<div class='cbp-card-flag'>
<slot name='cbp-card-flag'/>
</div>
: ''}
: ''} */}
{this.variant === 'flag' && <div class='cbp-card-flag'><slot name='cbp-card-flag'/></div>}
{this.variant === 'banner' && <slot name="cbp-card-title" />}
<div class="cbp-card-body">
{this.variant !== 'banner' && <slot name="cbp-card-title" />}
Expand Down

0 comments on commit 696d10d

Please sign in to comment.