mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-29 09:36:10 +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.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
import React, { FC } from "react";
|
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 }) => {
|
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;
|
export default PrimaryContentColumn;
|
||||||
|
|||||||
@@ -35,15 +35,16 @@ const useActiveMatch = ({ to, activeOnlyWhenExact, activeWhenMatch }: RoutingPro
|
|||||||
|
|
||||||
const match = useRouteMatch({
|
const match = useRouteMatch({
|
||||||
path: urls.escapeUrlForRoute(path),
|
path: urls.escapeUrlForRoute(path),
|
||||||
exact: activeOnlyWhenExact
|
exact: activeOnlyWhenExact,
|
||||||
});
|
});
|
||||||
|
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
|
||||||
const isActiveWhenMatch = () => {
|
const isActiveWhenMatch = () => {
|
||||||
if (activeWhenMatch) {
|
if (activeWhenMatch) {
|
||||||
return activeWhenMatch({
|
// noinspection PointlessBooleanExpressionJS could be a truthy value if a function is passed in
|
||||||
location
|
return !!activeWhenMatch({
|
||||||
|
location,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user