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:
parent
c48a4400d4
commit
c9ce31086f
@ -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
|
||||
|
@ -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={{
|
||||
|
Loading…
Reference in New Issue
Block a user