From 9ec1e7675001ce0d860f581b16f09a5cd84a8a28 Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Fri, 26 Mar 2021 20:53:03 +0100 Subject: [PATCH] event list style change user flow --- src/features/editors/list/BlockBlock.jsx | 4 + src/features/editors/list/DelayBlock.jsx | 53 ++++++ src/features/editors/list/EventList.jsx | 62 ++++--- src/features/editors/list/EventListItem.jsx | 134 ++++++++++----- src/features/editors/list/List.module.css | 175 ++++++++++++++++++++ 5 files changed, 350 insertions(+), 78 deletions(-) create mode 100644 src/features/editors/list/BlockBlock.jsx create mode 100644 src/features/editors/list/DelayBlock.jsx create mode 100644 src/features/editors/list/List.module.css diff --git a/src/features/editors/list/BlockBlock.jsx b/src/features/editors/list/BlockBlock.jsx new file mode 100644 index 000000000..ebe611029 --- /dev/null +++ b/src/features/editors/list/BlockBlock.jsx @@ -0,0 +1,4 @@ +import style from './List.module.css'; +export default function BlockBlock() { + return
; +} diff --git a/src/features/editors/list/DelayBlock.jsx b/src/features/editors/list/DelayBlock.jsx new file mode 100644 index 000000000..a8b695933 --- /dev/null +++ b/src/features/editors/list/DelayBlock.jsx @@ -0,0 +1,53 @@ +import { IconButton } from '@chakra-ui/button'; +import { AddIcon, MinusIcon } from '@chakra-ui/icons'; +import { Box } from '@chakra-ui/layout'; +import { useNumberInput } from '@chakra-ui/number-input'; +import { + Slider, + SliderFilledTrack, + SliderThumb, + SliderTrack, +} from '@chakra-ui/slider'; +import { useState } from 'react'; +import style from './List.module.css'; + +export default function DelayBlock() { + const [delay, setDelay] = useState(0); + const { getIncrementButtonProps, getDecrementButtonProps } = useNumberInput({ + step: 1, + defaultValue: 0, + min: -60, + max: 60, + }); + + const inc = getIncrementButtonProps(); + const dec = getDecrementButtonProps(); + + const populateDelay = (val) => { + console.log('set delay in parent', val); + }; + + return ( +
+
{`${delay} min`}
+ setDelay(val)} + onChangeEnd={(val) => populateDelay(val)} + > + + + + + + +
+ } colorScheme='red' /> + } colorScheme='blue' /> +
+
+ ); +} diff --git a/src/features/editors/list/EventList.jsx b/src/features/editors/list/EventList.jsx index 0f7186a86..af1e2611b 100644 --- a/src/features/editors/list/EventList.jsx +++ b/src/features/editors/list/EventList.jsx @@ -1,44 +1,40 @@ -import { Table, Thead, Tbody, Tr, Th } from '@chakra-ui/react'; +import { AddIcon, AttachmentIcon, DownloadIcon } from '@chakra-ui/icons'; +import { Button, IconButton } from '@chakra-ui/react'; import { useContext } from 'react'; import { EventContext } from '../../../app/context/eventContext'; import { EventListContext } from '../../../app/context/eventListContext'; import EventListItem from './EventListItem'; -import { sortByDate, sortByNumber } from './listUtils'; +import { sortByNumber } from './listUtils'; +import style from './List.module.css'; +import DelayBlock from './DelayBlock'; +import BlockBlock from './BlockBlock'; export default function EventList(props) { const [events] = useContext(EventListContext); - const [event, setEvent] = useContext(EventContext); - - const handleSetSelected = (id) => { - setEvent(events.filter((e) => e.id === id)[0]); - props.setFormMode('edit'); - }; - - const disabled = props.formMode !== null; + const [, setEvent] = useContext(EventContext); return ( - - - - - - - - - - - - - {sortByNumber(events).map((e) => ( - - ))} - -
Event TitleEvent SubtitlePresenter NameTime StartTime End
+ <> +
+ + + } colorScheme='blue' /> +
+
+ + + + + + + + + +
+ ); } diff --git a/src/features/editors/list/EventListItem.jsx b/src/features/editors/list/EventListItem.jsx index 2875a8268..92319ea5f 100644 --- a/src/features/editors/list/EventListItem.jsx +++ b/src/features/editors/list/EventListItem.jsx @@ -1,50 +1,94 @@ -import { IconButton } from '@chakra-ui/button'; -import { Td, Tr } from '@chakra-ui/table'; -import { format } from 'date-fns'; -import { timeFormat } from '../../../common/dateConfig'; -import { LockIcon, ChevronRightIcon } from '@chakra-ui/icons'; +import { + AddIcon, + ChevronDownIcon, + ChevronUpIcon, + MinusIcon, + NotAllowedIcon, + TimeIcon, +} from '@chakra-ui/icons'; +import { + IconButton, + Editable, + EditablePreview, + EditableInput, +} from '@chakra-ui/react'; +import { useState } from 'react'; +import style from './List.module.css'; export default function EventListItem(props) { - const isSelected = props.selectedId === props.data.id; - console.log(props); + const [more, setMore] = useState(false); + const [armed, setArmed] = useState(false); + return ( - - {props.data.title} - {props.data.subtitle} - {props.data.presenter} - - {props.data.timeStart && format(props.data.timeStart, timeFormat)} - - {props.data?.timeEnd && format(props.data?.timeEnd, timeFormat)}{' '} - {props.data?.timerDuration} - - props.setSelected(props.data.id)} - disabled={props.disabled} - size='sm' - aria-label='Select Item' - icon={} - /> - - - props.setSelected(props.data.id)} - disabled={props.disabled} - size='sm' - aria-label='Select Item' - icon={} - /> - - +
+
setArmed(!armed)} + /> +
+ + + + +
+
+ {more ? ( +
+
+ Title + + + + +
+
+ Subtitle + + + + +
+
+ Presenter + + + + +
+
+ ) : ( +
+
+ Title + + + + +
+
+ )} +
setMore(!more)}> + {more ? : } +
+
+
+ } colorScheme='red' /> + } colorScheme='blue' /> + } colorScheme='yellow' /> + } colorScheme='purple' /> +
+
); } diff --git a/src/features/editors/list/List.module.css b/src/features/editors/list/List.module.css new file mode 100644 index 000000000..e11289de6 --- /dev/null +++ b/src/features/editors/list/List.module.css @@ -0,0 +1,175 @@ +/* ============= EVENT LIST ============= */ +.headerButtons { + display: flex; + gap: 0.5em; + align-content: center; + justify-content: flex-end; +} + +.eventContainer { +} + +/* ============= EVENT ITEM ============= */ + +.eventRow, +.eventRowActive { + margin: 0.2em 0; + padding: 0.2em 0.5em; + position: relative; + top: 1em; + left: 0; + width: 100%; + display: grid; + grid-template-columns: 2em 5em 1fr auto; + gap: 0.5em; + justify-content: center; + align-content: center; + align-items: center; + border-radius: 8px; +} + +.eventRow { + background-color: #0001; +} + +.eventRowActive { + background-color: #b2f5eaaa; +} + +.arm, +.armActive { + width: 20px; + height: 20px; + border-radius: 10px; + cursor: pointer; +} + +.arm { + background-color: #888; + border: 1px solid #444; +} + +.armActive { + background: radial-gradient( + circle, + rgba(22, 255, 0, 1) 0%, + rgba(50, 255, 31, 1) 49%, + rgba(0, 0, 0, 1) 65%, + rgba(0, 255, 156, 0.7083333333333333) 81% + ); + border: 1px solid #256e62; +} + +.time, +.titleContainer, +.detailedContainer { + background-color: #fff8; + border: 1px solid #0001; + border-radius: 3px; +} + +.time { + width: 4em; + height: fit-content; +} + +.rowDetailed { + display: inline-flex; + position: relative; +} + +.titleContainer, +.detailedContainer { + width: 90%; + display: block; +} + +.detailedContainer > div, +.titleContainer > div { + display: inline; +} + +.detailedTitle, +.detailedTitleUnderlined { + padding-left: 1em; + font-size: 0.8em; + color: #888; + display: inline-block; + width: 6em; +} + +.detailedTitleUnderlined { + border-bottom: 1px solid #0001; +} + +.more { + position: absolute; + right: 0.25em; + top: 0em; +} + +.actionOverlay { + display: flex; + flex-direction: row; + gap: 0.5em; + align-content: center; + align-self: center; + + opacity: 0.6; + transition: linear 0.1s; +} + +.eventRow:hover > .actionOverlay { + opacity: 0.9; + transition: linear 0.1s; +} + +.actionOverlay:hover { + opacity: 1; +} + +/* ============= DELAY BLOCK ============= */ +.delayContainer { + position: relative; + top: 1em; + margin: 0.2em 0; + padding: 0.2em 1em; + width: 100%; + background-color: #ecc94baa; + border-radius: 8px; + color: white; + border: 1px solid #0001; + border-top: 8px solid #ecc94b; + box-sizing: border-box; + + width: 100%; + display: flex; + margin: auto; + gap: 1em; +} + +.delayValue { + color: #000; + background-color: #fff5; + border-radius: 4px; + padding: 0.2em; + text-align: center; + width: 6em; + border: 1px solid #0001; +} + +/* ============= BLOCK BLOCK ============= */ +.blockContainer { + position: relative; + top: 1em; + margin: 0.2em 0; + padding: 0.2em 1em; + width: 100%; + background-color: #805ad5aa; + border-radius: 8px; + color: white; + height: 2em; + border: 1px solid #0001; + border-bottom: 8px solid #805ad5; + box-sizing: border-box; +}