Skip to content

Commit

Permalink
Tweaks & Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Metalloriff committed Sep 12, 2023
1 parent 64c38c5 commit cb3be8e
Show file tree
Hide file tree
Showing 6 changed files with 436 additions and 293 deletions.
2 changes: 1 addition & 1 deletion docs/assets/scripts/main.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/assets/styles/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 13 additions & 2 deletions src/Components/Posts/Posts.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from "lodash";
import React from "react";
import React, { useState } from "react";
import * as Feather from "react-feather";
import App from "../../App";
import API from "../../Classes/API";
Expand Down Expand Up @@ -65,6 +65,14 @@ export default function Posts({ prependedTags, emptyPlaceholder = null, request
const searchQuery = QueryManager.useState(() => QueryManager.get("search"));
const pageQuery = QueryManager.useState(() => QueryManager.get("page"));

const [columnCount, setColumnCount] = useState(Math.round(window.innerWidth / 480));

useEventListener("resize", () => {
setColumnCount(Math.round(window.innerWidth / 480));
}, { target: window });

console.log(columnCount);

dispatcher.useForceUpdater(ActionTypes.UPDATE_LOCAL_USER);

React.useEffect(() => {
Expand Down Expand Up @@ -240,7 +248,10 @@ export default function Posts({ prependedTags, emptyPlaceholder = null, request
<PostsContext.Provider value={{
posts
}}>
<div className="Posts">
<div className="Posts" style={{
"--post-column-count": columnCount > 3 ? columnCount : 3
}}>

<h2 className="PageLabel">{App.hash}</h2>

{!isFetching && !filteredPosts?.length && (
Expand Down
Loading

0 comments on commit cb3be8e

Please sign in to comment.