Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗑️ Card: removed cursor logic for onClick #2436

Merged
merged 1 commit into from
Aug 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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