Skip to content

Commit aea8f5e

Browse files
committed
fix missing headerColor and realm-icon border properties
1 parent e03162c commit aea8f5e

File tree

3 files changed

+37
-30
lines changed

3 files changed

+37
-30
lines changed

packages/boxel-ui/addon/src/components/card-header/index.gts

+19-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { concat } from '@ember/helper';
21
import { on } from '@ember/modifier';
32
import Component from '@glimmer/component';
43
import type { ComponentLike } from '@glint/template';
@@ -37,33 +36,27 @@ export default class CardHeader extends Component<Signature> {
3736
get safeMoreOptionsMenuItems() {
3837
return this.args.moreOptionsMenuItems || [];
3938
}
40-
get headerColor() {
41-
return (
42-
this.args.headerColor ||
43-
getComputedStyle(document.documentElement).getPropertyValue(
44-
'--boxel-light',
45-
)
46-
);
47-
}
4839
<template>
4940
<header
5041
data-test-card-header
5142
class={{cn is-editing=(bool @onFinishEditing)}}
5243
{{setCssVar
53-
boxel-card-header-background-color=this.headerColor
54-
boxel-card-header-text-color=(getContrastColor this.headerColor)
44+
--boxel-card-header-background-color=@headerColor
45+
--boxel-card-header-text-color=(getContrastColor @headerColor)
5546
}}
5647
...attributes
5748
>
5849
<div
5950
class='realm-icon-container'
60-
style={{cssVar
61-
boxel-realm-icon-background-color=(getContrastColor
62-
this.headerColor 'transparent'
63-
)
64-
boxel-realm-icon-border=(concat
65-
'1px solid '
66-
(getContrastColor this.headerColor 'rgba(0, 0, 0, 0.15)')
51+
style={{if
52+
@headerColor
53+
(cssVar
54+
boxel-realm-icon-background-color=(getContrastColor
55+
@headerColor 'transparent'
56+
)
57+
boxel-realm-icon-border-color=(getContrastColor
58+
@headerColor 'rgba(0, 0, 0, 0.15)'
59+
)
6760
)
6861
}}
6962
>
@@ -264,12 +257,14 @@ export default class CardHeader extends Component<Signature> {
264257
align-items: center;
265258
min-width: var(--boxel-card-header-icon-container-min-width);
266259
justify-content: left;
267-
--boxel-realm-icon-background-color: var(--boxel-light);
268-
--boxel-realm-icon-border-radius: 7px;
269-
}
270-
.is-editing .realm-icon-container {
271-
--boxel-realm-icon-background-color: var(--boxel-light);
272-
--boxel-realm-icon-border: 1px solid var(--boxel-light);
260+
--boxel-realm-icon-background-color: var(
261+
--realm-icon-background-color
262+
);
263+
--boxel-realm-icon-border-color: var(--realm-icon-border-color);
264+
--boxel-realm-icon-border-radius: var(
265+
--realm-icon-border-radius,
266+
7px
267+
);
273268
}
274269
275270
.realm-icon {

packages/boxel-ui/addon/src/components/card-header/usage.gts

+3-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default class CardHeaderUsage extends Component {
134134
/>
135135
<Args.String
136136
@name='headerColor'
137-
@description='background color of the header, defaults to boxel-light'
137+
@description='background color of the header'
138138
@value={{this.headerColor}}
139139
@onInput={{fn (mut this.headerColor)}}
140140
/>
@@ -195,15 +195,15 @@ export default class CardHeaderUsage extends Component {
195195
<Css.Basic
196196
@name='boxel-card-header-icon-container-min-width'
197197
@type='length'
198-
@description='minimum width of the icon container; useful to set matching boxel-card-header-actions-min-width to keep the title centered opverall'
198+
@description='minimum width of the icon container; useful to set matching boxel-card-header-actions-min-width to keep the title centered overall'
199199
@defaultValue={{this.cardHeaderIconContainerMinWidth.defaults}}
200200
@value={{this.cardHeaderIconContainerMinWidth.value}}
201201
@onInput={{this.cardHeaderIconContainerMinWidth.update}}
202202
/>
203203
<Css.Basic
204204
@name='boxel-card-header-actions-min-width'
205205
@type='length'
206-
@description='minimum width of the actions container; useful to set matching boxel-card-header-icon-container-min-width to keep the title centered opverall'
206+
@description='minimum width of the actions container; useful to set matching boxel-card-header-icon-container-min-width to keep the title centered overall'
207207
@defaultValue={{this.cardHeaderActionsMinWidth.defaults}}
208208
@value={{this.cardHeaderActionsMinWidth.value}}
209209
@onInput={{this.cardHeaderActionsMinWidth.update}}

packages/host/app/components/operator-mode/stack-item.gts

+15-3
Original file line numberDiff line numberDiff line change
@@ -624,9 +624,14 @@ export default class OperatorModeStackItem extends Component<Signature> {
624624
boxel-card-header-actions-min-width=(if
625625
this.isBuried '50px' '95px'
626626
)
627-
realm-icon-background=(getContrastColor
627+
boxel-card-header-background-color=@item.headerColor
628+
boxel-card-header-text-color=(getContrastColor @item.headerColor)
629+
realm-icon-background-color=(getContrastColor
628630
@item.headerColor 'transparent'
629631
)
632+
realm-icon-border-color=(getContrastColor
633+
@item.headerColor 'transparent' 'rgba(0 0 0 / 15%)'
634+
)
630635
}}
631636
role={{if this.isBuried 'button' 'banner'}}
632637
{{on
@@ -654,7 +659,6 @@ export default class OperatorModeStackItem extends Component<Signature> {
654659
<CardHeader
655660
@cardTypeDisplayName={{this.headerTitle}}
656661
@cardTypeIcon={{cardTypeIcon @item.card}}
657-
@headerColor={{@item.headerColor}}
658662
@isSaving={{this.isSaving}}
659663
@isTopCard={{this.isTopCard}}
660664
@lastSavedMessage={{this.lastSavedMsg}}
@@ -671,9 +675,16 @@ export default class OperatorModeStackItem extends Component<Signature> {
671675
boxel-card-header-actions-min-width=(if
672676
this.isBuried '50px' '95px'
673677
)
674-
realm-icon-background=(getContrastColor
678+
boxel-card-header-background-color=@item.headerColor
679+
boxel-card-header-text-color=(getContrastColor
680+
@item.headerColor
681+
)
682+
realm-icon-background-color=(getContrastColor
675683
@item.headerColor 'transparent'
676684
)
685+
realm-icon-border-color=(getContrastColor
686+
@item.headerColor 'transparent' 'rgba(0 0 0 / 15%)'
687+
)
677688
}}
678689
role={{if this.isBuried 'button' 'banner'}}
679690
{{on
@@ -774,6 +785,7 @@ export default class OperatorModeStackItem extends Component<Signature> {
774785
775786
.item.buried {
776787
--stack-item-header-height: 2.5rem;
788+
--realm-icon-border-radius: 4px;
777789
}
778790
779791
.stack-item-card {

0 commit comments

Comments
 (0)