Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions src/components/code-pane.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,20 @@ export default function CodePane(props) {
}, [themeContext]);

const fontSize = React.useMemo(() => {
if (props && props.fontSize) {
return props.fontSize;
}

if (
themeContext &&
themeContext.fontSizes &&
themeContext.fontSizes.monospace
) {
return themeContext.fontSizes.monospace;
}
return props.fontSize;

// Default to 15px
return 15;
}, [themeContext, props.fontSize]);

const preStyles = React.useMemo(
Expand Down Expand Up @@ -159,7 +165,6 @@ CodePane.propTypes = {
CodePane.defaultProps = {
language: 'javascript',
theme: theme,
fontSize: 15,
highlightStart: -Infinity,
highlightEnd: Infinity
};