diff --git a/CHANGELOG.md b/CHANGELOG.md index b757a9d93..f97faa4fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unreleased +- Allow for `props.fontSize` to override the theme's monospace font size in `CodePane`. [#875](https://github.com/FormidableLabs/spectacle/pull/875) - Surface `textDecoration` prop from styled-system for `Link`s. [#869](https://github.com/FormidableLabs/spectacle/pull/869) ## 6.0.1 diff --git a/src/components/code-pane.js b/src/components/code-pane.js index a95fbc06b..7a266b1e2 100644 --- a/src/components/code-pane.js +++ b/src/components/code-pane.js @@ -39,6 +39,10 @@ export default function CodePane(props) { }, [themeContext]); const fontSize = React.useMemo(() => { + if (props && props.fontSize) { + return props.fontSize; + } + if ( themeContext && themeContext.fontSizes && @@ -46,7 +50,9 @@ export default function CodePane(props) { ) { return themeContext.fontSizes.monospace; } - return props.fontSize; + + // Default to 15px + return 15; }, [themeContext, props.fontSize]); const preStyles = React.useMemo( @@ -159,7 +165,6 @@ CodePane.propTypes = { CodePane.defaultProps = { language: 'javascript', theme: theme, - fontSize: 15, highlightStart: -Infinity, highlightEnd: Infinity };