diff --git a/app/soapbox/components/ui/column/column.tsx b/app/soapbox/components/ui/column/column.tsx index a9c5f0d2e1..08ef17b9a3 100644 --- a/app/soapbox/components/ui/column/column.tsx +++ b/app/soapbox/components/ui/column/column.tsx @@ -1,10 +1,11 @@ import React from 'react'; +import { RouteComponentProps, withRouter } from 'react-router-dom'; import Helmet from 'soapbox/components/helmet'; import { Card, CardBody, CardHeader, CardTitle } from '../card/card'; -interface IColumn { +interface IColumn extends RouteComponentProps { backHref?: string, label?: string, transparent?: boolean, @@ -12,7 +13,20 @@ interface IColumn { } const Column: React.FC = React.forwardRef((props, ref: React.ForwardedRef): JSX.Element => { - const { backHref, children, label, transparent = false, withHeader = true } = props; + const { backHref, children, label, history, transparent = false, withHeader = true } = props; + + const handleBackClick = () => { + if (backHref) { + history.push(backHref); + return; + } + + if (history.length === 1) { + history.push('/'); + } else { + history.goBack(); + } + }; const renderChildren = () => { if (transparent) { @@ -22,7 +36,7 @@ const Column: React.FC = React.forwardRef((props, ref: React.ForwardedR return ( {withHeader ? ( - + ) : null} @@ -43,4 +57,4 @@ const Column: React.FC = React.forwardRef((props, ref: React.ForwardedR ); }); -export default Column; +export default withRouter(Column); diff --git a/app/soapbox/features/edit_profile/index.js b/app/soapbox/features/edit_profile/index.js index 4939bd13e0..008711462c 100644 Binary files a/app/soapbox/features/edit_profile/index.js and b/app/soapbox/features/edit_profile/index.js differ