From 2ecd6d79dd432fbbef44becd08cc3de3979d144d Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 12 May 2022 14:53:41 -0400 Subject: [PATCH 1/2] Convert PublicLayout to TSX --- app/soapbox/features/public_layout/index.js | 69 -------------------- app/soapbox/features/public_layout/index.tsx | 58 ++++++++++++++++ 2 files changed, 58 insertions(+), 69 deletions(-) delete mode 100644 app/soapbox/features/public_layout/index.js create mode 100644 app/soapbox/features/public_layout/index.tsx diff --git a/app/soapbox/features/public_layout/index.js b/app/soapbox/features/public_layout/index.js deleted file mode 100644 index a7cb641eb..000000000 --- a/app/soapbox/features/public_layout/index.js +++ /dev/null @@ -1,69 +0,0 @@ -import React from 'react'; -import ImmutablePureComponent from 'react-immutable-pure-component'; -import { connect } from 'react-redux'; -import { Switch, Route, Redirect } from 'react-router-dom'; - -import { getSoapboxConfig } from 'soapbox/actions/soapbox'; -import LandingGradient from 'soapbox/components/landing-gradient'; -import BundleContainer from 'soapbox/features/ui/containers/bundle_container'; -import { - NotificationsContainer, - ModalContainer, -} from 'soapbox/features/ui/util/async-components'; -import { isStandalone } from 'soapbox/utils/state'; - -import AboutPage from '../about'; -import LandingPage from '../landing_page'; -import MobilePage from '../mobile'; - -import Footer from './components/footer'; -import Header from './components/header'; - -const mapStateToProps = (state, props) => ({ - soapbox: getSoapboxConfig(state), - standalone: isStandalone(state), -}); - -class PublicLayout extends ImmutablePureComponent { - - render() { - const { standalone } = this.props; - - if (standalone) { - return ; - } - - return ( -
- - -
-
-
- -
- - - - - -
-
- -
- - - {(Component) => } - - - - {(Component) => } - -
-
- ); - } - -} - -export default connect(mapStateToProps)(PublicLayout); diff --git a/app/soapbox/features/public_layout/index.tsx b/app/soapbox/features/public_layout/index.tsx new file mode 100644 index 000000000..3fe4834a5 --- /dev/null +++ b/app/soapbox/features/public_layout/index.tsx @@ -0,0 +1,58 @@ +import React from 'react'; +import { Switch, Route, Redirect } from 'react-router-dom'; + +import LandingGradient from 'soapbox/components/landing-gradient'; +import BundleContainer from 'soapbox/features/ui/containers/bundle_container'; +import { + NotificationsContainer, + ModalContainer, +} from 'soapbox/features/ui/util/async-components'; +import { useAppSelector } from 'soapbox/hooks'; +import { isStandalone } from 'soapbox/utils/state'; + +import AboutPage from '../about'; +import LandingPage from '../landing_page'; +import MobilePage from '../mobile'; + +import Footer from './components/footer'; +import Header from './components/header'; + +const PublicLayout = () => { + const standalone = useAppSelector((state) => isStandalone(state)); + + if (standalone) { + return ; + } + + return ( +
+ + +
+
+
+ +
+ + + + + +
+
+ +
+ + + {(Component) => } + + + + {(Component) => } + +
+
+ ); +}; + +export default PublicLayout; From 3dce8ee95a43aa5f150f23ca62cca98fcf22d99c Mon Sep 17 00:00:00 2001 From: Justin Date: Thu, 12 May 2022 14:53:53 -0400 Subject: [PATCH 2/2] Pass through props like 'strokeWidth' to SvgIcon --- app/soapbox/components/ui/icon/svg-icon.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/soapbox/components/ui/icon/svg-icon.tsx b/app/soapbox/components/ui/icon/svg-icon.tsx index e5cd6d03f..c651ac903 100644 --- a/app/soapbox/components/ui/icon/svg-icon.tsx +++ b/app/soapbox/components/ui/icon/svg-icon.tsx @@ -13,7 +13,7 @@ interface ISvgIcon { } /** Renders an inline SVG with an empty frame loading state */ -const SvgIcon: React.FC = ({ src, alt, size = 24, className }): JSX.Element => { +const SvgIcon: React.FC = ({ src, alt, size = 24, className, ...filteredProps }): JSX.Element => { const loader = ( = ({ src, alt, size = 24, className }): JSX.El height={size} loader={loader} data-testid='svg-icon' + {...filteredProps} > {/* If the fetch fails, fall back to displaying the loader */} {loader}