Skip to content

Commit

Permalink
Fix: missing semantic css classes and html elements (#1583)
Browse files Browse the repository at this point in the history
* Fix: missing semantic css classes and html elements.

Now all pages have a main and aside element when a sidebar is present to facilitate custom theming. This does not impact the default behavior of the front.

* Fix: re-added communityref on main element

---------

Co-authored-by: 0xAnansi <[email protected]>
Co-authored-by: Jay Sitter <[email protected]>
Co-authored-by: Dessalines <[email protected]>
  • Loading branch information
4 people authored Jun 26, 2023
1 parent c6f23aa commit cb6ab15
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/shared/components/app/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class App extends Component<any, any> {

return (
<ErrorGuard>
<main tabIndex={-1} ref={this.mainContentRef}>
<div tabIndex={-1}>
{RouteComponent &&
(isAuthPath(path ?? "") ? (
<AuthGuard>
Expand All @@ -68,7 +68,7 @@ export class App extends Component<any, any> {
) : (
<RouteComponent {...routeProps} />
))}
</main>
</div>
</ErrorGuard>
);
}}
Expand Down
14 changes: 7 additions & 7 deletions src/shared/components/community/community.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
} from "@utils/helpers";
import type { QueryParams } from "@utils/types";
import { RouteDataResponse } from "@utils/types";
import { Component, linkEvent } from "inferno";
import { Component, RefObject, createRef, linkEvent } from "inferno";
import { RouteComponentProps } from "inferno-router/dist/Route";
import {
AddAdmin,
Expand Down Expand Up @@ -154,7 +154,7 @@ export class Community extends Component<
finished: new Map(),
isIsomorphic: false,
};

private readonly mainContentRef: RefObject<HTMLElement>;
constructor(props: RouteComponentProps<{ name: string }>, context: any) {
super(props, context);

Expand Down Expand Up @@ -195,7 +195,7 @@ export class Community extends Component<
this.handleSavePost = this.handleSavePost.bind(this);
this.handlePurgePost = this.handlePurgePost.bind(this);
this.handleFeaturePost = this.handleFeaturePost.bind(this);

this.mainContentRef = createRef();
// Only fetch the data if coming from another route
if (FirstLoadService.isFirstLoad) {
const { communityRes, commentsRes, postsRes } = this.isoData.routeData;
Expand Down Expand Up @@ -317,7 +317,7 @@ export class Community extends Component<
/>

<div className="row">
<div className="col-12 col-md-8">
<main className="col-12 col-md-8" ref={this.mainContentRef}>
{this.communityInfo(res)}
<div className="d-block d-md-none">
<button
Expand All @@ -339,10 +339,10 @@ export class Community extends Component<
{this.selects(res)}
{this.listings(res)}
<Paginator page={page} onChange={this.handlePageChange} />
</div>
<div className="d-none d-md-block col-md-4">
</main>
<aside className="d-none d-md-block col-md-4">
{this.sidebar(res)}
</div>
</aside>
</div>
</>
);
Expand Down
8 changes: 5 additions & 3 deletions src/shared/components/post/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export class Post extends Component<any, PostState> {
const res = this.state.postRes.data;
return (
<div className="row">
<div className="col-12 col-md-8 mb-3">
<main className="col-12 col-md-8 mb-3">
<HtmlTags
title={this.documentTitle}
path={this.context.router.route.match.url}
Expand Down Expand Up @@ -415,8 +415,10 @@ export class Post extends Component<any, PostState> {
this.commentsTree()}
{this.state.commentViewType == CommentViewType.Flat &&
this.commentsFlat()}
</div>
<div className="d-none d-md-block col-md-4">{this.sidebar()}</div>
</main>
<aside className="d-none d-md-block col-md-4">
{this.sidebar()}
</aside>
</div>
);
}
Expand Down

0 comments on commit cb6ab15

Please sign in to comment.