diff --git a/packages/pl-fe/src/components/status-content.tsx b/packages/pl-fe/src/components/status-content.tsx index bd1d4ade8..2024eaf2f 100644 --- a/packages/pl-fe/src/components/status-content.tsx +++ b/packages/pl-fe/src/components/status-content.tsx @@ -182,7 +182,12 @@ const StatusContent: React.FC = React.memo(({ theme='muted' size='xs' onClick={toggleExpanded} - icon={expanded ? require('@tabler/icons/outline/chevron-up.svg') : require('@tabler/icons/outline/chevron-down.svg')} + icon={require('@tabler/icons/outline/chevron-down.svg')} + iconClassName={clsx( + 'transition-transform', { + 'rotate-180': expanded, + }, + )} > {expanded ? @@ -193,112 +198,114 @@ const StatusContent: React.FC = React.memo(({ ); } - if (expandable && !expanded) return <>{output}; + const hasPoll = !!status.poll_id; - let quote; + if (!expandable || expanded) { + let quote; - if (withMedia && status.quote_id) { - if ((status.quote_visible ?? true) === false) { - quote = ( -
-

-
- ); + if (withMedia && status.quote_id) { + if ((status.quote_visible ?? true) === false) { + quote = ( +
+

+
+ ); + } else { + quote = ; + } + } + + const media = withMedia && ((quote || status.card || status.media_attachments.length > 0)) && ( + + {(status.media_attachments.length > 0 || (status.card && !quote)) && ( +
+ + +
+ )} + + {quote} +
+ ); + + if (onClick) { + if (status.content) { + output.push( + + {parsedContent} + , + ); + } + + if (collapsed) { + output.push(); + } + + if (status.poll_id) { + output.push(); + } + + if (translatable) { + output.push(); + } + + if (media) { + output.push(media); + } + + if (hashtags.length) { + output.push(); + } } else { - quote = ; + if (status.content) { + output.push( + + {parsedContent} + , + ); + } + + if (collapsed) { + output.push( {}} key='read-more' quote={isQuote} preview={preview} />); + } + + if (status.poll_id) { + output.push(); + } + + if (translatable) { + output.push(); + } + + if (media) { + output.push(media); + } + + if (hashtags.length) { + output.push(); + } } } - const media = withMedia && ((quote || status.card || status.media_attachments.length > 0)) && ( - - {(status.media_attachments.length > 0 || (status.card && !quote)) && ( -
- - -
- )} - - {quote} -
- ); - if (onClick) { - if (status.content) { - output.push( - - {parsedContent} - , - ); - } - - const hasPoll = !!status.poll_id; - - if (collapsed) { - output.push(); - } - - if (status.poll_id) { - output.push(); - } - - if (translatable) { - output.push(); - } - - if (media) { - output.push(media); - } - - if (hashtags.length) { - output.push(); - } - return {output}; } else { - if (status.content) { - output.push( - - {parsedContent} - , - ); - } - - if (collapsed) { - output.push( {}} key='read-more' quote={isQuote} preview={preview} />); - } - - if (status.poll_id) { - output.push(); - } - - if (translatable) { - output.push(); - } - - if (media) { - output.push(media); - } - - if (hashtags.length) { - output.push(); - } - return <>{output}; } }); diff --git a/packages/pl-fe/src/components/ui/accordion.tsx b/packages/pl-fe/src/components/ui/accordion.tsx index 069b96cbf..230434d00 100644 --- a/packages/pl-fe/src/components/ui/accordion.tsx +++ b/packages/pl-fe/src/components/ui/accordion.tsx @@ -72,8 +72,10 @@ const Accordion: React.FC = ({ headline, children, menu, expanded = )} diff --git a/packages/pl-fe/src/components/ui/button/index.tsx b/packages/pl-fe/src/components/ui/button/index.tsx index e26c139e4..501b3a4f9 100644 --- a/packages/pl-fe/src/components/ui/button/index.tsx +++ b/packages/pl-fe/src/components/ui/button/index.tsx @@ -16,6 +16,8 @@ interface IButton extends Pick< block?: boolean; /** URL to an SVG icon to render inside the button. */ icon?: string; + /** Class name to apply to the icon element inside the button. */ + iconClassName?: string; /** URL to an SVG icon to render inside the button next to the text. */ secondaryIcon?: string; /** A predefined button size. */ @@ -36,6 +38,7 @@ const Button = React.forwardRef(({ children, disabled = false, icon, + iconClassName, secondaryIcon, onClick, size = 'md', @@ -72,7 +75,7 @@ const Button = React.forwardRef(({ type={type} data-testid='button' > - {icon ? : null} + {icon ? : null} {body && ( {body} diff --git a/packages/pl-fe/src/features/chats/components/chat-widget/chat-pane-header.tsx b/packages/pl-fe/src/features/chats/components/chat-widget/chat-pane-header.tsx index 6404596b4..01608aca6 100644 --- a/packages/pl-fe/src/features/chats/components/chat-widget/chat-pane-header.tsx +++ b/packages/pl-fe/src/features/chats/components/chat-widget/chat-pane-header.tsx @@ -1,3 +1,4 @@ +import clsx from 'clsx'; import React, { HTMLAttributes } from 'react'; import HStack from 'pl-fe/components/ui/hstack'; @@ -68,8 +69,10 @@ const ChatPaneHeader = (props: IChatPaneHeader) => {