Pull promoPanel items dynamically

This commit is contained in:
Alex Gleason 2020-04-11 17:50:42 -05:00
parent d2c5b8cd3a
commit f24bd74a38
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
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>
)}

View file

@ -1,5 +1,16 @@
{
"logo": "https://media.gleasonator.com/site_uploads/files/000/000/002/original/logo.svg",
"promoPanel": {
"items": [{
"icon": "area-chart",
"text": "Our Site stats",
"url": "https://fediverse.network/example.com"
}, {
"icon": "comment-o",
"text": "Our Site blog",
"url": "https://blog.example.com"
}]
},
"extensions": {
"patron": false
}