diff --git a/packages/components/src/AspectRatioSlide.js b/packages/components/src/AspectRatioSlide.js index 2a7c71d..a5378e3 100644 --- a/packages/components/src/AspectRatioSlide.js +++ b/packages/components/src/AspectRatioSlide.js @@ -1,4 +1,4 @@ -import React, { useContext } from 'react' +import React from 'react' import styled from '@emotion/styled' import FluidFontSize from './FluidFontSize' import useTheme from './useTheme' diff --git a/packages/components/src/Embed.js b/packages/components/src/Embed.js index 3b8bb57..650ef36 100644 --- a/packages/components/src/Embed.js +++ b/packages/components/src/Embed.js @@ -21,41 +21,61 @@ import { jsx } from '@emotion/core' import Provider from './Provider' import Slide from './Slide' import GoogleFonts from './GoogleFonts' -import Ratio from './Ratio' import splitSlides from './splitSlides' +// fix for regression in gatsby-theme +import merge from 'lodash.merge' +import defaultTheme from '@mdx-deck/themes/base' + const Placeholder = ({ index }) => (
not found: slide {index}
) +// fix for regression in gatsby-theme +const mergeThemes = themes => + themes.reduce( + (acc, theme) => + typeof theme === 'function' ? theme(acc) : merge(acc, theme), + {} + ) + const wrapper = props => { - const { slides, theme, themes, ratio, zoom } = splitSlides(props) + const { slides, theme: baseTheme, themes, ratio, zoom } = splitSlides(props) + // fix for regression in gatsby-theme + const theme = mergeThemes([ + defaultTheme, + baseTheme, + ...themes, + { + aspectRatio: ratio, + }, + ]) const Content = slides[props.slide - 1] || Placeholder return ( - + - - - - - + + + ) } -export const Embed = ({ src: Deck, slide = 1, ratio = 9 / 16, zoom = 1 }) => ( - +export const Embed = ({ + src: Deck, + slide = 1, + ratio = 16 / 9, + zoom = 1, + ...props +}) => ( + ) export default Embed diff --git a/packages/components/src/MDXDeck.js b/packages/components/src/MDXDeck.js index 89827b2..8f97207 100644 --- a/packages/components/src/MDXDeck.js +++ b/packages/components/src/MDXDeck.js @@ -1,7 +1,6 @@ -import React, { useContext, useReducer, useMemo } from 'react' +import React, { useContext, useReducer } from 'react' import PropTypes from 'prop-types' import { Router, globalHistory, navigate } from '@reach/router' -import { Global } from '@emotion/core' import { Swipeable } from 'react-swipeable' import merge from 'lodash.merge' import defaultTheme from '@mdx-deck/themes/base' @@ -97,7 +96,6 @@ export const MDXDeck = props => { return Grid default: return BaseWrapper - break } } diff --git a/packages/components/src/Notes.js b/packages/components/src/Notes.js index c278d4c..d5a83f9 100644 --- a/packages/components/src/Notes.js +++ b/packages/components/src/Notes.js @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react' +import { useEffect } from 'react' import { useDeck } from './context' export const Notes = props => { diff --git a/packages/components/src/Presenter.js b/packages/components/src/Presenter.js index eca4fb9..aa7a860 100644 --- a/packages/components/src/Presenter.js +++ b/packages/components/src/Presenter.js @@ -7,7 +7,6 @@ import Clock from './Clock' export const Presenter = props => { const { slides, metadata, index } = props - const Current = slides[index] const Next = slides[index + 1] const { notes } = metadata[index] || {} diff --git a/packages/components/src/Steps.js b/packages/components/src/Steps.js index 75c9012..1228e39 100644 --- a/packages/components/src/Steps.js +++ b/packages/components/src/Steps.js @@ -1,5 +1,3 @@ -import React from 'react' -import { useDeck } from './context' import useSteps from './useSteps' export const Steps = props => { diff --git a/packages/components/src/splitSlides.js b/packages/components/src/splitSlides.js index 3d80e41..285abee 100644 --- a/packages/components/src/splitSlides.js +++ b/packages/components/src/splitSlides.js @@ -1,6 +1,7 @@ import React from 'react' export const splitSlides = props => { + console.log('splitSlides', props) const { theme, themes } = props const arr = React.Children.toArray(props.children) const splits = []