generated from lucien/actix-react-template
Compare commits
No commits in common. "cbae2746fdaabdf81cb899816600f7f78195041a" and "b252122272f04c469c80287f221cabb53d18d5cb" have entirely different histories.
cbae2746fd
...
b252122272
11 changed files with 37 additions and 79 deletions
|
@ -4,8 +4,7 @@
|
|||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>EcoMarin</title>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&icon_names=sailing" />
|
||||
<title>Vite + React + TS</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
@ -13,7 +13,7 @@ export default function ArticleCard({ articlePreview }: { articlePreview: Articl
|
|||
margin: '20px',
|
||||
padding: '1.25em',
|
||||
paddingBottom: '1em',
|
||||
flex: '0 1 30%',
|
||||
flex: '27%',
|
||||
textAlign: 'left',
|
||||
}}>
|
||||
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fimages8.alphacoders.com%2F438%2F438396.jpg&f=1&nofb=1&ipt=14796576c139b58db62d2d2098392ef2fbaee77911040f7c0d98ab65a69c4644&ipo=images" alt="Article preview" style={{
|
||||
|
|
|
@ -8,48 +8,16 @@ export default function ArticlesSection() {
|
|||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
|
||||
const articles: ArticlePreview[] = [
|
||||
{
|
||||
id: 1,
|
||||
title: "The Great Barrier Reef",
|
||||
preview: "The Great Barrier Reef is the largest coral reef system in the world, composed of over 2,900 individual reefs and 900 islands stretching for over 2,300 kilometers (1,400 mi) over an area of approximately 344,400 square kilometers (133,000 sq mi).",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
title: "The Great Pacific Garbage Patch",
|
||||
preview: "The Great Pacific Garbage Patch, also known as the Pacific trash vortex, is a gyre of marine debris particles in the north-central Pacific Ocean. It is located roughly from 135°W to 155°W and 35°N to 42°N.",
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
title: "The Amazon Rainforest",
|
||||
preview: "The Amazon rainforest, alternatively, the Amazon Jungle, also known in English as Amazonia, is a moist broadleaf tropical rainforest in the Amazon biome that covers most of the Amazon basin of South America.",
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
title: "The Arctic",
|
||||
preview: "The Arctic is a polar region located at the northernmost part of Earth. The Arctic consists of the Arctic Ocean, adjacent seas, and parts of Alaska (United States), Northern Canada (Canada), Finland, Greenland (Kingdom of Denmark), Iceland, Norway, Russia, and Sweden.",
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
title: "The Antarctic",
|
||||
preview: "The Antarctic, is a polar region containing the geographic South Pole and is situated in the Antarctic region of the Southern Hemisphere, almost entirely south of the Antarctic Circle, and is surrounded by the Southern Ocean.",
|
||||
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
fetch('/api/articles')
|
||||
// .then(response => response.json())
|
||||
.then(_ => articles)
|
||||
.then(response => response.json())
|
||||
.then((data: ArticlePreview[]) => setArticlePreviews(data))
|
||||
.catch(_ => setError('Failed to fetch articles'))
|
||||
.finally(() => setLoading(false));
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="row" id="articles" style={{
|
||||
<div className="row" style={{
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
justifyContent: 'space-around',
|
||||
|
@ -69,12 +37,9 @@ export default function ArticlesSection() {
|
|||
textAlign: 'center',
|
||||
width: '100%',
|
||||
}}>Articles</h1>
|
||||
<div style={{width: '100%', display: 'flex', justifyContent: 'space-around', flexWrap: 'wrap'}}>
|
||||
|
||||
{articlePreviews.map(articlePreview => (
|
||||
<ArticleCard key={articlePreview.id} articlePreview={articlePreview} />
|
||||
))}
|
||||
</div>
|
||||
{articlePreviews.map(articlePreview => (
|
||||
<ArticleCard key={articlePreview.id} articlePreview={articlePreview} />
|
||||
))}
|
||||
{!loading && !error && articlePreviews.length === 0 && <p style={{color: "var(--color-lightblue)", fontSize: 22}}>No articles found</p>}
|
||||
{loading && <p style={{color: "var(--color-lightblue)", fontSize: 22}}>Loading...</p>}
|
||||
{error && <p style={{color: "var(--color-lightblue)", fontSize: 22}}>{error}</p>}
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { ReactNode, MouseEventHandler } from 'react';
|
||||
|
||||
interface ButtonProps {
|
||||
onClick: MouseEventHandler<HTMLButtonElement>;
|
||||
color: 'primary' | 'secondary';
|
||||
children: ReactNode;
|
||||
url?: string;
|
||||
}
|
||||
|
||||
export default function Button({ color, children, url }: ButtonProps) {
|
||||
export default function Button({ onClick, color, children }: ButtonProps) {
|
||||
return (
|
||||
<a style={{
|
||||
<button style={{
|
||||
backgroundColor: color === 'primary' ? 'var(--color-yellow)' : 'var(--color-darkblue)',
|
||||
borderRadius: '8px',
|
||||
borderWidth: '0',
|
||||
|
@ -29,8 +29,7 @@ export default function Button({ color, children, url }: ButtonProps) {
|
|||
userSelect: 'none',
|
||||
WebkitUserSelect: 'none',
|
||||
touchAction: 'manipulation',
|
||||
textDecoration: 'none',
|
||||
}} href={url} className="ni-button" role="button">{children}</a>
|
||||
}} onClick={onClick} className="ni-button" role="button">{children}</button>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ export default function ClickableLink({url, text}: ClickableLinkProps) {
|
|||
backgroundColor: "transparent",
|
||||
borderRadius: '8px',
|
||||
borderWidth: '0',
|
||||
color:"white",
|
||||
color:"purple",
|
||||
cursor: 'pointer',
|
||||
display: 'inline-block',
|
||||
fontFamily: '"Haas Grot Text R Web", "Helvetica Neue", Helvetica, Arial, sans-serif',
|
||||
|
|
|
@ -7,14 +7,12 @@ interface FooterProps {
|
|||
export default function Footer ({bgcolor}:FooterProps) {
|
||||
return (
|
||||
<footer style={{display: "flex", justifyContent: "space-between", backgroundColor:bgcolor}}>
|
||||
<div style={{ display : "flex", alignItems: "center", flexDirection: "column", margin:"5px", width:"10%"}}><p>ENSIBS</p><p>RedCRAB</p></div>
|
||||
<p>Made with ❤️ by RedCRAB</p>
|
||||
<div style={{ display : "flex", alignItems: "center", flexDirection: "row", margin:"5px", width:"10%"}}>
|
||||
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>ENSIBS<br />RedCRAB</div>
|
||||
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>
|
||||
<LogoButton
|
||||
url="https://www-ensibs.univ-ubs.fr/fr/index.html"
|
||||
logo = "https://www-ensibs.univ-ubs.fr/skins/ENSIBS/resources/img/logo.png"
|
||||
style={{ width: "100%", height: "auto",
|
||||
padding: "10px"}}/>
|
||||
style={{ width: "50%", height: "auto" }}/>
|
||||
</div>
|
||||
</footer>
|
||||
)
|
||||
|
|
|
@ -1,13 +1,19 @@
|
|||
import Button from "./Button";
|
||||
import ButtonLink from "./ButtonLink";
|
||||
import NavBar from "./NavBar";
|
||||
|
||||
export default function FstSection () {
|
||||
interface FstSectionProps {
|
||||
centertxt: string;
|
||||
txtbt1:string;
|
||||
txtbt2:string;
|
||||
image:string;
|
||||
}
|
||||
|
||||
export default function FstSection ({centertxt, txtbt1, txtbt2, image}: FstSectionProps) {
|
||||
return (
|
||||
<div style={{
|
||||
textAlign: "center",
|
||||
color: "yellow",
|
||||
backgroundImage: "url('/pictures/sea.gif')",
|
||||
backgroundImage: image,
|
||||
backgroundSize: "cover",
|
||||
backgroundPosition: "center",
|
||||
backgroundRepeat: "no-repeat",
|
||||
|
@ -22,18 +28,10 @@ export default function FstSection () {
|
|||
}}
|
||||
>
|
||||
<div style={{height:"150px"}} />
|
||||
<h1
|
||||
style={{
|
||||
fontSize: "3em",
|
||||
fontWeight: "bold",
|
||||
textShadow: "2px 2px 4px #000000",
|
||||
fontFamily: "Helvetica",
|
||||
}}
|
||||
|
||||
>Help us to save our oceans</h1><br />
|
||||
<h1>{centertxt}</h1><br />
|
||||
<div style={{display:"flex", justifyContent: "center", gap: "20px"}}>
|
||||
<Button color="primary" children={"Aller au jeu"} url="/game" />
|
||||
<Button color="secondary" children={"Lire les articles"} url="/" />
|
||||
<Button onClick={() => alert("One")} color="primary" children={txtbt1} />
|
||||
<Button onClick={() => {alert("Two")}} color="secondary" children={txtbt2} />
|
||||
</div>
|
||||
</div></div>
|
||||
)
|
||||
|
|
|
@ -4,16 +4,14 @@ import RoundButton from './RoundButton.tsx';
|
|||
|
||||
export default function NavBar(){
|
||||
return (
|
||||
<nav style={{ display: "flex", alignItems: "center", justifyContent: "space-between", padding: "0.5em 1em"}}>
|
||||
<nav style={{ display: "flex", alignItems: "center", justifyContent: "space-between"}}>
|
||||
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>
|
||||
{/* <LogoButton url="/" logo = "https://archlinux.org/static/hetzner_logo.41114a37d25f.png"/> */}
|
||||
<span class="material-symbols-outlined"
|
||||
style={{fontSize: "4em", color: "white", margin: "0.5em"}}>sailing</span>
|
||||
<LogoButton url="/" logo = "https://archlinux.org/static/hetzner_logo.41114a37d25f.png"/>
|
||||
<ClickableLink url="/" text = "Accueil" />
|
||||
<ClickableLink url="/game" text = "Jeu" />
|
||||
</div>
|
||||
<div style={{ display : "flex", alignItems: "center", flexDirection: "row"}}>
|
||||
<RoundButton url="https://archlinux.org" bgcolor="var(--color-white)" text="?"/>
|
||||
<RoundButton url="https://archlinux.org" bgcolor="purple" text="?"/>
|
||||
</div>
|
||||
</nav>);
|
||||
}
|
|
@ -8,11 +8,8 @@ export default function RoundButton({url, bgcolor, text}: RoundButtonProps) {
|
|||
return (<div>
|
||||
<a href={url}><button style={{
|
||||
backgroundColor: bgcolor,
|
||||
borderStyle: 'solid',
|
||||
borderColor:"var(--color-lightblue)",
|
||||
borderColor:"blue",
|
||||
borderRadius: '50%',
|
||||
width: '45px',
|
||||
height: '45px',
|
||||
borderWidth: '1',
|
||||
cursor: 'pointer',
|
||||
display: 'inline-block',
|
||||
|
|
|
@ -139,7 +139,7 @@ export default function GamePage() {
|
|||
<Sky sunPosition={[100, 10, 100]} />
|
||||
<OrbitControls />
|
||||
<Ocean />
|
||||
{/* <Axes /> */}
|
||||
<Axes />
|
||||
<Character />
|
||||
<Floor />
|
||||
{/* <Marker position={[0, 1, 0]} color="red" /> */}
|
||||
|
|
|
@ -6,7 +6,11 @@ export default function MainPage() {
|
|||
return (
|
||||
<>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', minHeight: '100vh' }}>
|
||||
<FstSection />
|
||||
<FstSection
|
||||
centertxt="Choisissez votre numéro :"
|
||||
txtbt1="Un"
|
||||
txtbt2="Deux"
|
||||
image="url('/pictures/sea.gif')"/>
|
||||
<ArticlesSection />
|
||||
<Footer bgcolor="lightblue"/>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue