From 52e0d1f4758bbe42fbbf95d2bd2ca2e167ae3b08 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 7 Jun 2020 17:30:47 -0500 Subject: [PATCH] Support injecting custom CSS, fixes #145 --- app/soapbox/containers/soapbox.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/soapbox/containers/soapbox.js b/app/soapbox/containers/soapbox.js index 38d2cdc2d..473e592ff 100644 --- a/app/soapbox/containers/soapbox.js +++ b/app/soapbox/containers/soapbox.js @@ -3,6 +3,7 @@ import React from 'react'; import { Provider, connect } from 'react-redux'; import PropTypes from 'prop-types'; +import ImmutablePropTypes from 'react-immutable-proptypes'; import SoapboxPropTypes from 'soapbox/utils/soapbox_prop_types'; import Helmet from 'soapbox/components/helmet'; import classNames from 'classnames'; @@ -53,6 +54,7 @@ const mapStateToProps = (state) => { locale: validLocale(locale) ? locale : 'en', themeCss: generateThemeCss(state.getIn(['soapbox', 'brandColor'])), themeMode: settings.get('themeMode'), + customCss: state.getIn(['soapbox', 'customCss']), }; }; @@ -69,6 +71,7 @@ class SoapboxMount extends React.PureComponent { locale: PropTypes.string.isRequired, themeCss: PropTypes.string, themeMode: PropTypes.string, + customCss: ImmutablePropTypes.list, dispatch: PropTypes.func, }; @@ -98,7 +101,7 @@ class SoapboxMount extends React.PureComponent { } render() { - const { me, themeCss, locale } = this.props; + const { me, themeCss, locale, customCss } = this.props; if (me === null) return null; if (this.state.localeLoading) return null; @@ -122,6 +125,9 @@ class SoapboxMount extends React.PureComponent { {themeCss && } + {customCss && customCss.map(css => ( + + ))}