Skip to content

Commit

Permalink
Consistently show red box-shadow border for HP hover
Browse files Browse the repository at this point in the history
  • Loading branch information
cynicaloptimist committed Mar 3, 2024
1 parent 1279e3b commit 305f0aa
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
43 changes: 23 additions & 20 deletions client/InitiativeList/CombatantRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,28 +137,31 @@ export function CombatantRow(props: CombatantRowProps) {
</button>
</td>

<td
className="combatant__hp"
style={getHPStyle(props)}
onClick={event => {
commandContext.ApplyDamageToCombatant(props.combatantState.Id);
event.stopPropagation();
}}
>
<span
className="combatant__mobile-icon fas fa-heart"
aria-hidden="true"
/>

{renderHPText(props)}
{DisplayHPBar && (
<span className="combatant__hp-bar">
<td className="combatant__hp">
<div
className="combatant__hp-outer"
onClick={event => {
commandContext.ApplyDamageToCombatant(props.combatantState.Id);
event.stopPropagation();
}}
>
<div className="combatant__hp-inner" style={getHPStyle(props)}>
<span
className="combatant__hp-bar--filled"
style={renderHPBarStyle(props)}
className="combatant__mobile-icon fas fa-heart"
aria-hidden="true"
/>
</span>
)}

{renderHPText(props)}
{DisplayHPBar && (
<span className="combatant__hp-bar">
<span
className="combatant__hp-bar--filled"
style={renderHPBarStyle(props)}
/>
</span>
)}
</div>
</div>
</td>

<td className="combatant__ac">
Expand Down
4 changes: 2 additions & 2 deletions client/PlayerView/components/PlayerViewCombatant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ export class PlayerViewCombatant extends React.Component<PlayerViewCombatantProp
</div>
<div
className={
"combatant__hp" +
"combatant__hp combatant__hp-outer" +
(this.props.areSuggestionsAllowed ? " show-hover" : "")
}
>
<span
className="current-hp"
className="combatant__hp-inner"
style={{ color: this.props.combatant.HPColor }}
onClick={() => this.props.suggestDamage(this.props.combatant)}
dangerouslySetInnerHTML={{ __html: this.props.combatant.HPDisplay }}
Expand Down
2 changes: 1 addition & 1 deletion lesscss/base/colors.less
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@

--modal-bg: rgba(0, 0, 0, 0.7);

.combatant__hp {
.combatant__hp-inner {
filter: brightness(2.5);
}
}
Expand Down
7 changes: 3 additions & 4 deletions lesscss/components/combatants.less
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
}
}

.combatant .combatant__hp {
transition: border @transition-hover;
.combatant .combatant__hp-outer {
transition: box-shadow @transition-hover;
&:hover {
border-color: unset;
box-shadow: 0 0 0 2px var(--hover-hp-red);
}
}
}
Expand Down Expand Up @@ -291,7 +291,6 @@
.combatant__hp {
width: 5rem;
justify-content: center;
border: 1px dashed transparent;
grid-area: hp;

@media (max-width: @medium) {
Expand Down
11 changes: 8 additions & 3 deletions lesscss/pages/player-view.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
.combatant__hp {
flex-basis: 10%;
align-items: center;
&.show-hover:hover {
background-color: var(--hover-hp-red);
}
}

.combatant__hp-outer {
transition: box-shadow @transition-hover;
}

.combatant__hp-outer.show-hover:hover {
box-shadow: 0 0 0 2px var(--hover-hp-red);
}

.combatant__portrait {
Expand Down

0 comments on commit 305f0aa

Please sign in to comment.