Convert truthy value to true and reintroduce PrimaryContentColumn sizing

Fixes issues that occurred after #224.
This commit is contained in:
Florian Scholdei
2023-12-14 09:01:48 +01:00
parent 0fc89d8e4f
commit 75695f9fb1
2 changed files with 21 additions and 4 deletions

View File

@@ -22,9 +22,25 @@
* SOFTWARE.
*/
import React, { FC } from "react";
import styled from "styled-components";
import { useSecondaryNavigation } from "../useSecondaryNavigation";
const PrimaryColumn = styled.div<{ collapsed: boolean }>`
width: ${(props: { collapsed: boolean }) => (props.collapsed ? "89.7%" : "75%")};
/* Render this column to full size if column construct breaks (page size too small). */
@media (max-width: 785px) {
width: 100%;
}
`;
const PrimaryContentColumn: FC = ({ children }) => {
return <div className="column is-10">{children}</div>;
const { collapsed } = useSecondaryNavigation();
return (
<PrimaryColumn className="column" collapsed={collapsed}>
{children}
</PrimaryColumn>
);
};
export default PrimaryContentColumn;

View File

@@ -35,15 +35,16 @@ const useActiveMatch = ({ to, activeOnlyWhenExact, activeWhenMatch }: RoutingPro
const match = useRouteMatch({
path: urls.escapeUrlForRoute(path),
exact: activeOnlyWhenExact
exact: activeOnlyWhenExact,
});
const location = useLocation();
const isActiveWhenMatch = () => {
if (activeWhenMatch) {
return activeWhenMatch({
location
// noinspection PointlessBooleanExpressionJS could be a truthy value if a function is passed in
return !!activeWhenMatch({
location,
});
}
return false;