mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-21 06:59:09 +00:00
style: animate event collapse / expand
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import Icon from '@chakra-ui/icon';
|
import Icon from '@chakra-ui/icon';
|
||||||
import { FiChevronDown, FiChevronUp, FiMoreVertical } from 'react-icons/fi';
|
import { FiChevronUp, FiMoreVertical } from 'react-icons/fi';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { Draggable } from 'react-beautiful-dnd';
|
import { Draggable } from 'react-beautiful-dnd';
|
||||||
import EventTimes from 'common/components/eventTimes/EventTimes';
|
import EventTimes from 'common/components/eventTimes/EventTimes';
|
||||||
@@ -86,13 +86,6 @@ const ExpandedBlock = (props) => {
|
|||||||
{`/ontime/goto ${eventIndex + 1} << OSC >> /ontime/gotoid ${oscid}`}
|
{`/ontime/goto ${eventIndex + 1} << OSC >> /ontime/gotoid ${oscid}`}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<Icon
|
|
||||||
className={style.more}
|
|
||||||
as={FiChevronUp}
|
|
||||||
marginTop='0.2em'
|
|
||||||
gridArea='more'
|
|
||||||
onClick={() => props.setCollapsed(true)}
|
|
||||||
/>
|
|
||||||
<div className={style.actionOverlay}>
|
<div className={style.actionOverlay}>
|
||||||
<PublicIconBtn actionHandler={actionHandler} active={data.isPublic} />
|
<PublicIconBtn actionHandler={actionHandler} active={data.isPublic} />
|
||||||
<ActionButtons
|
<ActionButtons
|
||||||
@@ -139,13 +132,6 @@ const CollapsedBlock = (props) => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Icon
|
|
||||||
className={style.more}
|
|
||||||
as={FiChevronDown}
|
|
||||||
marginTop='0.2em'
|
|
||||||
gridArea='more'
|
|
||||||
onClick={() => props.setCollapsed(false)}
|
|
||||||
/>
|
|
||||||
<div className={style.actionOverlay}>
|
<div className={style.actionOverlay}>
|
||||||
<PublicIconBtn actionHandler={actionHandler} active={data.isPublic} />
|
<PublicIconBtn actionHandler={actionHandler} active={data.isPublic} />
|
||||||
<ActionButtons
|
<ActionButtons
|
||||||
@@ -176,6 +162,7 @@ export default function EventBlock(props) {
|
|||||||
const delayValue = delay > 0 ? millisToMinutes(delay) : null;
|
const delayValue = delay > 0 ? millisToMinutes(delay) : null;
|
||||||
|
|
||||||
const handleCollapse = (isCollapsed) => {
|
const handleCollapse = (isCollapsed) => {
|
||||||
|
console.log('setting collapsed', isCollapsed);
|
||||||
setCollapsed({ [data.id]: isCollapsed });
|
setCollapsed({ [data.id]: isCollapsed });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -187,6 +174,11 @@ export default function EventBlock(props) {
|
|||||||
{...provided.draggableProps}
|
{...provided.draggableProps}
|
||||||
ref={provided.innerRef}
|
ref={provided.innerRef}
|
||||||
>
|
>
|
||||||
|
<Icon
|
||||||
|
className={collapsed ? style.moreCollapsed : style.moreExpanded}
|
||||||
|
as={FiChevronUp}
|
||||||
|
onClick={() => handleCollapse(!collapsed)}
|
||||||
|
/>
|
||||||
{collapsed ? (
|
{collapsed ? (
|
||||||
<CollapsedBlock
|
<CollapsedBlock
|
||||||
provided={provided}
|
provided={provided}
|
||||||
@@ -195,7 +187,6 @@ export default function EventBlock(props) {
|
|||||||
delay={delay}
|
delay={delay}
|
||||||
delayValue={delayValue}
|
delayValue={delayValue}
|
||||||
actionHandler={actionHandler}
|
actionHandler={actionHandler}
|
||||||
setCollapsed={handleCollapse}
|
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<ExpandedBlock
|
<ExpandedBlock
|
||||||
@@ -206,7 +197,6 @@ export default function EventBlock(props) {
|
|||||||
delay={delay}
|
delay={delay}
|
||||||
delayValue={delayValue}
|
delayValue={delayValue}
|
||||||
actionHandler={actionHandler}
|
actionHandler={actionHandler}
|
||||||
setCollapsed={handleCollapse}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -160,9 +160,24 @@
|
|||||||
|
|
||||||
/* ================ MORE ================ */
|
/* ================ MORE ================ */
|
||||||
|
|
||||||
.more {
|
.moreExpanded,
|
||||||
|
.moreCollapsed {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
color: #fff;
|
||||||
|
grid-area: more;
|
||||||
|
margin-top: 0.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.moreExpanded {
|
||||||
|
transform: scaleY(-1);
|
||||||
|
transition: transform 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.moreCollapsed {
|
||||||
|
transform: scaleY(1);
|
||||||
|
transition: transform 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
/* ============== ACTION ================ */
|
/* ============== ACTION ================ */
|
||||||
|
|
||||||
.actionOverlay {
|
.actionOverlay {
|
||||||
|
|||||||
Reference in New Issue
Block a user