fleet/frontend/components/CardHeader/CardHeader.tsx
Carlo 715d963f82
My device page (self-service) for iOS/iPadOS (#35238)
Implements #32247. This is the complete feature branch, consolidating:

- https://github.com/fleetdm/fleet/pull/35018
- https://github.com/fleetdm/fleet/pull/34758
- https://github.com/fleetdm/fleet/pull/35009
- https://github.com/fleetdm/fleet/pull/35181
- https://github.com/fleetdm/fleet/pull/35342

---------

Co-authored-by: Jonathan Katz <44128041+jkatz01@users.noreply.github.com>
Co-authored-by: RachelElysia <71795832+RachelElysia@users.noreply.github.com>
Co-authored-by: Martin Angers <martin.n.angers@gmail.com>
Co-authored-by: jkatz01 <yehonatankatz@gmail.com>
2025-11-07 17:30:51 -05:00

33 lines
801 B
TypeScript

import React from "react";
import classnames from "classnames";
const baseClass = "card-header";
interface ICardHeaderProps {
header?: JSX.Element | string;
subheader?: JSX.Element | string;
className?: string;
variant?: "mobile-header";
}
/** A generic CardHeader component to be used within Card component
* that styles header and subheader */
const CardHeader = ({
header,
subheader,
className,
variant,
}: ICardHeaderProps) => {
const classNames = classnames(baseClass, className, {
[`${baseClass}--${variant}`]: !!variant,
});
return (
<div className={classNames}>
{header && <h2 className={`${baseClass}__header`}>{header}</h2>}
{subheader && <p className={`${baseClass}__subheader`}>{subheader}</p>}
</div>
);
};
export default CardHeader;