import React from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { FaTrashAlt } from 'react-icons/fa'; import { mySpring } from './animations'; const { formatDuration } = require('./util'); const TimelineSeg = ({ duration, cutStart, cutEnd, isActive, segNum, onSegClick, color, invertCutSegments, zoomed, }) => { const cutSectionWidth = `${((cutEnd - cutStart) / duration) * 100}%`; const strongColor = color.lighten(0.5).string(); const strongBgColor = color.lighten(0.5).alpha(0.5).string(); const startTimePos = `${(cutStart / duration) * 100}%`; const markerBorder = `2px solid ${isActive ? strongColor : 'transparent'}`; const backgroundColor = isActive ? strongBgColor : color.alpha(0.5).string(); const markerBorderRadius = 5; const wrapperStyle = { position: 'absolute', top: 0, bottom: 0, left: startTimePos, width: cutSectionWidth, display: 'flex', alignItems: 'center', justifyContent: 'space-between', background: backgroundColor, originX: 0, boxSizing: 'border-box', borderLeft: markerBorder, borderTopLeftRadius: markerBorderRadius, borderBottomLeftRadius: markerBorderRadius, borderRight: markerBorder, borderTopRightRadius: markerBorderRadius, borderBottomRightRadius: markerBorderRadius, }; const onThisSegClick = () => onSegClick(segNum); return ( cutStart ? formatDuration({ seconds: cutEnd - cutStart }) : undefined} >
{segNum + 1}
{invertCutSegments && ( )}
); }; export default TimelineSeg;