From f066e974e6ed5b2cfa51630f3e6df2cad5c35ac0 Mon Sep 17 00:00:00 2001 From: cv <34649812+cpvalente@users.noreply.github.com> Date: Sun, 13 Jun 2021 12:39:24 +0200 Subject: [PATCH] expand / collapse --- client/src/features/info/Info.jsx | 11 +++--- client/src/features/info/Info.module.css | 12 +++++-- client/src/features/info/InfoLogger.jsx | 31 ++++++++++------- client/src/features/info/InfoTitle.jsx | 44 ++++++++++++++---------- 4 files changed, 58 insertions(+), 40 deletions(-) diff --git a/client/src/features/info/Info.jsx b/client/src/features/info/Info.jsx index 961602649..175c2722c 100644 --- a/client/src/features/info/Info.jsx +++ b/client/src/features/info/Info.jsx @@ -37,9 +37,9 @@ export default function Info() { // Handle selection data socket.on('selected', (data) => { - const formatedCurrent = `${data.index != null ? data.index + 1 : '-'}/${ - data.total != null ? data.total : '-' - }`; + const formatedCurrent = `Event ${ + data.index != null ? data.index + 1 : '-' + }/${data.total != null ? data.total : '-'}`; setSelected(formatedCurrent); }); @@ -51,6 +51,7 @@ export default function Info() { }; }, [socket]); + // TODO: Put this in use effect // prepare data const titlesNow = { title: titles.titleNow, @@ -68,10 +69,10 @@ export default function Info() { return ( <> -
{`Event ${selected}`}
+
{selected}
+ - ); } diff --git a/client/src/features/info/Info.module.css b/client/src/features/info/Info.module.css index 1d3e3851c..6f06843e7 100644 --- a/client/src/features/info/Info.module.css +++ b/client/src/features/info/Info.module.css @@ -6,7 +6,6 @@ border: 1px solid rgba(0, 0, 0, 0.05); border-radius: 4px; padding: 8px; - overflow-y: scroll; } .main { @@ -36,6 +35,11 @@ ul > li { color: #fff; } +.log { + overflow-y: scroll; + height: 40vh; +} + .info { color: #fff; } @@ -55,9 +59,11 @@ ul > li { } .moreExpanded { - transform: rotate(0deg); + transform: scaleY(-1); + transition: transform 0.3s; } .moreCollapsed { - transform: rotate(180deg); + transform: scaleY(1); + transition: transform 0.3s; } diff --git a/client/src/features/info/InfoLogger.jsx b/client/src/features/info/InfoLogger.jsx index 677502ce2..f6307b73e 100644 --- a/client/src/features/info/InfoLogger.jsx +++ b/client/src/features/info/InfoLogger.jsx @@ -1,30 +1,35 @@ import { Icon } from '@chakra-ui/react'; +import { useState } from 'react'; import { FiChevronUp } from 'react-icons/fi'; import style from './Info.module.css'; export default function InfoLogger(props) { + const [collapsed, setCollapsed] = useState(false); + const { logData } = props; + return (
Log props.setCollapsed(true)} + onClick={() => setCollapsed((c) => !c)} />
-
    -
  • 10:35:23 [PLAYBACK] Next
  • -
  • - 10:32:10 [CLIENT] New Socket client (Total now 3) -
  • -
  • 10:28:23 [PLAYBACK] Next
  • -
  • 10:25:23 [PLAYBACK] Play
  • -
  • 10:23:13 [SERVER] Server Reconnected
  • -
  • 10:23:10 [SERVER] Server Disconnected
  • -
+ {!collapsed && ( +
    +
  • 10:35:23 [PLAYBACK] Next
  • +
  • + 10:32:10 [CLIENT] New socket client (total: 3) +
  • +
  • 10:28:23 [PLAYBACK] Next
  • +
  • 10:25:23 [PLAYBACK] Play
  • +
  • 10:23:13 [SERVER] Server Reconnected
  • +
  • 10:23:10 [SERVER] Server Disconnected
  • +
+ )}
); } diff --git a/client/src/features/info/InfoTitle.jsx b/client/src/features/info/InfoTitle.jsx index 0ce66ab8f..4c3ab3db1 100644 --- a/client/src/features/info/InfoTitle.jsx +++ b/client/src/features/info/InfoTitle.jsx @@ -1,37 +1,43 @@ import { Icon } from '@chakra-ui/react'; +import { useState } from 'react'; import { FiChevronUp } from 'react-icons/fi'; import style from './Info.module.css'; export default function InfoTitle(props) { + const [collapsed, setCollapsed] = useState(false); + const { title, data } = props; return (
{title} props.setCollapsed(true)} + onClick={() => setCollapsed((c) => !c)} />
-
- Title: - {data.title} -
-
- Subtitle: - {data.subtitle} -
-
- Presenter: - {data.presenter} -
-
- Notes: - {data.note} -
+ {!collapsed && ( + <> +
+ Title: + {data.title} +
+
+ Presenter: + {data.presenter} +
+
+ Subtitle: + {data.subtitle} +
+
+ Notes: + {data.note} +
+ + )}
); }