mirror of
https://github.com/fleetdm/fleet
synced 2026-05-21 16:08:47 +00:00
Issues https://github.com/fleetdm/fleet/issues/17587, https://github.com/fleetdm/fleet/issues/18836, https://github.com/fleetdm/fleet/issues/18837, https://github.com/fleetdm/fleet/pull/18339, and https://github.com/fleetdm/fleet/pull/18340 # TODOS - Integrate backend - Unit/integration tests - Various todos noted in comments - Cleanup styles and organization of components (de-duplicating and consolidating where possible) - Activity feed updates (if any) # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [ ] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://fleetdm.com/docs/contributing/committing-changes#changes-files) for more information. - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) - [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for new osquery data ingestion features. - [ ] Added/updated tests - [ ] If database migrations are included, checked table schema to confirm autoupdate - For database migrations: - [ ] Checked schema for all modified table for columns that will auto-update timestamps during migration. - [ ] Confirmed that updating the timestamps is acceptable, and will not cause unwanted side effects. - [ ] Ensured the correct collation is explicitly set for character columns (`COLLATE utf8mb4_unicode_ci`). - [ ] Manual QA for all new/changed functionality - For Orbit and Fleet Desktop changes: - [ ] Manual QA must be performed in the three main OSs, macOS, Windows and Linux. - [ ] Auto-update manual QA, from released version of component to new version (see [tools/tuf/test](../tools/tuf/test/README.md)). --------- Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
63 lines
1.9 KiB
TypeScript
63 lines
1.9 KiB
TypeScript
import React from "react";
|
|
import classnames from "classnames";
|
|
|
|
const baseClass = "card";
|
|
|
|
type BorderRadiusSize = "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
type CardColor = "white" | "gray" | "purple" | "yellow";
|
|
|
|
interface ICardProps {
|
|
children?: React.ReactNode;
|
|
/** The size of the border radius. Defaults to `small`.
|
|
*
|
|
* These correspond to the boarder radius in the design system. Look at
|
|
* `var/_global.scss` for values */
|
|
borderRadiusSize?: BorderRadiusSize;
|
|
/** Includes the card shadows. Defaults to `false` */
|
|
includeShadow?: boolean;
|
|
/** The color of the card. Defaults to `white` */
|
|
color?: CardColor;
|
|
className?: string;
|
|
/** The size of the padding around the content of the card. Defaults to `large`.
|
|
*
|
|
* These correspond to the padding sizes in the design system. Look at
|
|
* `padding.scss` for values */
|
|
paddingSize?: "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
/**
|
|
* @deprecated Use `paddingSize` prop instead.
|
|
*
|
|
* Increases to 40px padding. Defaults to `false` */
|
|
largePadding?: boolean;
|
|
}
|
|
|
|
/**
|
|
* A generic card component that will be used to render content within a card with a border and
|
|
* and selected background color.
|
|
*/
|
|
const Card = ({
|
|
children,
|
|
borderRadiusSize = "small",
|
|
includeShadow = false,
|
|
color = "white",
|
|
className,
|
|
largePadding = false,
|
|
paddingSize = "large",
|
|
}: ICardProps) => {
|
|
const classNames = classnames(
|
|
baseClass,
|
|
`${baseClass}__${color}`,
|
|
`${baseClass}__radius-${borderRadiusSize}`,
|
|
{
|
|
// TODO: simplify this when we've replaced largePadding prop with paddingSize
|
|
[`${baseClass}__padding-${paddingSize}`]:
|
|
!largePadding && paddingSize !== undefined,
|
|
[`${baseClass}__shadow`]: includeShadow,
|
|
[`${baseClass}__large-padding`]: largePadding,
|
|
},
|
|
className
|
|
);
|
|
|
|
return <div className={classNames}>{children}</div>;
|
|
};
|
|
|
|
export default Card;
|