bigbuffet-rw/app/soapbox/features/ui/components/promo_panel.js

38 lines
1 KiB
JavaScript
Raw Normal View History

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-04-11 15:50:42 -07:00
const mapStateToProps = state => ({
promoItems: state.getIn(['soapbox', '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-04-14 11:44:40 -07:00
(<div className='promo-panel-item' key={i}>
2020-04-11 15:50:42 -07:00
<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')}
2020-03-27 13:59:38 -07:00
</a>
2020-04-14 11:44:40 -07:00
</div>)
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
}