1- import { Fragment , useState } from 'react' ;
1+ import { Fragment } from 'react' ;
22import { useTheme } from '@emotion/react' ;
33import styled from '@emotion/styled' ;
44
@@ -74,7 +74,6 @@ export function UsageOverviewTableRow({
7474 const showPanelInline = useMedia (
7575 `(max-width: calc(${ theme . breakpoints [ SIDE_PANEL_MIN_SCREEN_BREAKPOINT ] } - 1px))`
7676 ) ;
77- const [ isHovered , setIsHovered ] = useState ( false ) ;
7877 const showAdditionalSpendColumn =
7978 subscription . canSelfServe || supportsPayg ( subscription ) ;
8079
@@ -238,8 +237,6 @@ export function UsageOverviewTableRow({
238237 < Fragment >
239238 < ProductRow
240239 data-test-id = { `product-row-${ product } ` }
241- onMouseEnter = { ( ) => setIsHovered ( true ) }
242- onMouseLeave = { ( ) => setIsHovered ( false ) }
243240 isSelected = { isSelected }
244241 onClick = { ( ) => onRowClick ( product ) }
245242 onKeyDown = { e => {
@@ -355,8 +352,6 @@ export function UsageOverviewTableRow({
355352 </ td >
356353 ) : null }
357354 </ Fragment >
358-
359- { ( isSelected || isHovered ) && < SelectedPill isSelected = { isSelected } /> }
360355 </ ProductRow >
361356 { showPanelInline && isSelected && (
362357 < Row >
@@ -386,14 +381,11 @@ function DisabledProductRow({
386381 usageData,
387382 subscription,
388383} : DisabledProductRowProps ) {
389- const [ isHovered , setIsHovered ] = useState ( false ) ;
390384 const isSelected = selectedProduct === product ;
391385 return (
392386 < Fragment >
393387 < ProductRow
394388 data-test-id = { `product-row-disabled-${ product } ` }
395- onMouseEnter = { ( ) => setIsHovered ( true ) }
396- onMouseLeave = { ( ) => setIsHovered ( false ) }
397389 isSelected = { isSelected }
398390 onClick = { ( ) => onRowClick ( product ) }
399391 onKeyDown = { e => {
@@ -448,7 +440,6 @@ function DisabledProductRow({
448440 </ td >
449441 </ Fragment >
450442 ) }
451- { ( isSelected || isHovered ) && < SelectedPill isSelected = { isSelected } /> }
452443 </ ProductRow >
453444 { showPanelInline && isSelected && (
454445 < Row >
@@ -493,6 +484,26 @@ const ProductRow = styled(Row)<{isSelected: boolean}>`
493484 &:active {
494485 background: ${ p => p . theme . tokens . interactive . transparent . neutral . background . active } ;
495486 }
487+
488+ &::after {
489+ content: '';
490+ position: absolute;
491+ right: -1px;
492+ top: 30%;
493+ width: 4px;
494+ height: 22px;
495+ border-radius: 2px;
496+ background: ${ p =>
497+ p . isSelected
498+ ? p . theme . tokens . graphics . accent . vibrant
499+ : p . theme . tokens . graphics . neutral . moderate } ;
500+ opacity: ${ p => ( p . isSelected ? 1 : 0 ) } ;
501+ pointer-events: none;
502+ }
503+
504+ &:hover::after {
505+ opacity: 1;
506+ }
496507` ;
497508
498509const MobilePanelContainer = styled ( 'td' ) `
@@ -501,19 +512,6 @@ const MobilePanelContainer = styled('td')`
501512 grid-column: 1 / -1;
502513` ;
503514
504- const SelectedPill = styled ( 'td' ) < { isSelected : boolean } > `
505- position: absolute;
506- right: -1px;
507- top: 30%;
508- width: 4px;
509- height: 22px;
510- border-radius: 2px;
511- background: ${ p =>
512- p . isSelected
513- ? p . theme . tokens . graphics . accent . vibrant
514- : p . theme . tokens . graphics . neutral . moderate } ;
515- ` ;
516-
517515const IconContainer = styled ( 'span' ) `
518516 display: inline-block;
519517 vertical-align: middle;
0 commit comments