Pull promoPanel items dynamically
This commit is contained in:
@ -4,12 +4,16 @@ import { FormattedMessage } from 'react-intl';
|
||||
import Icon from 'gabsocial/components/icon';
|
||||
import ProBadge from 'gabsocial/components/pro_badge';
|
||||
import { connect } from 'react-redux';
|
||||
import { promoItems } from '../../../initial_state';
|
||||
|
||||
export default
|
||||
const mapStateToProps = state => ({
|
||||
promoItems: state.getIn(['soapbox', 'promoPanel', 'items']),
|
||||
})
|
||||
|
||||
export default @connect(mapStateToProps)
|
||||
class PromoPanel extends React.PureComponent {
|
||||
|
||||
render() {
|
||||
const { promoItems } = this.props;
|
||||
if (!promoItems) return null;
|
||||
|
||||
return (
|
||||
@ -17,9 +21,9 @@ class PromoPanel extends React.PureComponent {
|
||||
<div className='promo-panel__container'>
|
||||
{promoItems.map((item, i) =>
|
||||
<div className='promo-panel-item' key={i}>
|
||||
<a className='promo-panel-item__btn' href={item.url} target='_blank'>
|
||||
<Icon id={item.icon} className='promo-panel-item__icon' fixedWidth />
|
||||
{item.text}
|
||||
<a className='promo-panel-item__btn' href={item.get('url')} target='_blank'>
|
||||
<Icon id={item.get('icon')} className='promo-panel-item__icon' fixedWidth />
|
||||
{item.get('text')}
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user