Skip to content

Commit

Permalink
Stats: only expand location section when not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
myhro committed Jan 15, 2025
1 parent 633528c commit 2d39ac6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/components/src/horizontal-bar-list/stats-card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
.stats-card--hero {
padding-bottom: $card-vertical-space;

}

.stats-card--hero-expanded {
@media (min-width: $break-medium) {
min-height: 512px;
min-width: 860px;
Expand Down
7 changes: 6 additions & 1 deletion packages/components/src/horizontal-bar-list/stats-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ const StatsCard = ( {
</div>
);

let heroClasses = `${ BASE_CLASS_NAME }--hero`;
if ( ! isEmpty ) {
heroClasses += ` ${ BASE_CLASS_NAME }--hero-expanded`;
}

return (
<div
className={ clsx( className, BASE_CLASS_NAME, {
Expand All @@ -85,7 +90,7 @@ const StatsCard = ( {
>
<div className={ `${ BASE_CLASS_NAME }__content` }>
{ !! heroElement && (
<div className={ `${ BASE_CLASS_NAME }--hero` }>
<div className={ heroClasses }>
{ splitHeader && <div className={ `${ BASE_CLASS_NAME }-header` }>{ titleNode }</div> }
{ heroElement }
</div>
Expand Down

0 comments on commit 2d39ac6

Please sign in to comment.