Debian Codegraph @

node/@patternfly/react-core/src/deprecated/components/Tile/Tile.tsx

raw
1 import styles from '@patternfly/react-styles/css/components/Tile/tile';
2 import { css } from '@patternfly/react-styles';
3
4 export interface TileProps extends React.HTMLProps<HTMLDivElement> {
5 /** Content rendered inside the banner */
6 children?: React.ReactNode;
7 /** Additional classes added to the banner */
8 className?: string;
9 /** Title of the tile */
10 title: string;
11 /** Icon in the tile title */
12 icon?: React.ReactNode;
13 /** Flag indicating if the tile is selected */
14 isSelected?: boolean;
15 /** Flag indicating if the tile is disabled */
16 isDisabled?: boolean;
17 /** Flag indicating if the tile header is stacked */
18 isStacked?: boolean;
19 /** Flag indicating if the stacked tile icon is large */
20 isDisplayLarge?: boolean;
21 }
22
23 export const Tile: React.FunctionComponent<TileProps> = ({
24 children,
25 title,
26 icon,
27 isStacked,
28 isSelected,
29 isDisabled,
30 isDisplayLarge,
31 className,
32 ...props
33 }: TileProps) => (
34 <div
35 role="option"
36 aria-selected={isSelected}
37 {...(isDisabled && { 'aria-disabled': isDisabled })}
38 className={css(
39 styles.tile,
40 isSelected && styles.modifiers.selected,
41 isDisabled && styles.modifiers.disabled,
42 isDisplayLarge && styles.modifiers.displayLg,
43 className
44 )}
45 tabIndex={0}
46 {...props}
47 >
48 <div className={css(styles.tileHeader, isStacked && styles.modifiers.stacked)}>
49 {icon && <div className={css(styles.tileIcon)}>{icon}</div>}
50 <div className={css(styles.tileTitle)}>{title}</div>
51 </div>
52 {children && <div className={css(styles.tileBody)}>{children}</div>}
53 </div>
54 );
55 Tile.displayName = 'Tile';