mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-06 20:30:52 +01:00
Constant navigation width independent of content
Fixes issues that occurred after #224. Pushed-by: Florian Scholdei<florian.scholdei@cloudogu.com> Co-authored-by: Florian Scholdei<florian.scholdei@cloudogu.com>
This commit is contained in:
@@ -23,13 +23,26 @@
|
||||
*/
|
||||
import React, { FC } from "react";
|
||||
import styled from "styled-components";
|
||||
import { useSecondaryNavigation } from "../useSecondaryNavigation";
|
||||
|
||||
const SecondaryColumn = styled.div`
|
||||
const SecondaryColumn = styled.div<{ collapsed: boolean }>`
|
||||
flex: 0 0 auto;
|
||||
/* Navigation width should be as constant as possible. */
|
||||
width: ${(props: { collapsed: boolean }) => (props.collapsed ? "5.5rem" : "16rem")};
|
||||
/* Render this column to full size if column construct breaks (page size too small). */
|
||||
@media (max-width: 785px) {
|
||||
width: 100%;
|
||||
}
|
||||
`;
|
||||
|
||||
const SecondaryNavigationColumn: FC = ({ children }) => {
|
||||
return <SecondaryColumn className="column">{children}</SecondaryColumn>;
|
||||
const { collapsed } = useSecondaryNavigation();
|
||||
|
||||
return (
|
||||
<SecondaryColumn className="column" collapsed={collapsed}>
|
||||
{children}
|
||||
</SecondaryColumn>
|
||||
);
|
||||
};
|
||||
|
||||
export default SecondaryNavigationColumn;
|
||||
|
||||
Reference in New Issue
Block a user