-
Notifications
You must be signed in to change notification settings - Fork 58
/
FloatingMapLogo.tsx
62 lines (50 loc) · 1.19 KB
/
FloatingMapLogo.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import './FloatingMapLogo.less';
import _cloneDeep from 'lodash/cloneDeep';
import * as React from 'react';
import { CSS_PREFIX } from '../../constants';
export type FloatingMapLogoProps = Exclude<React.ComponentProps<'img'>, 'src' | 'height'> & {
/**
* Whether the map logo is absolutely postioned or not. Default is false.
*/
absolutelyPositioned?: boolean;
/**
* The imageSrc.
*/
imageSrc: string;
/**
* The image height
*/
imageHeight?: string;
};
export const FloatingMapLogo: React.FC<FloatingMapLogoProps> = ({
absolutelyPositioned = false,
imageSrc,
className,
imageHeight,
style,
...passThroughProps
}): JSX.Element => {
const defaultClassName = `${CSS_PREFIX}floatingmaplogo`;
const finalClassName = className
? `${className} ${defaultClassName}`
: defaultClassName;
let imgStyle = style ? _cloneDeep(style) : {};
if (absolutelyPositioned) {
imgStyle = {
...imgStyle,
...{
position: 'absolute'
}
};
}
return (
<img
className={finalClassName}
src={imageSrc}
height={imageHeight}
style={imgStyle}
{...passThroughProps}
/>
);
};
export default FloatingMapLogo;