Skip to content

Commit

Permalink
fix(cardNode-shapeNode):addition of className to props
Browse files Browse the repository at this point in the history
  • Loading branch information
RiyaJethwa committed Mar 21, 2024
1 parent 582326c commit 5bfa544
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/react/src/diagrams/CardNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ type CardNodeProps = {
color?: string
position?: CssPosition
children?: React.ReactNode
className?: string
}

const CardNode: React.FC<
CardNodeProps & React.HTMLAttributes<HTMLAnchorElement | HTMLDivElement | HTMLButtonElement>
> = ({ tag = 'div', children, color, href, position = 'static', stacked, ...rest }) => {
> = ({ tag = 'div', className, children, color, href, position = 'static', stacked, ...rest }) => {
const Component = href ? 'a' : rest.onClick ? 'button' : tag

const namespace = `${carbonPrefix}--cc--card-node`
const cardClasses = classnames(namespace, {
[`${namespace}--stacked`]: stacked,
[`${namespace}--${Component}`]: Component,
[rest.className as string]: rest.className
[className as string]: className
})

return (
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/diagrams/ShapeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type ShapeNodeProps = {
position?: CssPosition
bodyPosition?: CssPosition
stacked?: boolean
className?: string
}

const ShapeNode: React.FC<
Expand All @@ -24,6 +25,7 @@ const ShapeNode: React.FC<
shape = 'circle',
tag = 'div',
title = 'Title',
className,
subtitle,
description,
renderIcon,
Expand All @@ -41,7 +43,7 @@ const ShapeNode: React.FC<
[`${namespace}--stacked`]: stacked,
[`${namespace}--${shape}`]: shape,
[`${namespace}--${Component}`]: Component,
[rest.className as string]: rest.className
[className as string]: className
})

const titleElement = title ? <div className={`${namespace}__title`}>{title}</div> : null
Expand Down

0 comments on commit 5bfa544

Please sign in to comment.