significantly refactor presentational components

This commit is contained in:
Lachlan Kermode
2019-01-18 11:51:00 +00:00
parent f561064e6c
commit e7cac13fb5
34 changed files with 103 additions and 150 deletions

View File

@@ -0,0 +1,32 @@
import React from 'react'
import Card from './Card'
import Adjust from './Adjust'
import Close from './Close'
export default ({ narrative, methods }) => {
if (!narrative) return null
const { current, steps } = narrative
const prevExists = current !== 0
const nextExists = current < steps.length - 1
return (
<React.Fragment>
<Card narrative={narrative} />
<Adjust
isDisabled={!prevExists}
direction='left'
onClickHandler={methods.onPrev}
/>
<Adjust
isDisabled={!nextExists}
direction='right'
onClickHandler={methods.onNext}
/>
<Close
onClickHandler={() => methods.onSelectNarrative(null)}
closeMsg='-- exit from narrative --'
/>
</React.Fragment>
)
}