From: SleeplessOne1917 Date: Sun, 18 Jun 2023 13:29:01 +0000 (+0000) Subject: Merge branch 'main' into fix/site-sidebar-collapse X-Git-Url: http://these/git/?a=commitdiff_plain;h=4774c8248b2313219bb7e33bfee77c6e168fb15f;hp=08cb98f383112a27e887ca345893068b179cab4f;p=lemmy-ui.git Merge branch 'main' into fix/site-sidebar-collapse --- diff --git a/src/shared/components/common/banner-icon-header.tsx b/src/shared/components/common/banner-icon-header.tsx index 1df23be..7028ef4 100644 --- a/src/shared/components/common/banner-icon-header.tsx +++ b/src/shared/components/common/banner-icon-header.tsx @@ -15,17 +15,19 @@ export class BannerIconHeader extends Component { const banner = this.props.banner; const icon = this.props.icon; return ( -
- {banner && } - {icon && ( - - )} -
+ (banner || icon) && ( +
+ {banner && } + {icon && ( + + )} +
+ ) ); } } diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index 4d79bc6..4f9b969 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -443,16 +443,17 @@ export class Home extends Component { admins={admins} counts={counts} showLocal={showLocal(this.isoData)} + isMobile={true} /> )} {showTrendingMobile && ( -
-
{this.trendingCommunities(true)}
+
+ {this.trendingCommunities()}
)} {showSubscribedMobile && ( -
-
{this.subscribedCommunities}
+
+ {this.subscribedCommunities(true)}
)}
@@ -471,19 +472,7 @@ export class Home extends Component { return (
-
- {this.trendingCommunities()} - {canCreateCommunity(this.state.siteRes) && ( - - )} - -
+ {this.trendingCommunities()}
{ showLocal={showLocal(this.isoData)} /> {this.hasFollows && ( -
-
{this.subscribedCommunities}
-
+
+
+ {this.subscribedCommunities(false)} +
+
)}
); } - trendingCommunities(isMobile = false) { + trendingCommunities() { switch (this.state.trendingCommunitiesRes?.state) { case "loading": return ( @@ -514,68 +505,103 @@ export class Home extends Component { case "success": { const trending = this.state.trendingCommunitiesRes.data.communities; return ( -
-
- - # - + <> +
+
+ # - - -
-
    - {trending.map(cv => ( -
  • - -
  • - ))} -
-
+ + # + + + + +
+ {trending.length > 0 && ( +
    + {trending.map(cv => ( +
  • + +
  • + ))} +
+ )} + {canCreateCommunity(this.state.siteRes) && ( + + )} + +
+ ); } } } - get subscribedCommunities() { + subscribedCommunities(isMobile = false) { const { subscribedCollapsed } = this.state; return ( -
-
- - # - + <> +
+
+ # - - - -
- {!subscribedCollapsed && ( -
    - {UserService.Instance.myUserInfo?.follows.map(cfv => ( -
  • - -
  • - ))} -
- )} -
+ + # + + + + {!isMobile && ( + + )} + +
+
+
    + {UserService.Instance.myUserInfo?.follows.map(cfv => ( +
  • + +
  • + ))} +
+
+
+ ); } diff --git a/src/shared/components/home/site-sidebar.tsx b/src/shared/components/home/site-sidebar.tsx index 66a48ca..cc587bf 100644 --- a/src/shared/components/home/site-sidebar.tsx +++ b/src/shared/components/home/site-sidebar.tsx @@ -12,6 +12,7 @@ interface SiteSidebarProps { showLocal: boolean; counts?: SiteAggregates; admins?: PersonView[]; + isMobile?: boolean; } interface SiteSidebarState { @@ -29,39 +30,58 @@ export class SiteSidebar extends Component { render() { return ( -
-
-
-
{this.siteName()}
+
+
+
+ {this.siteName()} {!this.state.collapsed && ( - <> - - {this.siteInfo()} - + )} +
+ +
+
{this.siteInfo()}
-
-
+ +
); } siteName() { return ( -
- {this.props.site.name} - -
+ <> +
{this.props.site.name}
+ {!this.props.isMobile && ( + + )} + ); }