fix(theme-picker): Reformat invalid class names

This commit is contained in:
Jackie Luo 2016-04-05 13:43:36 -07:00
parent 9f4b9693ac
commit 4f11201ff7
2 changed files with 5 additions and 5 deletions

View file

@ -99,7 +99,7 @@ class ThemeOption extends React.Component {
<div className="clickable-theme-option" onMouseDown={this.props.onSelect}> <div className="clickable-theme-option" onMouseDown={this.props.onSelect}>
<EventedIFrame <EventedIFrame
ref="iframe" ref="iframe"
className={`theme-preview-${this.props.theme.name}`} className={`theme-preview-${this.props.theme.name.replace(/\./g, '-')}`}
frameBorder="0" frameBorder="0"
width="115px" width="115px"
height="70px" height="70px"

View file

@ -38,12 +38,12 @@ class ThemePicker extends React.Component {
} }
_rewriteIFrame(prevActiveTheme, activeTheme) { _rewriteIFrame(prevActiveTheme, activeTheme) {
const prevActiveThemeDoc = document.querySelector(`.theme-preview-${prevActiveTheme}`).contentDocument; const prevActiveThemeDoc = document.querySelector(`.theme-preview-${prevActiveTheme.replace(/\./g, '-')}`).contentDocument;
const prevActiveElement = prevActiveThemeDoc.querySelector(".theme-option.active-true"); const prevActiveElement = prevActiveThemeDoc.querySelector(".theme-option.active-true");
prevActiveElement.className = "theme-option active-false"; if (prevActiveElement) prevActiveElement.className = "theme-option active-false";
const activeThemeDoc = document.querySelector(`.theme-preview-${activeTheme}`).contentDocument; const activeThemeDoc = document.querySelector(`.theme-preview-${activeTheme.replace(/\./g, '-')}`).contentDocument;
const activeElement = activeThemeDoc.querySelector(".theme-option.active-false"); const activeElement = activeThemeDoc.querySelector(".theme-option.active-false");
activeElement.className = "theme-option active-true"; if (activeElement) activeElement.className = "theme-option active-true";
} }
_renderThemeOptions() { _renderThemeOptions() {