fix banner button
This commit is contained in:
parent
ac3957fa13
commit
a997db2b42
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||||
import Link from './Link';
|
import Link from './Link';
|
||||||
|
|
||||||
interface Link {
|
interface Link {
|
||||||
to: string;
|
status: string;
|
||||||
text: string;
|
text: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,13 +11,14 @@ interface BannerProps {
|
||||||
description: string;
|
description: string;
|
||||||
links: Array<Link>;
|
links: Array<Link>;
|
||||||
image: string;
|
image: string;
|
||||||
|
setStatus: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {jsx} The root component
|
* @return {jsx} The root component
|
||||||
*/
|
*/
|
||||||
export default function Banner(
|
export default function Banner(
|
||||||
{title, description, links, image}: BannerProps) {
|
{setStatus, title, description, links, image}: BannerProps) {
|
||||||
let imgUrl;
|
let imgUrl;
|
||||||
if (image.startsWith('/static/images/')) {
|
if (image.startsWith('/static/images/')) {
|
||||||
imgUrl = image;
|
imgUrl = image;
|
||||||
|
@ -61,11 +62,11 @@ export default function Banner(
|
||||||
<br />
|
<br />
|
||||||
{links.map((elem, index) =>
|
{links.map((elem, index) =>
|
||||||
<p key={index} className='lead mt-2'>
|
<p key={index} className='lead mt-2'>
|
||||||
<Link
|
<button
|
||||||
className='btn btn-info btn-lg
|
className='btn btn-info btn-lg
|
||||||
font-weight-bold'
|
font-weight-bold'
|
||||||
to={elem.to}
|
onClick={() => setStatus(elem.status)}>
|
||||||
text={elem.text} />
|
{elem.text}</button>
|
||||||
</p>)}
|
</p>)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Banner from './Banner';
|
import Footer from './Footer';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {jsx} The homepage component
|
* @return {jsx} The homepage component
|
||||||
|
@ -7,20 +7,48 @@ import Banner from './Banner';
|
||||||
export default function Blog() {
|
export default function Blog() {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Banner
|
<Footer
|
||||||
title={`Un voyage à travers l'Europe`}
|
elements={[
|
||||||
description={`
|
|
||||||
On vous raconte nos aventures à travers l'Europe.\n
|
|
||||||
Nous voyageons en stop et sans argent.\n
|
|
||||||
On loge chez l'habitant ou dehors dans des hamacs.`}
|
|
||||||
links={[
|
|
||||||
{
|
{
|
||||||
to: '/blog',
|
title: 'À propos',
|
||||||
text: 'Notre carnet de voyage',
|
description: `Nous sommes deux jeunes de 23 ans à la
|
||||||
|
recherche d'aventures et de réponses à travers
|
||||||
|
l'Europe`,
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: '/about',
|
||||||
|
text: 'Plus de détails',
|
||||||
},
|
},
|
||||||
]}
|
],
|
||||||
image={'map.jpeg'}
|
}, {
|
||||||
/>
|
title: 'Nous contacter',
|
||||||
|
description:
|
||||||
|
<ul>
|
||||||
|
<li>curious.roamers@gmail.com</li>
|
||||||
|
<li>06 37 11 28 22</li>
|
||||||
|
</ul>,
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: '/contact',
|
||||||
|
text: `Autres façons de nous contacter`,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}, {
|
||||||
|
title: 'Donation',
|
||||||
|
description: `Si vous voulez contribuer à financer nos
|
||||||
|
futurs voyages ou simplement nous aider financièrement
|
||||||
|
:)`,
|
||||||
|
links: [
|
||||||
|
{
|
||||||
|
to: 'https://paypal.me/ygarrot',
|
||||||
|
text: 'Paypal',
|
||||||
|
}, {
|
||||||
|
to: 'https://tipeee.com/curious-roamers',
|
||||||
|
text: 'Tipeee',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]}/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,13 +4,18 @@ import Quote from './Quote';
|
||||||
import Footer from './Footer';
|
import Footer from './Footer';
|
||||||
import ImagesWithDescription from './ImagesWithDescription';
|
import ImagesWithDescription from './ImagesWithDescription';
|
||||||
|
|
||||||
|
interface HomeProps {
|
||||||
|
setStatus: any;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {jsx} The homepage component
|
* @return {jsx} The homepage component
|
||||||
*/
|
*/
|
||||||
export default function Home() {
|
export default function Home({setStatus}: HomeProps) {
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<Banner
|
<Banner
|
||||||
|
setStatus={setStatus}
|
||||||
title={`Un voyage à travers l'Europe`}
|
title={`Un voyage à travers l'Europe`}
|
||||||
description={`
|
description={`
|
||||||
On vous raconte nos aventures à travers l'Europe.\n
|
On vous raconte nos aventures à travers l'Europe.\n
|
||||||
|
@ -18,7 +23,7 @@ export default function Home() {
|
||||||
On loge chez l'habitant ou dehors dans des hamacs.`}
|
On loge chez l'habitant ou dehors dans des hamacs.`}
|
||||||
links={[
|
links={[
|
||||||
{
|
{
|
||||||
to: '/blog',
|
status: 'Blog',
|
||||||
text: 'Notre carnet de voyage',
|
text: 'Notre carnet de voyage',
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
|
|
|
@ -9,12 +9,12 @@ import Contact from './Contact';
|
||||||
* @return {jsx} The root component
|
* @return {jsx} The root component
|
||||||
*/
|
*/
|
||||||
export default function Root() {
|
export default function Root() {
|
||||||
const [page, setPage] = useState(<Home />);
|
|
||||||
const [navbarStatus, setNavbarStatus] = useState('Home');
|
const [navbarStatus, setNavbarStatus] = useState('Home');
|
||||||
|
const [page, setPage] = useState(<Home setStatus={setNavbarStatus} />);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (navbarStatus == 'Home') {
|
if (navbarStatus == 'Home') {
|
||||||
setPage(<Home />);
|
setPage(<Home setStatus={setNavbarStatus} />);
|
||||||
} else if (navbarStatus == 'Blog') {
|
} else if (navbarStatus == 'Blog') {
|
||||||
setPage(<Blog />);
|
setPage(<Blog />);
|
||||||
} else if (navbarStatus == 'About') {
|
} else if (navbarStatus == 'About') {
|
||||||
|
|
Loading…
Reference in New Issue