Debian Codegraph @

node/@patternfly/react-core/src/components/BackgroundImage/BackgroundImage.tsx

raw
1 import { css } from '@patternfly/react-styles';
2 import styles from '@patternfly/react-styles/css/components/BackgroundImage/background-image';
3 import cssBackgroundImage from '@patternfly/react-tokens/dist/esm/c_background_image_BackgroundImage';
4
5 export interface BackgroundImageProps extends React.HTMLProps<HTMLDivElement> {
6 /** The URL or file path of the image for the background */
7 src: string;
8 /** Additional classes added to the background image. */
9 className?: string;
10 }
11
12 export const BackgroundImage: React.FunctionComponent<BackgroundImageProps> = ({
13 className,
14 src,
15 ...props
16 }: BackgroundImageProps) => (
17 <div
18 className={css(styles.backgroundImage, className)}
19 style={
20 {
21 [cssBackgroundImage.name]: `url(${src})`
22 } as React.CSSProperties
23 }
24 {...props}
25 />
26 );
27
28 BackgroundImage.displayName = 'BackgroundImage';