Skip to content

Commit

Permalink
F #6826: Fix selected row (#3407)
Browse files Browse the repository at this point in the history
Co-authored-by: Tino Vázquez <cvazquez@opennebula.io>
  • Loading branch information
jloboescalona2 and tinova authored Feb 3, 2025
1 parent fc12305 commit 93521db
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
17 changes: 11 additions & 6 deletions src/fireedge/src/modules/components/Cards/SelectCard/SelectCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and *
* limitations under the License. *
* ------------------------------------------------------------------------- */
import { memo, useMemo } from 'react'
import PropTypes from 'prop-types'
import clsx from 'clsx'
import PropTypes from 'prop-types'
import { memo, useMemo } from 'react'

import {
Card,
CardActionArea,
CardHeader,
CardActions,
CardHeader,
CardMedia,
Skeleton,
useTheme,
Expand Down Expand Up @@ -65,6 +65,7 @@ const SelectCard = memo(
}),
[theme]
)

const { isNearScreen, fromRef } = useNearScreen({
distance: '100px',
})
Expand All @@ -77,9 +78,13 @@ const SelectCard = memo(
{observerOff || isNearScreen ? (
<Card
{...cardProps}
className={clsx(classes.root, cardProps?.className, {
[classes.actionArea]: !handleClick,
})}
className={clsx(
classes.root({ isSelected }),
cardProps?.className,
{
[classes.actionArea]: !handleClick,
}
)}
data-cy={dataCy ? `${dataCy}-card` : undefined}
>
{/* CARD ACTION AREA */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and *
* limitations under the License. *
* ------------------------------------------------------------------------- */
import { Checkbox, Grid, TableCell, TableRow, useTheme } from '@mui/material'
import EnhancedTableStyles from '@modules/components/Tables/Enhanced/styles'
import { SERVER_CONFIG } from '@ConstantsModule'
import { useAuth } from '@FeaturesModule'
import { css } from '@emotion/css'
import EnhancedTableStyles from '@modules/components/Tables/Enhanced/styles'
import { Checkbox, Grid, TableCell, TableRow, useTheme } from '@mui/material'
import get from 'lodash.get'
import PropTypes from 'prop-types'
import { ReactElement, memo, useMemo } from 'react'
import { css } from '@emotion/css'

const listStyles = ({ palette }) => ({
row: css({
Expand Down Expand Up @@ -180,7 +180,8 @@ const SwitchRowComponent = memo(

return Component
},
(prev, next) => prev.RowCardComponent === next.RowCardComponent
(prev, next) =>
prev.RowCardComponent === next.RowCardComponent && prev.props === next.props
)

SwitchRowComponent.propTypes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const EnhancedTableStyles = ({ palette, typography, breakpoints }) => ({
backgroundColor: palette.action.hover,
},
'&.selected': {
border: `2px solid ${palette.secondary.main}`,
border: `.2rem solid ${palette.secondary.main}`,
},
},
}),
Expand Down

0 comments on commit 93521db

Please sign in to comment.