diff --git a/src/common/layout/LayoutImage.tsx b/src/common/layout/LayoutImage.tsx new file mode 100644 index 00000000..84fff35b --- /dev/null +++ b/src/common/layout/LayoutImage.tsx @@ -0,0 +1,23 @@ +import { FC, useMemo } from 'react'; +import { Base, BaseProps } from '../Base'; + +export interface LayoutImageProps extends BaseProps +{ + imageUrl: string; +} + +export const LayoutImage: FC = props => +{ + const { imageUrl = null, style = null, ...rest } = props; + + const getStyle = useMemo(() => + { + const newStyle = { ...style }; + + if(imageUrl) newStyle.background = `url(${ imageUrl }) center no-repeat`; + + return newStyle; + }, [ style, imageUrl ]); + + return ; +}