From 575a8889c1ce7edd74e7538d7cacd46fdab5462b Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 28 May 2020 13:44:44 -0500 Subject: [PATCH] Make home footer navlinks customizable #108 --- .../public_layout/components/footer.js | 31 ++++++++++++++----- static/instance/soapbox.example.json | 12 ++++++- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/app/gabsocial/features/public_layout/components/footer.js b/app/gabsocial/features/public_layout/components/footer.js index e8e7cf781..e7a071b19 100644 --- a/app/gabsocial/features/public_layout/components/footer.js +++ b/app/gabsocial/features/public_layout/components/footer.js @@ -1,22 +1,39 @@ 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 { 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() { + const { copyright, navlinks } = this.props; + return (
- ♡{new Date().getFullYear()}. Copying is an act of love. Please copy and share. + {copyright}
    -
  • About
  • -
  • Terms of Service
  • -
  • Privacy Policy
  • -
  • DMCA
  • -
  • Source Code
  • + {navlinks.map((link, i) => ( +
  • + {link.get('title')} +
  • + ))}
diff --git a/static/instance/soapbox.example.json b/static/instance/soapbox.example.json index 37e431194..8fae384ce 100644 --- a/static/instance/soapbox.example.json +++ b/static/instance/soapbox.example.json @@ -16,6 +16,16 @@ }, "defaultSettings": { "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" } + ] } }