added randomized banner, fixes

This commit is contained in:
plebbitor
2023-02-05 18:44:16 +01:00
parent ed8a1952d2
commit dc6bed3a56
10 changed files with 95 additions and 16 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

+27 -8
View File
@@ -1,9 +1,20 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Container } from './styled/Home.styled' import { Container, NavBar, Header, Break, PostForm, TopBar } from './styled/Board.styled';
import { NavBar, Header, Break, PostForm } from './styled/Board.styled';
import { useFeed } from '@plebbit/plebbit-react-hooks'; import { useFeed } from '@plebbit/plebbit-react-hooks';
const ImageBanner = () => {
const [currentImage, setCurrentImage] = useState(1);
useEffect(() => {
setCurrentImage(Math.floor(Math.random() * 5) + 1);
}, []);
return (
<img id="banner-img" src={`banner-${currentImage}.jpg`} alt="banner" />
);
};
const Board = () => { const Board = () => {
// eslint-disable-next-line // eslint-disable-next-line
const { feed, hasMore, loadMore } = useFeed(['news.eth'], 'new'); const { feed, hasMore, loadMore } = useFeed(['news.eth'], 'new');
@@ -31,8 +42,8 @@ const Board = () => {
<NavBar> <NavBar>
<> <>
{defaultSubplebbits.map(subplebbit => ( {defaultSubplebbits.map(subplebbit => (
<span className="boardList">[ <span className="boardList" key={subplebbit.address}>[
<a href="/board" key={subplebbit.address}>{subplebbit.title}</a> <a href="/board">{subplebbit.title}</a>
]&nbsp; ]&nbsp;
</span> </span>
))} ))}
@@ -44,21 +55,29 @@ const Board = () => {
<Header> <Header>
<> <>
<div className="banner"> <div className="banner">
<img alt="plebchan" src="/banner.jpg"/> <ImageBanner />
</div> </div>
<div className="board-title">Plebs Helping Plebs</div> <div className="board-title">Plebs Helping Plebs</div>
<div className="board-address">p/plebshelpingplebs.eth</div> <div className="board-address">p/plebshelpingplebs.eth</div>
</> </>
</Header> </Header>
<Break /> <Break />
<PostForm> <PostForm name="post" action="" method="post" enctype="multipart/form-data">
{/* <div id="post-form-link"> <div id="post-form-link">
[ [
<a href="#">Start a New Thread</a> <a href="#">Start a New Thread</a>
] ]
</div> </div>
<table id="post-form"></table> */} <table id="post-form"></table>
</PostForm> </PostForm>
<TopBar>
<hr />
<input id="search-box" type="text" placeholder="Search OPs…" />
[
<a href="./catalog">Catalog</a>
]
<hr />
</TopBar>
</Container> </Container>
) )
} }
+64 -3
View File
@@ -1,5 +1,16 @@
import styled from 'styled-components'; import styled from 'styled-components';
export const Container = styled.div`
color: maroon;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
margin-left: 0;
margin-right: 0;
margin-top: 5px;
padding-left: 5px;
padding-right: 5px;
`;
export const NavBar = styled.div` export const NavBar = styled.div`
font-size: 9pt; font-size: 9pt;
color: #b86; color: #b86;
@@ -25,13 +36,13 @@ export const Header = styled.div`
.banner { .banner {
border: 1px solid #800; border: 1px solid #800;
margin: 5px auto; margin: 5px auto;
width: 311px; width: 300px;
height: 100px; height: 100px;
} }
img { img {
border: none; border: none;
width: 311px; width: 300px;
height: 100px; height: 100px;
} }
@@ -52,11 +63,61 @@ export const Header = styled.div`
`; `;
export const Break = styled.hr` export const Break = styled.hr`
width: 90%;
border: none; border: none;
border-top: 1px solid #d9bfb7; border-top: 1px solid #d9bfb7;
height: 0; height: 0;
`; `;
export const PostForm = styled.div` export const PostForm = styled.form`
#post-form-link {
font-size: 22px;
font-weight: 700;
text-align: center;
}
a, a:visited {
color: #00e;
text-decoration: none;
}
a:hover {
color: red;
}
`;
export const TopBar = styled.div`
clear: both;
hr {
border: none;
border-top: 1px solid #d9bfb7;
height: 0;
}
#search-box {
height: 16px;
line-height: 16px;
margin-top: 0;
margin-right: 2px;
margin-bottom: 0;
margin-left: 2px;
padding: 0 2px;
width: 120px;
-webkit-appearance: none;
appearance: none;
border: 1px solid #aaa;
outline: none;
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
a {
color: #00e;
text-decoration: none;
}
a:hover {
color: red;
}
`; `;
+4
View File
@@ -1,6 +1,10 @@
import styled from 'styled-components'; import styled from 'styled-components';
export const Container = styled.div` export const Container = styled.div`
height: 100%;
color: #800;
font: 13px/1.231 arial, helvetica, clean, sans-serif;
text-align: center;
margin: auto; margin: auto;
text-align: left; text-align: left;
width: 57.69em; width: 57.69em;
-5
View File
@@ -6,11 +6,6 @@ const GlobalStyle = createGlobalStyle`
margin: 0; margin: 0;
padding: 0; padding: 0;
background: #ffe url(/fade.png) top repeat-x; background: #ffe url(/fade.png) top repeat-x;
color: #800;
font: 13px/1.231 arial, helvetica, clean, sans-serif;
*font-size: small;
*font: x-small;
text-align: center;
} }
`; `;