MCPcopy Create free account
hub / github.com/Detaysoft/react-chat-elements / LocationMessage

Function LocationMessage

src/LocationMessage/LocationMessage.tsx:9–45  ·  view source on GitHub ↗
({ markerColor = 'red', target = '_blank', zoom = '14', ...props })

Source from the content-addressed store, hash-verified

7const MAP_URL = 'https://www.google.com/maps/search/?api=1&query=LATITUDE,LONGITUDE&zoom=ZOOM'
8
9const LocationMessage: React.FC<ILocationMessageProps> = ({ markerColor = 'red', target = '_blank', zoom = '14', ...props }) => {
10 const buildURL = (url: string) => {
11 return url
12 .replace(/LATITUDE/g, props?.data.latitude)
13 .replace(/LONGITUDE/g, props?.data.longitude)
14 .replace('MARKER_COLOR', markerColor)
15 .replace('ZOOM', zoom)
16 .replace('KEY', props.apiKey)
17 }
18 const className = () => {
19 var _className = classNames('rce-mbox-location', props.className)
20
21 if (props.text) {
22 _className = classNames(_className, 'rce-mbox-location-has-text')
23 }
24
25 return _className
26 }
27
28 return (
29 <div className='rce-container-lmsg'>
30 <a
31 onClick={props.onOpen}
32 target={target}
33 href={props.href || props.src || buildURL(props.data.mapURL || MAP_URL)}
34 className={className()}
35 >
36 <img
37 onError={props.onError}
38 className='rce-mbox-location-img'
39 src={props.src || buildURL(props.data.staticURL || STATIC_URL)}
40 />
41 </a>
42 {props.text && <div className='rce-mbox-text rce-mbox-location-text'>{props.text}</div>}
43 </div>
44 )
45}
46
47export default LocationMessage

Callers

nothing calls this directly

Calls 2

buildURLFunction · 0.85
classNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…