Pull promoPanel items dynamically
This commit is contained in:
parent
d2c5b8cd3a
commit
f24bd74a38
2 changed files with 20 additions and 5 deletions
|
@ -4,12 +4,16 @@ import { FormattedMessage } from 'react-intl';
|
||||||
import Icon from 'gabsocial/components/icon';
|
import Icon from 'gabsocial/components/icon';
|
||||||
import ProBadge from 'gabsocial/components/pro_badge';
|
import ProBadge from 'gabsocial/components/pro_badge';
|
||||||
import { connect } from 'react-redux';
|
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 {
|
class PromoPanel extends React.PureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { promoItems } = this.props;
|
||||||
if (!promoItems) return null;
|
if (!promoItems) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -17,9 +21,9 @@ class PromoPanel extends React.PureComponent {
|
||||||
<div className='promo-panel__container'>
|
<div className='promo-panel__container'>
|
||||||
{promoItems.map((item, i) =>
|
{promoItems.map((item, i) =>
|
||||||
<div className='promo-panel-item' key={i}>
|
<div className='promo-panel-item' key={i}>
|
||||||
<a className='promo-panel-item__btn' href={item.url} target='_blank'>
|
<a className='promo-panel-item__btn' href={item.get('url')} target='_blank'>
|
||||||
<Icon id={item.icon} className='promo-panel-item__icon' fixedWidth />
|
<Icon id={item.get('icon')} className='promo-panel-item__icon' fixedWidth />
|
||||||
{item.text}
|
{item.get('text')}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
{
|
{
|
||||||
"logo": "https://media.gleasonator.com/site_uploads/files/000/000/002/original/logo.svg",
|
"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": {
|
"extensions": {
|
||||||
"patron": false
|
"patron": false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue