Skip to content

Commit

Permalink
Create slots on Timeline click
Browse files Browse the repository at this point in the history
Refactor candidate placeholder

Co-authored-by: Tomas Roun <tomas.roun@cern.ch>
  • Loading branch information
renefs and tomasr8 committed Nov 15, 2024
1 parent 1633f31 commit 6fcf452
Show file tree
Hide file tree
Showing 5 changed files with 319 additions and 127 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from 'react';
import PropTypes from 'prop-types';
import {Popup} from 'semantic-ui-react';
/**
* Displays a placeholder for a candidate time slot when the Timeline is hovered.
*/
export default function CandidatePlaceholder({visible, left, width, time}) {
if (!visible) {
return null;
}

return (
<Popup
content={time}
open={true}
position="top center"
trigger={
<div
style={{
boxSizing: 'border-box',
position: 'absolute',
left: `${left}%`,
width: `${width}%`,
top: 5,
height: 'calc(100% - 10px)',
zIndex: 1000,
background: 'rgba(0, 0, 0, 0.2)',
borderRadius: '3px',
display: 'block',
pointerEvents: 'none',
}}
/>
}
/>
);
}

CandidatePlaceholder.propTypes = {
visible: PropTypes.bool.isRequired,
width: PropTypes.number.isRequired,
left: PropTypes.number.isRequired,
time: PropTypes.string.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function SlotEditWidget({startTime, onChange, isValidTime, slot}) {
<Popup
className={styles['timepicker-popup']}
on="click"
onClick={e => e.stopPropagation()}
content={
<>
<TimePicker
Expand Down Expand Up @@ -68,6 +69,7 @@ export default function CandidateSlot({
}) {
const slot = (
<Slot
onClick={e => e.stopPropagation()}
width={width}
pos={pos}
moreStyles={styles['candidate']}
Expand Down
Loading

0 comments on commit 6fcf452

Please sign in to comment.