mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 13:28:36 +03:00
rewrite features as part of store + add HIGHLIGHT_GROUPS
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
export default ({
|
||||
category,
|
||||
highlights,
|
||||
events,
|
||||
x,
|
||||
y,
|
||||
@@ -10,14 +10,34 @@ export default ({
|
||||
onSelect,
|
||||
styleProps,
|
||||
extraRender
|
||||
}) => (
|
||||
<rect
|
||||
onClick={onSelect}
|
||||
className='event'
|
||||
x={x}
|
||||
y={y}
|
||||
style={styleProps}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
)
|
||||
}) => {
|
||||
if (highlights.length === 0) {
|
||||
return (
|
||||
<rect
|
||||
onClick={onSelect}
|
||||
className='event'
|
||||
x={x}
|
||||
y={y}
|
||||
style={styleProps}
|
||||
width={width}
|
||||
height={height}
|
||||
/>
|
||||
)
|
||||
}
|
||||
const sectionHeight = height / highlights.length
|
||||
return (
|
||||
<React.Fragment>
|
||||
{highlights.map((h, idx) => (
|
||||
<rect
|
||||
onClick={onSelect}
|
||||
className='event'
|
||||
x={x}
|
||||
y={y - sectionHeight + (idx * sectionHeight)}
|
||||
style={{ ...styleProps, opacity: h ? 0.3 : 0.05 }}
|
||||
width={width}
|
||||
height={sectionHeight}
|
||||
/>
|
||||
))}
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user