Pull promoPanel items dynamically

This commit is contained in:
Alex Gleason
2020-04-11 17:50:42 -05:00
parent d2c5b8cd3a
commit f24bd74a38
2 changed files with 20 additions and 5 deletions

View File

@ -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>
)}