Skip to content

Commit

Permalink
[Enterprise Search] Add flag to restrict with of layout
Browse files Browse the repository at this point in the history
This PR adds a boolean flag to restrict the width of the Enterprise Search layout file for use in Workplace Search.
  • Loading branch information
scottybollinger committed Sep 15, 2020
1 parent 93e37af commit 9990627
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ import './layout.scss';

interface ILayoutProps {
navigation: React.ReactNode;
restrictWidth?: boolean;
}

export interface INavContext {
closeNavigation(): void;
}
export const NavContext = React.createContext({});

export const Layout: React.FC<ILayoutProps> = ({ children, navigation }) => {
export const Layout: React.FC<ILayoutProps> = ({ children, navigation, restrictWidth }) => {
const [isNavOpen, setIsNavOpen] = useState(false);
const toggleNavigation = () => setIsNavOpen(!isNavOpen);
const closeNavigation = () => setIsNavOpen(false);
Expand Down Expand Up @@ -54,7 +55,9 @@ export const Layout: React.FC<ILayoutProps> = ({ children, navigation }) => {
</div>
<NavContext.Provider value={{ closeNavigation }}>{navigation}</NavContext.Provider>
</EuiPageSideBar>
<EuiPageBody className="enterpriseSearchLayout__body">{children}</EuiPageBody>
<EuiPageBody className="enterpriseSearchLayout__body" restrictWidth={restrictWidth}>
{children}
</EuiPageBody>
</EuiPage>
);
};

0 comments on commit 9990627

Please sign in to comment.