From 81b92c4acb4c3e37150b1254ed6e7a2956c5ac7f Mon Sep 17 00:00:00 2001 From: Alejandro Date: Mon, 13 Feb 2023 11:47:52 +0100 Subject: [PATCH] HTML auto direction for specific textual content (#286) --- src/Element/Collapsed.tsx | 26 ++++++++++---------------- src/Element/Text.tsx | 2 +- src/Element/Textarea.tsx | 1 + src/Pages/ProfilePage.tsx | 8 ++++---- src/Pages/new/DiscoverFollows.tsx | 4 ++-- src/Pages/new/GetVerified.tsx | 2 +- src/Pages/new/ImportFollows.tsx | 24 +++++++++++++----------- src/Pages/new/NewUserFlow.tsx | 2 +- src/Pages/new/NewUsername.tsx | 2 +- src/index.css | 8 ++++---- 10 files changed, 38 insertions(+), 41 deletions(-) diff --git a/src/Element/Collapsed.tsx b/src/Element/Collapsed.tsx index c96202d..0459376 100644 --- a/src/Element/Collapsed.tsx +++ b/src/Element/Collapsed.tsx @@ -22,19 +22,11 @@ const Collapsed = ({ text, children, collapsed, setCollapsed }: CollapsedProps) interface CollapsedIconProps { icon: ReactNode; - children: ReactNode; collapsed: boolean; } -export const CollapsedIcon = ({ icon, children, collapsed }: CollapsedIconProps) => { - return collapsed ? ( -
{icon}
- ) : ( -
- {icon} - {children} -
- ); +export const CollapsedIcon = ({ icon, collapsed }: CollapsedIconProps) => { + return collapsed ?
{icon}
:
{icon}
; }; interface CollapsedSectionProps { @@ -50,12 +42,14 @@ export const CollapsedSection = ({ title, children }: CollapsedSectionProps) => ); return ( -
-

setCollapsed(!collapsed)}>{title}

- - {children} - -
+ <> +
+

setCollapsed(!collapsed)}>{title}

+ +
+ + {collapsed ? null : children} + ); }; diff --git a/src/Element/Text.tsx b/src/Element/Text.tsx index a7ab2c4..a460b67 100644 --- a/src/Element/Text.tsx +++ b/src/Element/Text.tsx @@ -128,7 +128,7 @@ export default function Text({ content, tags, creator, users }: TextProps) { function transformParagraph(frag: TextFragment) { const fragments = transformText(frag); if (fragments.every(f => typeof f === "string")) { - return

{fragments}

; + return

{fragments}

; } return <>{fragments}; } diff --git a/src/Element/Textarea.tsx b/src/Element/Textarea.tsx index 7d5923e..0c01275 100644 --- a/src/Element/Textarea.tsx +++ b/src/Element/Textarea.tsx @@ -72,6 +72,7 @@ const Textarea = (props: TextareaProps) => { return ( // @ts-expect-error If anybody can figure out how to type this, please do Loading...} placeholder={formatMessage(messages.NotePlaceholder)} diff --git a/src/Pages/ProfilePage.tsx b/src/Pages/ProfilePage.tsx index 26bce38..8feab8c 100644 --- a/src/Pages/ProfilePage.tsx +++ b/src/Pages/ProfilePage.tsx @@ -150,10 +150,10 @@ export default function ProfilePage() { function bio() { return ( - aboutText.length > 0 && ( - <> -
{about}
- + aboutText.length && ( +
+ {about} +
) ); } diff --git a/src/Pages/new/DiscoverFollows.tsx b/src/Pages/new/DiscoverFollows.tsx index 9bd8993..32c3d72 100644 --- a/src/Pages/new/DiscoverFollows.tsx +++ b/src/Pages/new/DiscoverFollows.tsx @@ -13,7 +13,7 @@ export default function DiscoverFollows() { }, []); return ( -
+
@@ -26,7 +26,7 @@ export default function DiscoverFollows() {

- {sortedReccomends.length > 0 && } +
{sortedReccomends.length > 0 && }
); } diff --git a/src/Pages/new/GetVerified.tsx b/src/Pages/new/GetVerified.tsx index 166be02..1b68db1 100644 --- a/src/Pages/new/GetVerified.tsx +++ b/src/Pages/new/GetVerified.tsx @@ -24,7 +24,7 @@ export default function GetVerified() { }; return ( -
+
diff --git a/src/Pages/new/ImportFollows.tsx b/src/Pages/new/ImportFollows.tsx index 94922ce..45d57bd 100644 --- a/src/Pages/new/ImportFollows.tsx +++ b/src/Pages/new/ImportFollows.tsx @@ -49,7 +49,7 @@ export default function ImportFollows() { } return ( -
+
@@ -84,16 +84,18 @@ export default function ImportFollows() {
{error.length > 0 && {error}} - {sortedTwitterFollows.length > 0 && ( - - - - } - pubkeys={sortedTwitterFollows} - /> - )} +
+ {sortedTwitterFollows.length > 0 && ( + + + + } + pubkeys={sortedTwitterFollows} + /> + )} +