-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/new-homepage' into dev
- Loading branch information
Showing
40 changed files
with
1,598 additions
and
561 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,166 +1,203 @@ | ||
import * as React from "react" | ||
import * as React from "react"; | ||
import Backer from "../modules/backer"; | ||
import Carousel from 'react-multi-carousel'; | ||
import 'react-multi-carousel/lib/styles.css'; | ||
import Carousel from "react-multi-carousel"; | ||
import "react-multi-carousel/lib/styles.css"; | ||
|
||
import {content} from "../../datas/home/content" | ||
import { content } from "../../datas/home/content"; | ||
import Resource from "../modules/resource"; | ||
import {resources} from "../../datas/home/resources"; | ||
import { resources } from "../../datas/home/resources"; | ||
import Button from "../buttons/button"; | ||
import {videos} from "../../datas/resources/videos"; | ||
import {podcasts} from "../../datas/resources/podcasts"; | ||
import {whitepapers} from "../../datas/resources/whitepapers"; | ||
import { videos } from "../../datas/resources/videos"; | ||
import { podcasts } from "../../datas/resources/podcasts"; | ||
import { whitepapers } from "../../datas/resources/whitepapers"; | ||
|
||
const responsive = { | ||
desktop: { | ||
breakpoint: { max: 3000, min: 1024 }, | ||
items: 6, | ||
slidesToSlide:3 | ||
}, | ||
laptop: { | ||
breakpoint: { max: 1440, min: 640 }, | ||
items: 5, | ||
slidesToSlide:3 | ||
}, | ||
tablet: { | ||
breakpoint: { max: 1024, min: 464 }, | ||
items: 3, | ||
slidesToSlide:3 | ||
}, | ||
mobile: { | ||
breakpoint: { max: 640, min: 0 }, | ||
items: 1, | ||
slidesToSlide:1 | ||
} | ||
desktop: { | ||
breakpoint: { max: 3000, min: 1024 }, | ||
items: 6, | ||
slidesToSlide: 3, | ||
}, | ||
laptop: { | ||
breakpoint: { max: 1440, min: 640 }, | ||
items: 5, | ||
slidesToSlide: 3, | ||
}, | ||
tablet: { | ||
breakpoint: { max: 1024, min: 464 }, | ||
items: 3, | ||
slidesToSlide: 3, | ||
}, | ||
mobile: { | ||
breakpoint: { max: 640, min: 0 }, | ||
items: 1, | ||
slidesToSlide: 1, | ||
}, | ||
}; | ||
|
||
|
||
const ButtonGroup = ({ next, previous, goToSlide, ...rest }) => { | ||
return ( | ||
<div className="carousel-button-group"> | ||
<button className={'button button button-left'} onClick={() => previous()}><i className={'icon-carousel-left'}/></button> | ||
<button className={'button button button-right'} onClick={() => next()}><i className={'icon-carousel-right'}/></button> | ||
</div> | ||
); | ||
return ( | ||
<div className='carousel-button-group'> | ||
<button className={"button button button-left"} onClick={() => previous()}> | ||
<i className={"icon-carousel-left"} /> | ||
</button> | ||
<button className={"button button button-right"} onClick={() => next()}> | ||
<i className={"icon-carousel-right"} /> | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default class BackersSection extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
posts : [] | ||
}; | ||
} | ||
async getPosts() { | ||
try { | ||
let response = await fetch('https://blog.celestia.org/ghost/api/v3/content/posts/?key=000cf34311006e070b17fffcfd&limit=5&fields=title,text,feature_image,url'); | ||
let responseJson = await response.json(); | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
posts: [], | ||
}; | ||
} | ||
async getPosts() { | ||
try { | ||
let response = await fetch( | ||
"https://blog.celestia.org/ghost/api/v3/content/posts/?key=000cf34311006e070b17fffcfd&limit=5&fields=title,text,feature_image,url" | ||
); | ||
let responseJson = await response.json(); | ||
|
||
const blogPosts = []; | ||
for (const [key, value] of Object.entries(responseJson.posts)) { | ||
blogPosts.push({category:'blog', title:value.title, text: value.text, image: value.feature_image, url: value.url}); | ||
} | ||
this.setState({posts:blogPosts}) | ||
} catch(error) { | ||
console.error(error); | ||
} | ||
} | ||
getContent(id){ | ||
var content = ''; | ||
switch (resources[id].category){ | ||
case "blog": | ||
content = this.state.posts[resources[id].id]; | ||
break; | ||
case "video": | ||
content = videos[resources[id].id]; | ||
break; | ||
case "podcast": | ||
content = podcasts[resources[id].id]; | ||
break; | ||
case "whitepaper": | ||
content = whitepapers[resources[id].id]; | ||
break; | ||
default: | ||
content = resources[id]; | ||
break; | ||
} | ||
return content | ||
} | ||
componentDidMount() { | ||
this.getPosts(); | ||
} | ||
render() { | ||
const self = this; | ||
return ( | ||
<section id={this.props.id} className={this.props.enableBackers ? 'backers-section' : 'backers-section without-backers'}> | ||
{this.props.enableBackers && <div className={'container'}> | ||
<h2 className={'with-decor mb-4'}>{content.backersSection.title}</h2> | ||
<div className={'subtitle mb-5'}>{content.backersSection.subtitle}</div> | ||
const blogPosts = []; | ||
for (const [key, value] of Object.entries(responseJson.posts)) { | ||
blogPosts.push({ category: "blog", title: value.title, text: value.text, image: value.feature_image, url: value.url }); | ||
} | ||
this.setState({ posts: blogPosts }); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
} | ||
getContent(id) { | ||
var content = ""; | ||
switch (resources[id].category) { | ||
case "blog": | ||
content = this.state.posts[resources[id].id]; | ||
break; | ||
case "video": | ||
content = videos[resources[id].id]; | ||
break; | ||
case "podcast": | ||
content = podcasts[resources[id].id]; | ||
break; | ||
case "whitepaper": | ||
content = whitepapers[resources[id].id]; | ||
break; | ||
default: | ||
content = resources[id]; | ||
break; | ||
} | ||
return content; | ||
} | ||
componentDidMount() { | ||
this.getPosts(); | ||
} | ||
render() { | ||
const self = this; | ||
return ( | ||
<section id={this.props.id} className={this.props.enableBackers ? "backers-section" : "backers-section without-backers"}> | ||
{this.props.enableBackers && ( | ||
<div className={"container"}> | ||
<h2 className={"with-decor mb-4"}>{content.backersSection.title}</h2> | ||
<div className={"subtitle mb-5"}>{content.backersSection.subtitle}</div> | ||
|
||
<div className={'carousel-inner'}> | ||
<Carousel className={'py-0'} responsive={responsive} swipable={true} draggable={false} infinite={true} autoPlay={false} containerClass={'multi-carousel'} customTransition={'1000ms all cubic-bezier(0.65, 0, 0.35, 1)'} arrows={false} renderButtonGroupOutside={true} customButtonGroup={<ButtonGroup />}> | ||
{ self.props.backers && self.props.backers.map(function(backer,index){ | ||
if(index %2 === 0){ | ||
const next = index + 1; | ||
if(next < self.props.backers.length){ | ||
return <div><Backer key={index} data={backer}/><Backer key={next} data={self.props.backers[next]}/></div> | ||
}else{ | ||
if(index <= self.props.backers.length){ | ||
return <div><Backer key={index} data={backer}/></div> | ||
} | ||
} | ||
} | ||
})} | ||
{ self.props.backers && self.props.backers.map(function(backer,index){ | ||
if(index %2 === 0){ | ||
const next = index + 1; | ||
if(next < self.props.backers.length){ | ||
return <div><Backer key={index} data={backer}/><Backer key={next} data={self.props.backers[next]}/></div> | ||
}else{ | ||
if(index <= self.props.backers.length){ | ||
return <div><Backer key={index} data={backer}/></div> | ||
} | ||
} | ||
} | ||
})} | ||
</Carousel> | ||
</div> | ||
</div>} | ||
<div className={"carousel-inner"}> | ||
<Carousel | ||
className={"py-0"} | ||
responsive={responsive} | ||
swipable={true} | ||
draggable={false} | ||
infinite={true} | ||
autoPlay={false} | ||
containerClass={"multi-carousel"} | ||
customTransition={"1000ms all cubic-bezier(0.65, 0, 0.35, 1)"} | ||
arrows={false} | ||
renderButtonGroupOutside={true} | ||
customButtonGroup={<ButtonGroup />} | ||
> | ||
{self.props.backers && | ||
self.props.backers.map(function (backer, index) { | ||
if (index % 2 === 0) { | ||
const next = index + 1; | ||
if (next < self.props.backers.length) { | ||
return ( | ||
<div> | ||
<Backer key={index} data={backer} /> | ||
<Backer key={next} data={self.props.backers[next]} /> | ||
</div> | ||
); | ||
} else { | ||
if (index <= self.props.backers.length) { | ||
return ( | ||
<div> | ||
<Backer key={index} data={backer} /> | ||
</div> | ||
); | ||
} | ||
} | ||
} | ||
})} | ||
{self.props.backers && | ||
self.props.backers.map(function (backer, index) { | ||
if (index % 2 === 0) { | ||
const next = index + 1; | ||
if (next < self.props.backers.length) { | ||
return ( | ||
<div> | ||
<Backer key={index} data={backer} /> | ||
<Backer key={next} data={self.props.backers[next]} /> | ||
</div> | ||
); | ||
} else { | ||
if (index <= self.props.backers.length) { | ||
return ( | ||
<div> | ||
<Backer key={index} data={backer} /> | ||
</div> | ||
); | ||
} | ||
} | ||
} | ||
})} | ||
</Carousel> | ||
</div> | ||
</div> | ||
)} | ||
|
||
<div className={'container pt-5 mt-5'}> | ||
<h2 className={'with-decor black'}>Blog</h2> | ||
<div className={"container"}> | ||
<h2 className={"with-decor black"}>Blog</h2> | ||
|
||
<div className={'row pt-lg-5'}> | ||
<div className={'row py-lg-5'}> | ||
<div className={'col col-12 col-lg-7 pe-xl-5 pt-5'}> | ||
<Resource type={'big'} data={this.getContent(0)}/> | ||
</div> | ||
<div className={'col col-12 col-lg-5 ps-3 ps-xl-3 pt-5 mt-n4'}> | ||
<div className={'row'}> | ||
<div className={'col-12 col-md-6 col-lg-12'}> | ||
<Resource type={'text'} data={this.getContent(1)}/> | ||
</div> | ||
<div className={'col-12 col-md-6 col-lg-12'}> | ||
<Resource type={'text'} data={this.getContent(2)}/> | ||
</div> | ||
<div className={'col-12 col-md-6 col-lg-12'}> | ||
<Resource type={'text'} data={this.getContent(3)}/> | ||
</div> | ||
<div className={'col-12 col-md-6 col-lg-12'}> | ||
<Resource type={'text'} class={'no-border'} data={this.getContent(4)}/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<div className={"row"}> | ||
<div className={"col col-12 col-lg-7 pe-xl-5 pt-5"}> | ||
<Resource type={"big"} data={this.getContent(0)} /> | ||
</div> | ||
<div className={"col col-12 col-lg-5 ps-3 ps-xl-3 pt-5 mt-n4"}> | ||
<div className={"row"}> | ||
<div className={"col-12 col-md-6 col-lg-12"}> | ||
<Resource type={"text"} data={this.getContent(1)} /> | ||
</div> | ||
<div className={"col-12 col-md-6 col-lg-12"}> | ||
<Resource type={"text"} data={this.getContent(2)} /> | ||
</div> | ||
<div className={"col-12 col-md-6 col-lg-12"}> | ||
<Resource type={"text"} data={this.getContent(3)} /> | ||
</div> | ||
<div className={"col-12 col-md-6 col-lg-12"}> | ||
<Resource type={"text"} class={"no-border"} data={this.getContent(4)} /> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div className={'row justify-content-end'}> | ||
<div className={'col-auto'}> | ||
<Button type={'external'} class={'external'} text={'View blog'} url={'https://blog.celestia.org'}/> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
) | ||
} | ||
<div className={"row justify-content-end"}> | ||
<div className={"col-auto"}> | ||
<Button type={"external"} class={"external"} text={"View blog"} url={"https://blog.celestia.org"} /> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export const advantages = [ | ||
{ | ||
id: '1', | ||
title: 'Easy', | ||
text: 'Deploy your own blockchain in minutes, as easily as a smart contract', | ||
image: 'advantages/advantage-1.png', | ||
},{ | ||
id: '2', | ||
title: 'Scale', | ||
text: 'Access the dynamic scaling unlocked by <a href="https://celestia.org/glossary/data-availability-sampling/">data availability sampling</a>, where scale increases with the number of users', | ||
image: 'advantages/advantage-2.png', | ||
},{ | ||
id: '3', | ||
title: 'Customize', | ||
text: 'Create applications using your favorite VM or define your own', | ||
image: 'advantages/advantage-3.png', | ||
},{ | ||
id: '4', | ||
title: 'Sovereign', | ||
text: 'Build <a href="https://celestia.org/glossary/sovereign-rollup/">sovereign rollups</a>, a new type of self-governing blockchain with minimal platform risk', | ||
image: 'advantages/advantage-4.png', | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const backers = [] |
Oops, something went wrong.