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..7fdb63e 100644 --- a/packages/components/src/Embed.js +++ b/packages/components/src/Embed.js @@ -21,41 +21,65 @@ 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, + Slide: { + maxWidth: '100%', + height: 'auto', + }, + }, + ]) const Content = slides[props.slide - 1] || Placeholder return ( -