2020-03-27 13:59:38 -07:00
|
|
|
import React from 'react';
|
2020-04-14 14:37:17 -07:00
|
|
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
2020-05-28 15:52:07 -07:00
|
|
|
import Icon from 'soapbox/components/icon';
|
2020-03-27 13:59:38 -07:00
|
|
|
import { connect } from 'react-redux';
|
2020-08-23 13:56:18 -07:00
|
|
|
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
2020-03-27 13:59:38 -07:00
|
|
|
|
2020-04-11 15:50:42 -07:00
|
|
|
const mapStateToProps = state => ({
|
2020-08-23 13:56:18 -07:00
|
|
|
promoItems: getSoapboxConfig(state).getIn(['promoPanel', 'items']),
|
2020-04-14 11:44:40 -07:00
|
|
|
});
|
2020-04-11 15:50:42 -07:00
|
|
|
|
|
|
|
export default @connect(mapStateToProps)
|
2020-03-27 13:59:38 -07:00
|
|
|
class PromoPanel extends React.PureComponent {
|
|
|
|
|
2020-04-14 14:37:17 -07:00
|
|
|
static propTypes = {
|
|
|
|
promoItems: ImmutablePropTypes.list,
|
|
|
|
}
|
|
|
|
|
2020-03-27 13:59:38 -07:00
|
|
|
render() {
|
2020-04-11 15:50:42 -07:00
|
|
|
const { promoItems } = this.props;
|
2020-03-27 13:59:38 -07:00
|
|
|
if (!promoItems) return null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className='wtf-panel promo-panel'>
|
|
|
|
<div className='promo-panel__container'>
|
|
|
|
{promoItems.map((item, i) =>
|
2020-11-10 16:22:02 -08:00
|
|
|
(<a className='promo-panel-item' href={item.get('url')} target='_blank' key={i}>
|
|
|
|
<Icon id={item.get('icon')} className='promo-panel-item__icon' fixedWidth />
|
|
|
|
{item.get('text')}
|
|
|
|
</a>),
|
2020-03-27 13:59:38 -07:00
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-04-14 11:44:40 -07:00
|
|
|
);
|
2020-03-27 13:59:38 -07:00
|
|
|
}
|
2020-04-14 11:44:40 -07:00
|
|
|
|
2020-03-27 13:59:38 -07:00
|
|
|
}
|