Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds next components and storyblok service
- Loading branch information
1 parent
b607bad
commit 3cb8df7
Showing
22 changed files
with
598 additions
and
103 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
root = true | ||
|
||
[**/*] | ||
indent_style = space | ||
indent_size = 2 |
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,3 @@ | ||
!/.next | ||
!/build | ||
!/dist |
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,36 @@ | ||
import Components from './index' | ||
import SbEditable from 'storyblok-react' | ||
import React from 'react' | ||
|
||
export default class extends React.Component { | ||
resizedIcon(index) { | ||
if (typeof this.props.content.icon !== 'undefined') { | ||
return '//img2.storyblok.com/80x80' + this.props.content.icon.replace('//a.storyblok.com', '') | ||
} | ||
return null | ||
} | ||
|
||
render() { | ||
return ( | ||
<SbEditable content={this.props.content}> | ||
<div className="feature util__flex-eq"> | ||
<img src={this.resizedIcon()} className="feature__icon" /> | ||
<h2>{this.props.content.name}</h2> | ||
<div className="feature__description"> | ||
{this.props.content.description} | ||
</div> | ||
<style jsx>{` | ||
.feature { | ||
text-align: center; | ||
padding: 30px 10px 100px; | ||
} | ||
.feature__icon { | ||
max-width: 80px; | ||
} | ||
`}</style> | ||
</div> | ||
</SbEditable> | ||
) | ||
} | ||
} |
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,14 @@ | ||
export default (props) => ( | ||
<div className="footer"> | ||
<div className="util__container"> | ||
My Next.js website | ||
</div> | ||
<style jsx>{` | ||
.footer { | ||
background: #e3f2ed; | ||
padding: 40px 0 120px 0; | ||
text-align: center; | ||
} | ||
`}</style> | ||
</div> | ||
) |
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,12 @@ | ||
import Components from './index' | ||
import SbEditable from 'storyblok-react' | ||
|
||
export default (props) => ( | ||
<SbEditable content="props.content"> | ||
<div className="util__flex"> | ||
{props.content.columns.map((blok) => | ||
Components(blok) | ||
)} | ||
</div> | ||
</SbEditable> | ||
) |
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,60 @@ | ||
import Head from '../components/Head' | ||
import Nav from '../components/Nav' | ||
import Footer from '../components/Footer' | ||
|
||
export default ({ children, settings = {} }) => ( | ||
<div> | ||
<Head /> | ||
<Nav settings={settings} /> | ||
<div className="util__container"> | ||
{children} | ||
</div> | ||
<Footer /> | ||
|
||
<style jsx global>{` | ||
article, aside, footer, header, hgroup, main, nav, section { | ||
display: block; | ||
} | ||
body { | ||
font-family: 'Zilla Slab', Helvetica, sans-serif; | ||
line-height: 1; | ||
font-size: 18px; | ||
color: #000; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
.util__flex { | ||
display: flex; | ||
} | ||
.util__flex-col { | ||
flex: 0 0 auto; | ||
} | ||
.util__flex-eq { | ||
flex: 1; | ||
} | ||
.util__container { | ||
max-width: 75rem; | ||
margin-left: auto; | ||
margin-right: auto; | ||
padding-left: 20px; | ||
padding-right: 20px; | ||
box-sizing: border-box; | ||
} | ||
#nprogress .bar { | ||
background: #29d; | ||
position: fixed; | ||
z-index: 1031; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 2px; | ||
} | ||
`}</style> | ||
</div> | ||
) |
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,3 @@ | ||
export default (props) => ( | ||
<div>The component {props.content.component} has not been created yet.</div> | ||
) |
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,14 @@ | ||
import SbEditable from 'storyblok-react' | ||
|
||
export default (props) => ( | ||
<SbEditable content={props.content}> | ||
<div className="slide"> | ||
<img src={props.content.image} /> | ||
<style jsx>{` | ||
.slide img { | ||
width: 100%; | ||
} | ||
`}</style> | ||
</div> | ||
</SbEditable> | ||
) |
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,72 @@ | ||
import Components from './index' | ||
import SbEditable from 'storyblok-react' | ||
import React from 'react' | ||
|
||
export default class extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = {currentSlide: 0} | ||
} | ||
|
||
slide() { | ||
let slides = this.props.content.body.filter((slide, index) => { | ||
return this.state.currentSlide === index | ||
}) | ||
if (slides.length) { | ||
return slides[0] | ||
} | ||
return null | ||
} | ||
|
||
pagClass(index) { | ||
return 'teaser__pag-dot ' + (index == this.state.currentSlide ? 'teaser__pag-dot--current' : '') | ||
} | ||
|
||
handleDotClick(index) { | ||
this.setState({ | ||
currentSlide: index | ||
}) | ||
} | ||
|
||
render() { | ||
return ( | ||
<SbEditable content={this.props.content}> | ||
<div className="teaser"> | ||
{this.slide() ? Components(this.slide()) : ''} | ||
|
||
<div className="teaser__pag"> | ||
{this.props.content.body.map((blok, index) => | ||
<button key={index} onClick={() => this.handleDotClick(index)} | ||
className={this.pagClass(index)}>Next</button> | ||
)} | ||
</div> | ||
|
||
<style jsx>{` | ||
.teaser__pag { | ||
width: 100%; | ||
text-align: center; | ||
margin: 30px 0; | ||
} | ||
.teaser__pag-dot { | ||
text-indent: -9999px; | ||
border: 0; | ||
border-radius: 50%; | ||
width: 17px; | ||
height: 17px; | ||
padding: 0; | ||
margin: 5px 6px; | ||
background-color: #ccc; | ||
-webkit-appearance: none; | ||
cursor: pointer; | ||
} | ||
.teaser__pag-dot--current { | ||
background-color: #000; | ||
} | ||
`}</style> | ||
</div> | ||
</SbEditable> | ||
) | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import React from 'react' | ||
import NotFound from './NotFound' | ||
import Teaser from './Teaser' | ||
import Feature from './Feature' | ||
import Slide from './Slide' | ||
import Grid from './Grid' | ||
|
||
const Components = { | ||
'teaser': Teaser, | ||
'feature': Feature, | ||
'slide': Slide, | ||
'grid': Grid | ||
} | ||
|
||
export default (blok) => { | ||
if (typeof Components[blok.component] !== 'undefined') { | ||
return React.createElement(Components[blok.component], {key: blok._uid, content: blok}) | ||
} | ||
return React.createElement(NotFound, {key: blok._uid, content: blok}) | ||
} |
Oops, something went wrong.