Make home footer navlinks customizable #108

merge-requests/26/merge
Alex Gleason 4 years ago
parent a9eb5c1765
commit 575a8889c1
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7

@ -1,22 +1,39 @@
import React from 'react'; import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import ImmutablePureComponent from 'react-immutable-pure-component'; import ImmutablePureComponent from 'react-immutable-pure-component';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { List as ImmutableList } from 'immutable';
export default class Footer extends ImmutablePureComponent { const mapStateToProps = (state, props) => ({
copyright: state.getIn(['soapbox', 'copyright']),
navlinks: state.getIn(['soapbox', 'navlinks', 'homeFooter'], ImmutableList()),
});
export default @connect(mapStateToProps)
class Footer extends ImmutablePureComponent {
static propTypes = {
copyright: PropTypes.string,
navlinks: ImmutablePropTypes.list,
}
render() { render() {
const { copyright, navlinks } = this.props;
return ( return (
<div className='footer'> <div className='footer'>
<div className='footer-container'> <div className='footer-container'>
<div className='copyright'> <div className='copyright'>
<span>{new Date().getFullYear()}. Copying is an act of love. Please copy and share.</span> <span>{copyright}</span>
</div> </div>
<ul> <ul>
<li><Link to='/about'>About</Link></li> {navlinks.map((link, i) => (
<li><Link to='/about/tos'>Terms of Service</Link></li> <li key={i}>
<li><Link to='/about/privacy'>Privacy Policy</Link></li> <Link to={link.get('url')}>{link.get('title')}</Link>
<li><Link to='/about/dmca'>DMCA</Link></li> </li>
<li><Link to='/about#opensource'>Source Code</Link></li> ))}
</ul> </ul>
</div> </div>
</div> </div>

@ -16,6 +16,16 @@
}, },
"defaultSettings": { "defaultSettings": {
"autoPlayGif": false, "autoPlayGif": false,
"theme": "lime" "theme": "azure"
},
"copyright": "♡2020. Copying is an act of love. Please copy and share.",
"navlinks": {
"homeFooter": [
{ "title": "About", "url": "/about" },
{ "title": "Terms of Service", "url": "/about/tos" },
{ "title": "Privacy Policy", "url": "/about/privacy" },
{ "title": "DMCA", "url": "/about/dmca" },
{ "title": "Source Code", "url": "/about#opensource" }
]
} }
} }

Loading…
Cancel
Save