Skip to content

Commit

Permalink
IBX-5357: Introduce summary tile component (#738)
Browse files Browse the repository at this point in the history
  • Loading branch information
tischsoic authored Mar 24, 2023
1 parent e998435 commit 1a5dc57
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
75 changes: 75 additions & 0 deletions src/bundle/Resources/public/scss/_summary-tile.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
.ibexa-summary-tile {
display: flex;
flex-direction: column;
padding: calculateRem(24px) calculateRem(24px);
gap: calculateRem(8px);
width: calculateRem(450px);
background: $ibexa-color-white;
border: calculateRem(1px) solid $ibexa-color-light-400;
border-radius: $ibexa-border-radius;

&__header {
display: flex;
justify-content: space-between;
align-items: center;
}

&__icon-wrapper {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
height: calculateRem(72px);
width: calculateRem(72px);
border-radius: 50%;
background: $ibexa-color-dark;

.ibexa-icon {
fill: $ibexa-color-white;
}
}

&__label {
font-family: $ibexa-font-family-headings;
font-weight: $ibexa-font-weight-bold;
font-size: $ibexa-text-font-size-large;
}

&__value {
font-weight: $ibexa-font-weight-bold;
font-size: $h1-font-size;
line-height: calculateRem(36px);
}

@mixin icon-colors($fill, $background) {
background: $background;

.ibexa-icon {
fill: $fill;
}
}

&__icon-wrapper--color-primary {
@include icon-colors($ibexa-color-primary, $ibexa-color-primary-100);
}

&__icon-wrapper--color-secondary {
@include icon-colors($ibexa-color-dark, $ibexa-color-light-400);
}

&__icon-wrapper--color-info {
@include icon-colors($ibexa-color-info, $ibexa-color-info-100);
}

&__icon-wrapper--color-danger {
@include icon-colors($ibexa-color-danger, $ibexa-color-danger-100);
}

&__icon-wrapper--color-success {
@include icon-colors($ibexa-color-success, $ibexa-color-success-100);
}

&__icon-wrapper--color-complementary {
@include icon-colors($ibexa-color-complementary, $ibexa-color-complementary-100);
}
}
1 change: 1 addition & 0 deletions src/bundle/Resources/public/scss/ibexa.scss
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@
@import 'user-invitation-modal';
@import 'default-location';
@import 'steps';
@import 'summary-tile';
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{% import "@ibexadesign/ui/component/macros.html.twig" as html %}

{% set attr = attr|default({})|merge({
class: ('ibexa-summary-tile ' ~ attr.class|default(''))|trim,
}) %}

{% set icon_wrapper_attr = icon_wrapper_attr|default({})|merge({
class: ('ibexa-summary-tile__icon-wrapper '
~ (icon_color ? 'ibexa-summary-tile__icon-wrapper--color-' ~ icon_color ~ ' ')
~ icon_wrapper_attr.class|default(''))|trim,
}) %}

<div {{ html.attributes(attr) }}>
<div class="ibexa-summary-tile__header">
<div class="ibexa-summary-tile__label">
{{ label }}
</div>
<div {{ html.attributes(icon_wrapper_attr) }}>
<svg class="ibexa-icon ibexa-icon--medium">
<use xlink:href="{{ icon_path|default(ibexa_icon_path(icon)) }}"></use>
</svg>
</div>
</div>
<div class="ibexa-summary-tile__value">
{{ value }}
</div>
</div>

0 comments on commit 1a5dc57

Please sign in to comment.