@@ -2,7 +2,7 @@ import {FC, ReactNode} from 'react';
22import styled from 'styled-components' ;
33
44import { Icon , IconName } from '../../elements/icon/icon' ;
5- import { alphas , greys } from '../../helpers/colorHelpers' ;
5+ import { greys } from '../../helpers/colorHelpers' ;
66import { VisualSizesEnum } from '../../helpers/fontHelpers' ;
77import { makeSizeConstants } from '../../helpers/styleHelpers' ;
88import { ActionMenu } from '../_pre-built/actionMenu/actionMenu' ;
@@ -34,16 +34,8 @@ export interface CardProps {
3434 children ?: ReactNode ;
3535 /** The size of the card. */
3636 size ?: VisualSizesEnum ;
37- /** Whether the card has a shadow. */
38- hasShadow ?: boolean ;
39- /** Whether the card has a border. */
40- hasBorder ?: boolean ;
4137 /** Class name to allow custom styling of the card. */
4238 className ?: string ;
43- /** Whether the card is clickable. */
44- isClickable ?: boolean ;
45- /** Called when the card is clicked. */
46- onClick ?: ( ) => void ;
4739 /** Optional actions to display in the top right corner. */
4840 actions ?: CardAction [ ] ;
4941 /** Whether actions should only be visible on hover (default: true - actions always visible). */
@@ -58,9 +50,6 @@ export interface CardProps {
5850
5951interface StyledCardProps {
6052 $size : VisualSizesEnum ;
61- $hasShadow : boolean ;
62- $hasBorder : boolean ;
63- $isClickable : boolean ;
6453}
6554
6655const cardPadding = makeSizeConstants ( 12 , 16 , 20 ) ;
@@ -77,36 +66,6 @@ const StyledCard = styled.div<StyledCardProps>`
7766
7867 /* Padding based on size */
7968 padding: ${ ( p ) => cardPadding [ p . $size ] } px;
80-
81- /* Border styling */
82- border: ${ ( p ) => ( p . $hasBorder ? `1px solid ${ alphas . black10 } ` : 'none' ) } ;
83-
84- /* Shadow styling */
85- box-shadow: ${ ( p ) => ( p . $hasShadow ? `0 2px 8px ${ alphas . black10 } ` : 'none' ) } ;
86-
87- /* Clickable styling */
88- cursor: ${ ( p ) => ( p . $isClickable ? 'pointer' : 'default' ) } ;
89- transition: ${ ( p ) => ( p . $isClickable ? 'box-shadow 0.2s ease, transform 0.2s ease' : 'none' ) } ;
90-
91- &:hover {
92- ${ ( p ) =>
93- p . $isClickable
94- ? `
95- box-shadow: 0 4px 12px ${ alphas . black20 } ;
96- transform: translateY(-1px);
97- `
98- : '' }
99- }
100-
101- &:active {
102- ${ ( p ) =>
103- p . $isClickable
104- ? `
105- transform: translateY(0);
106- box-shadow: 0 2px 8px ${ alphas . black10 } ;
107- `
108- : '' }
109- }
11069` ;
11170
11271const RelativeContainer = styled . div `
@@ -141,19 +100,11 @@ const ActionButtonContainer = styled.div<{zIndex?: number; $showOnHover?: boolea
141100const CardComponent : FC < CardProps > = ( {
142101 children,
143102 size = VisualSizesEnum . MEDIUM ,
144- hasShadow = true ,
145- hasBorder = false ,
146103 className,
147- isClickable = false ,
148- onClick,
149104 actions = [ ] ,
150105 showActionsOnHover = false ,
151106 groupActions = false
152107} ) => {
153- const handleClick = ( ) => {
154- if ( isClickable && onClick ) onClick ( ) ;
155- } ;
156-
157108 const handleActionClick = ( action : CardAction ) => {
158109 action . onClick ( ) ;
159110 } ;
@@ -204,14 +155,7 @@ const CardComponent: FC<CardProps> = ({
204155
205156 return (
206157 < RelativeContainer className = { className } >
207- < StyledCard
208- $size = { size }
209- $hasShadow = { hasShadow }
210- $hasBorder = { hasBorder }
211- $isClickable = { isClickable }
212- onClick = { handleClick } >
213- { children }
214- </ StyledCard >
158+ < StyledCard $size = { size } > { children } </ StyledCard >
215159 { renderActions ( ) }
216160 </ RelativeContainer >
217161 ) ;
0 commit comments