fix: Fix Trending sidebar card too

This commit is contained in:
Jay Sitter 2023-06-17 15:32:49 -04:00
parent 0d302c0e40
commit c8758317f7

View file

@ -1,3 +1,4 @@
import classNames from "classnames";
import { NoOptionI18nKeys } from "i18next"; import { NoOptionI18nKeys } from "i18next";
import { Component, linkEvent, MouseEventHandler } from "inferno"; import { Component, linkEvent, MouseEventHandler } from "inferno";
import { T } from "inferno-i18next-dess"; import { T } from "inferno-i18next-dess";
@ -448,7 +449,7 @@ export class Home extends Component<any, HomeState> {
)} )}
{showTrendingMobile && ( {showTrendingMobile && (
<div className="card border-secondary mb-3"> <div className="card border-secondary mb-3">
<div className="card-body">{this.trendingCommunities(true)}</div> {this.trendingCommunities(true)}
</div> </div>
)} )}
{showSubscribedMobile && ( {showSubscribedMobile && (
@ -472,19 +473,7 @@ export class Home extends Component<any, HomeState> {
return ( return (
<div id="sidebarContainer"> <div id="sidebarContainer">
<section id="sidebarMain" className="card border-secondary mb-3"> <section id="sidebarMain" className="card border-secondary mb-3">
<div className="card-body">
{this.trendingCommunities()} {this.trendingCommunities()}
{canCreateCommunity(this.state.siteRes) && (
<LinkButton
path="/create_community"
translationKey="create_a_community"
/>
)}
<LinkButton
path="/communities"
translationKey="explore_communities"
/>
</div>
</section> </section>
<SiteSidebar <SiteSidebar
site={site} site={site}
@ -517,8 +506,13 @@ export class Home extends Component<any, HomeState> {
case "success": { case "success": {
const trending = this.state.trendingCommunitiesRes.data.communities; const trending = this.state.trendingCommunitiesRes.data.communities;
return ( return (
<div className={!isMobile ? "mb-2" : ""}> <div
<h5> className={classNames({
"mb-2": !isMobile,
})}
>
<header className="card-header d-flex align-items-center">
<h5 className="mb-0">
<T i18nKey="trending_communities"> <T i18nKey="trending_communities">
# #
<Link className="text-body" to="/communities"> <Link className="text-body" to="/communities">
@ -526,16 +520,26 @@ export class Home extends Component<any, HomeState> {
</Link> </Link>
</T> </T>
</h5> </h5>
<ul className="list-inline mb-0"> </header>
<div className="card-body">
<ul className="list-inline">
{trending.map(cv => ( {trending.map(cv => (
<li <li key={cv.community.id} className="list-inline-item">
key={cv.community.id}
className="list-inline-item d-inline-block"
>
<CommunityLink community={cv.community} /> <CommunityLink community={cv.community} />
</li> </li>
))} ))}
</ul> </ul>
{canCreateCommunity(this.state.siteRes) && (
<LinkButton
path="/create_community"
translationKey="create_a_community"
/>
)}
<LinkButton
path="/communities"
translationKey="explore_communities"
/>
</div>
</div> </div>
); );
} }