Skip to content

Commit 4d16658

Browse files
committed
Create slots on Timeline click
Refactor candidate placeholder Co-authored-by: Tomas Roun <[email protected]> Remove isHoveringSlot and use ref to get timeline rect
1 parent aaf9c29 commit 4d16658

File tree

5 files changed

+304
-128
lines changed

5 files changed

+304
-128
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import {Popup} from 'semantic-ui-react';
4+
/**
5+
* Displays a placeholder for a candidate time slot when the Timeline is hovered.
6+
*/
7+
export default function CandidatePlaceholder({visible, left, width, time}) {
8+
if (!visible) {
9+
return null;
10+
}
11+
12+
return (
13+
<Popup
14+
content={time}
15+
open={true}
16+
position="top center"
17+
trigger={
18+
<div
19+
style={{
20+
boxSizing: 'border-box',
21+
position: 'absolute',
22+
left: `${left}%`,
23+
width: `${width}%`,
24+
top: 5,
25+
height: 'calc(100% - 10px)',
26+
zIndex: 1000,
27+
background: 'rgba(0, 0, 0, 0.2)',
28+
borderRadius: '3px',
29+
display: 'block',
30+
pointerEvents: 'none',
31+
}}
32+
/>
33+
}
34+
/>
35+
);
36+
}
37+
38+
CandidatePlaceholder.propTypes = {
39+
visible: PropTypes.bool.isRequired,
40+
width: PropTypes.number.isRequired,
41+
left: PropTypes.number.isRequired,
42+
time: PropTypes.string.isRequired,
43+
};

newdle/client/src/components/creation/timeslots/CandidateSlot.js

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ function SlotEditWidget({startTime, onChange, isValidTime, slot}) {
1616
<Popup
1717
className={styles['timepicker-popup']}
1818
on="click"
19+
onClick={e => e.stopPropagation()}
1920
content={
2021
<>
2122
<TimePicker
@@ -68,6 +69,7 @@ export default function CandidateSlot({
6869
}) {
6970
const slot = (
7071
<Slot
72+
onClick={e => e.stopPropagation()}
7173
width={width}
7274
pos={pos}
7375
moreStyles={styles['candidate']}

0 commit comments

Comments
 (0)