mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-28 17:16:16 +01:00
Convert truthy value to true and reintroduce PrimaryContentColumn sizing
Fixes issues that occurred after #224.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user