Skip to content

Commit

Permalink
🗑️ Card: removed cursor logic for onClick (#2436)
Browse files Browse the repository at this point in the history
  • Loading branch information
oddvernes authored Aug 19, 2022
1 parent 2b85a88 commit 06068d5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 2 additions & 7 deletions packages/eds-core-react/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type AvailableElevations = keyof Pick<Elevations, 'none' | 'raised' | 'overlay'>

type StyledCardProps = {
background: string
cursor: string
} & HTMLAttributes<HTMLDivElement>

export type CardProps = {
Expand All @@ -29,29 +28,25 @@ const StyledCard = styled(Paper)<StyledCardProps>`
display: flex;
flex-direction: column;
grid-gap: 16px;
cursor: ${({ cursor }) => cursor};
${bordersTemplate(primary.border)};
`

export const Card = forwardRef<HTMLDivElement, CardProps>(function Card(
{ children, variant = 'default', elevation = 'none', onClick, ...rest },
{ children, variant = 'default', elevation = 'none', ...rest },
ref,
) {
const cursor = onClick ? 'pointer' : 'default'

const cardVariant = variant === 'default' ? 'primary' : variant

const token = tokens[cardVariant]

const props = {
ref,
background: token.background,
cursor,
...rest,
}

return (
<StyledCard elevation={elevation} {...props} onClick={onClick}>
<StyledCard elevation={elevation} {...props}>
{children}
</StyledCard>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ exports[`Card Matches snapshot 1`] = `
-ms-flex-direction: column;
flex-direction: column;
grid-gap: 16px;
cursor: default;
border-radius: 4px;
}
Expand Down Expand Up @@ -109,7 +108,6 @@ exports[`Card Matches snapshot 1`] = `
<div
class="c0 c1"
cursor="default"
elevation="0 0 1px rgba(0, 0, 0, 0.14)"
>
<div
Expand Down

0 comments on commit 06068d5

Please sign in to comment.