From f9e67512791fd594cb926b09a0bc2117e8cc9960 Mon Sep 17 00:00:00 2001 From: Alexander Deshkevich Date: Mon, 16 Oct 2023 18:58:55 -0300 Subject: [PATCH] fix render lists in conversation --- .../ConversationBubble.module.css | 11 ++++++ .../src/conversation/ConversationBubble.tsx | 35 ++++++++++--------- 2 files changed, 29 insertions(+), 17 deletions(-) create mode 100644 frontend/src/conversation/ConversationBubble.module.css diff --git a/frontend/src/conversation/ConversationBubble.module.css b/frontend/src/conversation/ConversationBubble.module.css new file mode 100644 index 0000000..4a8d3a1 --- /dev/null +++ b/frontend/src/conversation/ConversationBubble.module.css @@ -0,0 +1,11 @@ +.list p { + display: inline; +} + +.list li:not(:first-child) { + margin-top: 1em; +} + +.list li > .list { + margin-top: 1em; +} diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index ad7db7a..47fe709 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -1,6 +1,7 @@ import { forwardRef, useState } from 'react'; import Avatar from '../Avatar'; import { FEEDBACK, MESSAGE_TYPE } from './conversationModels'; +import classes from './ConversationBubble.module.css'; import Alert from './../assets/alert.svg'; import { ReactComponent as Like } from './../assets/like.svg'; import { ReactComponent as Dislike } from './../assets/dislike.svg'; @@ -40,16 +41,6 @@ const ConversationBubble = forwardRef< }, 2000); }; - const List = ({ - ordered, - children, - }: { - ordered?: boolean; - children: React.ReactNode; - }) => { - const Tag = ordered ? 'ol' : 'ul'; - return {children}; - }; let bubble; if (type === 'QUESTION') { @@ -104,11 +95,23 @@ const ConversationBubble = forwardRef< ); }, - ul({ node, children }) { - return {children}; + ul({ children }) { + return ( + + ); }, - ol({ node, children }) { - return {children}; + ol({ children }) { + return ( +
    + {children} +
+ ); }, }} > @@ -118,9 +121,7 @@ const ConversationBubble = forwardRef< <>
-
- Sources: -
+
Sources:
{sources?.map((source, index) => (