diff --git a/packages/orbit-components/src/Card/Card.stories.tsx b/packages/orbit-components/src/Card/Card.stories.tsx index 98f4887ede..6a2f9feefb 100644 --- a/packages/orbit-components/src/Card/Card.stories.tsx +++ b/packages/orbit-components/src/Card/Card.stories.tsx @@ -258,6 +258,24 @@ export const CardWithDefaultExpanded: Story = { > Hidden content + + Trip length: 1h55m + } type="warningSubtle"> + Unavailable + + + } + actions={ + + Open + + } + > + Hidden content + + Trip length: 1h55m } type="warningSubtle"> Unavailable diff --git a/packages/orbit-components/src/Card/CardSection/index.tsx b/packages/orbit-components/src/Card/CardSection/index.tsx index 5551bc7631..e649b4880f 100644 --- a/packages/orbit-components/src/Card/CardSection/index.tsx +++ b/packages/orbit-components/src/Card/CardSection/index.tsx @@ -9,6 +9,13 @@ import type { Props } from "./types"; import Header from "../components/Header"; import Expandable from "./components/Expandable"; import handleKeyDown from "../../utils/handleKeyDown"; +import Stack from "../../Stack"; + +const Actions = ({ actions }) => ( + + {actions} + +); export default function CardSection({ title, @@ -68,24 +75,35 @@ export default function CardSection({ onKeyDown={onClick == null ? undefined : handleKeyDown(onClick)} > {(title != null || header != null) && expandable && ( - + + {actions && } + )} {(title != null || header != null) && !expandable && ( @@ -100,6 +118,7 @@ export default function CardSection({ actions={actions} isSection /> + {actions && } )} diff --git a/packages/orbit-components/src/Card/components/Header.tsx b/packages/orbit-components/src/Card/components/Header.tsx index 58e299d25f..1e25aecc24 100644 --- a/packages/orbit-components/src/Card/components/Header.tsx +++ b/packages/orbit-components/src/Card/components/Header.tsx @@ -68,7 +68,7 @@ const Header = ({ color="secondary" /> )} - {actions && ( + {React.isValidElement(actions) && ( {actions}