Skip to content

Commit

Permalink
Merge pull request #133 from osstotalsoft/feature/AvatarIconStyle
Browse files Browse the repository at this point in the history
add iconStyle prop
  • Loading branch information
DCosti authored Oct 16, 2024
2 parents 0b79311 + 875db3d commit b94f44f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/surfaces/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import React from 'react'
import PropTypes from 'prop-types'
import MuiCard, { CardContent, iconStyle } from './CardStyles'
import MuiCard, { CardContent, iconStyle as baseIconStyle } from './CardStyles'
import CardMedia from '@mui/material/CardMedia'
import { any, isNil } from 'ramda'
import { CardProps, CardColor } from './types'
Expand Down Expand Up @@ -47,14 +47,15 @@ const Card: React.FC<CardProps> = ({
mediaProps,
avatarProps,
headerContentProps,
iconStyle = {},
...props
}) => {
const hasIcon = !!Icon

const cardHeaderProps = {
title,
subheader,
avatar: Icon && <Icon style={iconStyle} />,
avatar: Icon && <Icon style={{ ...baseIconStyle, ...iconStyle }} />,
actions,
filled,
...headerProps
Expand Down Expand Up @@ -166,7 +167,12 @@ Card.propTypes = {
* @default {}
* Props applied to the CardHeader component.
*/
headerContentProps: PropTypes.object
headerContentProps: PropTypes.object,
/**
* @default {}
* Style applied to icon avatar.
*/
iconStyle: PropTypes.object
}

export default Card
4 changes: 4 additions & 0 deletions src/components/surfaces/Card/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,8 @@ export interface CardProps extends Omit<MuiCardProps, 'title'> {
* Style applied to the header content.
*/
headerContentProps?: HTMLAttributes<HTMLDivElement>
/**
* Icon style.
*/
iconStyle?: React.CSSProperties
}

0 comments on commit b94f44f

Please sign in to comment.