Allow to change FontIcon for Tab by passing it into the factory (#1439)
parent
27caadb182
commit
d6bdf2008e
|
@ -2,11 +2,11 @@ import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { themr } from 'react-css-themr';
|
import { themr } from 'react-css-themr';
|
||||||
import { FontIcon } from '../font_icon';
|
|
||||||
import { TABS } from '../identifiers';
|
import { TABS } from '../identifiers';
|
||||||
import rippleFactory from '../ripple/Ripple';
|
import rippleFactory from '../ripple/Ripple';
|
||||||
|
import InjectFontIcon from '../font_icon/FontIcon';
|
||||||
|
|
||||||
const factory = (ripple) => {
|
const factory = (ripple, FontIcon) => {
|
||||||
class Tab extends Component {
|
class Tab extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
active: PropTypes.bool,
|
active: PropTypes.bool,
|
||||||
|
@ -77,7 +77,7 @@ const factory = (ripple) => {
|
||||||
return ripple(Tab);
|
return ripple(Tab);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Tab = factory(rippleFactory({ centered: false }));
|
const Tab = factory(rippleFactory({ centered: false }), InjectFontIcon);
|
||||||
export default themr(TABS)(Tab);
|
export default themr(TABS)(Tab);
|
||||||
export { factory as tabFactory };
|
export { factory as tabFactory };
|
||||||
export { Tab };
|
export { Tab };
|
||||||
|
|
|
@ -9,7 +9,7 @@ import theme from './theme.css';
|
||||||
|
|
||||||
const applyTheme = Component => themr(TABS, theme)(Component);
|
const applyTheme = Component => themr(TABS, theme)(Component);
|
||||||
const ThemedTabContent = applyTheme(TabContent);
|
const ThemedTabContent = applyTheme(TabContent);
|
||||||
const ThemedTab = applyTheme(tabFactory(themedRippleFactory({ centered: false })));
|
const ThemedTab = applyTheme(tabFactory(themedRippleFactory({ centered: false }), FontIcon));
|
||||||
const ThemedTabs = applyTheme(tabsFactory(ThemedTab, ThemedTabContent, FontIcon));
|
const ThemedTabs = applyTheme(tabsFactory(ThemedTab, ThemedTabContent, FontIcon));
|
||||||
|
|
||||||
export { ThemedTab as Tab };
|
export { ThemedTab as Tab };
|
||||||
|
|
Loading…
Reference in New Issue