sforkowany z mirror/soapbox
Make promo panel items localizable
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>datepicker-css
rodzic
58f3107151
commit
81af1bb274
|
@ -1,22 +1,26 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import Icon from 'soapbox/components/icon';
|
||||
import { connect } from 'react-redux';
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
promoItems: getSoapboxConfig(state).getIn(['promoPanel', 'items']),
|
||||
locale: getSettings(state).get('locale'),
|
||||
});
|
||||
|
||||
export default @connect(mapStateToProps)
|
||||
class PromoPanel extends React.PureComponent {
|
||||
|
||||
static propTypes = {
|
||||
locale: PropTypes.string,
|
||||
promoItems: ImmutablePropTypes.list,
|
||||
}
|
||||
|
||||
render() {
|
||||
const { promoItems } = this.props;
|
||||
const { locale, promoItems } = this.props;
|
||||
if (!promoItems) return null;
|
||||
|
||||
return (
|
||||
|
@ -25,7 +29,7 @@ class PromoPanel extends React.PureComponent {
|
|||
{promoItems.map((item, i) =>
|
||||
(<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')}
|
||||
{item.getIn(['textLocales', locale]) || item.get('text')}
|
||||
</a>),
|
||||
)}
|
||||
</div>
|
||||
|
|
Ładowanie…
Reference in New Issue