mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
added InfiniteScroll, perfected styles
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
import React, { useState, useEffect, useContext } from 'react';
|
import React, { useState, useEffect, useContext } from 'react';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
import { Container, NavBar, Header, Break, PostFormLink, PostFormTable, PostForm, TopBar, BoardForm } from './styles/Board.styled';
|
|
||||||
import { useFeed } from '@plebbit/plebbit-react-hooks';
|
|
||||||
import ImageBanner from './ImageBanner';
|
|
||||||
import { BoardContext } from '../App';
|
import { BoardContext } from '../App';
|
||||||
|
import { Container, NavBar, Header, Break, PostFormLink, PostFormTable, PostForm, TopBar, BoardForm } from './styles/Board.styled';
|
||||||
|
import ImageBanner from './ImageBanner';
|
||||||
|
import { useFeed } from '@plebbit/plebbit-react-hooks';
|
||||||
|
import InfiniteScroll from 'react-infinite-scroller';
|
||||||
|
|
||||||
const Board = ({ setBodyStyle }) => {
|
const Board = ({ setBodyStyle }) => {
|
||||||
const [defaultSubplebbits, setDefaultSubplebbits] = useState([]);
|
const [defaultSubplebbits, setDefaultSubplebbits] = useState([]);
|
||||||
@@ -12,7 +13,7 @@ const Board = ({ setBodyStyle }) => {
|
|||||||
const [showPostForm, setShowPostForm] = useState(false);
|
const [showPostForm, setShowPostForm] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { feed } = useFeed([`${selectedAddress}`], 'new');
|
const { feed, hasMore, loadMore } = useFeed([`${selectedAddress}`], 'new');
|
||||||
|
|
||||||
// console.log(feed);
|
// console.log(feed);
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ const Board = ({ setBodyStyle }) => {
|
|||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
<span className="nav">[
|
<span className="nav">[
|
||||||
<Link to="/" onClick={() => handleStyleChange({target: {value: "Yotsuba"}}
|
<Link id="home-button" to="/" onClick={() => handleStyleChange({target: {value: "Yotsuba"}}
|
||||||
)}>Home</Link>]
|
)}>Home</Link>]
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
@@ -216,7 +217,13 @@ const Board = ({ setBodyStyle }) => {
|
|||||||
</TopBar>
|
</TopBar>
|
||||||
<BoardForm selectedStyle={selectedStyle} id="board-form" name="board-form" action="" method="post">
|
<BoardForm selectedStyle={selectedStyle} id="board-form" name="board-form" action="" method="post">
|
||||||
<div className="board">
|
<div className="board">
|
||||||
{feed.map(object => {
|
<InfiniteScroll
|
||||||
|
pageStart={0}
|
||||||
|
loadMore={loadMore}
|
||||||
|
hasMore={hasMore}
|
||||||
|
loader={<div>Loading...</div>}
|
||||||
|
>
|
||||||
|
{feed.map(object => {
|
||||||
let counter = 1;
|
let counter = 1;
|
||||||
const thread = object;
|
const thread = object;
|
||||||
const { replies: { pages: { topAll: { comments } } } } = object;
|
const { replies: { pages: { topAll: { comments } } } } = object;
|
||||||
@@ -297,6 +304,7 @@ const Board = ({ setBodyStyle }) => {
|
|||||||
<hr key={`hr-${thread.cid}`} />
|
<hr key={`hr-${thread.cid}`} />
|
||||||
</>
|
</>
|
||||||
)})}
|
)})}
|
||||||
|
</InfiniteScroll>
|
||||||
</div>
|
</div>
|
||||||
</BoardForm>
|
</BoardForm>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -58,22 +58,21 @@ export const NavBar = styled.div`
|
|||||||
return `font-size: 11pt;
|
return `font-size: 11pt;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
||||||
a {
|
a, a:visited {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
|
color: #00e;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:visited {
|
|
||||||
color: #00e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav {
|
.nav {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
case 'Burichan':
|
case 'Burichan':
|
||||||
@@ -83,7 +82,8 @@ export const NavBar = styled.div`
|
|||||||
a, a:visited {
|
a, a:visited {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
color: #34345c
|
color: #34345c;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
a:hover {
|
a:hover {
|
||||||
@@ -899,6 +899,7 @@ export const PostForm = styled.form`
|
|||||||
|
|
||||||
a, a:visited {
|
a, a:visited {
|
||||||
color: #00e;
|
color: #00e;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: red;
|
color: red;
|
||||||
@@ -913,6 +914,7 @@ export const PostForm = styled.form`
|
|||||||
|
|
||||||
a, a:visited {
|
a, a:visited {
|
||||||
color: #34345c;
|
color: #34345c;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
color: red;
|
color: red;
|
||||||
|
|||||||
@@ -494,6 +494,10 @@ export const TopBar = styled.div`
|
|||||||
color: #00e !important;
|
color: #00e !important;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: red !important;
|
||||||
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
case 'Yotsuba B':
|
case 'Yotsuba B':
|
||||||
@@ -517,6 +521,10 @@ export const TopBar = styled.div`
|
|||||||
color: #34345c !important;
|
color: #34345c !important;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: red !important;
|
||||||
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
case 'Futaba':
|
case 'Futaba':
|
||||||
@@ -538,6 +546,10 @@ export const TopBar = styled.div`
|
|||||||
a, a:visited {
|
a, a:visited {
|
||||||
color: #00e !important;
|
color: #00e !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: red !important;
|
||||||
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
case 'Burichan':
|
case 'Burichan':
|
||||||
@@ -557,7 +569,11 @@ export const TopBar = styled.div`
|
|||||||
font-size: 12pt;
|
font-size: 12pt;
|
||||||
|
|
||||||
a, a:visited {
|
a, a:visited {
|
||||||
color: #00e !important;
|
color: #34345c !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: red !important;
|
||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
@@ -582,6 +598,10 @@ export const TopBar = styled.div`
|
|||||||
color: #81a2be !important;
|
color: #81a2be !important;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #5f89ab !important;
|
||||||
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
case 'Photon':
|
case 'Photon':
|
||||||
@@ -605,6 +625,10 @@ export const TopBar = styled.div`
|
|||||||
color: #f60 !important;
|
color: #f60 !important;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #ff3300 !important;
|
||||||
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user