1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-11-29 13:58:02 +03:00

Fix overview mode

This commit is contained in:
Brent Jackson 2019-03-09 12:32:10 -05:00
parent c48a4400d4
commit c9ce31086f
2 changed files with 15 additions and 4 deletions

View File

@ -1,11 +1,23 @@
import React from 'react'
import { Link } from '@reach/router'
import { Location, Link } from '@reach/router'
import Zoom from './Zoom'
import Slide from './Slide'
const noop = () => {}
export const Overview = props => {
const getIndex = ({ pathname }) => {
return Number(pathname.split('/')[1] || 0)
}
const withLocation = Component => props => (
<Location
children={({ location }) => (
<Component {...props} location={location} index={getIndex(location)} />
)}
/>
)
export const Overview = withLocation(props => {
const { index, slides } = props
return (
@ -63,6 +75,6 @@ export const Overview = props => {
</div>
</div>
)
}
})
export default Overview

View File

@ -4,7 +4,6 @@ import Box from './Box'
const Split = ({ children }) => {
const [a, ...rest] = React.Children.toArray(children)
console.log(children, a, rest)
return (
<Flex
css={{