Skip to content

Commit

Permalink
refactor(Page): Change the defaultManagedSidebarOpen prop name for co…
Browse files Browse the repository at this point in the history
…nsistency (#2664)

#2662
  • Loading branch information
tlabaj authored and jschuler committed Aug 8, 2019
1 parent 743cfbd commit 364c920
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions packages/patternfly-4/react-core/src/components/Page/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface PageProps extends React.HTMLProps<HTMLDivElement> {
/**
* If true, the managed sidebar is initially open for desktop view
*/
defaultManagedSidebarOpen?: boolean;
defaultManagedSidebarIsOpen?: boolean;
/**
* Can add callback to be notified when resize occurs, for example to set the sidebar isNav prop to false for a width < 768px
* Returns object { mobileView: boolean, windowSize: number }
Expand All @@ -60,16 +60,16 @@ export class Page extends React.Component<PageProps, PageState> {
sidebar: null as React.ReactNode,
skipToContent: null as React.ReactElement,
isManagedSidebar: false,
defaultManagedSidebarOpen: true,
defaultManagedSidebarIsOpen: true,
onPageResize: ():void => null,
mainContainerId: null as string
};

constructor(props: PageProps) {
super(props);

const {isManagedSidebar, defaultManagedSidebarOpen} = props;
const managedSidebarOpen = !isManagedSidebar ? true : defaultManagedSidebarOpen;
const {isManagedSidebar, defaultManagedSidebarIsOpen} = props;
const managedSidebarOpen = !isManagedSidebar ? true : defaultManagedSidebarIsOpen;
this.state = {
desktopIsNavOpen: managedSidebarOpen,
mobileIsNavOpen: false,
Expand Down Expand Up @@ -127,7 +127,7 @@ export class Page extends React.Component<PageProps, PageState> {
skipToContent,
mainContainerId,
isManagedSidebar,
defaultManagedSidebarOpen,
defaultManagedSidebarIsOpen,
onPageResize,
...rest
} = this.props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`Check page horizontal layout example against snapshot 1`] = `
aria-label="Page layout"
breadcrumb={null}
className="my-page-class"
defaultManagedSidebarOpen={true}
defaultManagedSidebarIsOpen={true}
header={
<Unknown
avatar=" | Avatar"
Expand Down Expand Up @@ -126,7 +126,7 @@ exports[`Check page to verify breadcrumb is created 1`] = `
aria-label="Page layout"
breadcrumb={<PageBreadcrumb />}
className="my-page-class"
defaultManagedSidebarOpen={true}
defaultManagedSidebarIsOpen={true}
header={
<Unknown
avatar=" | Avatar"
Expand Down Expand Up @@ -430,7 +430,7 @@ exports[`Check page to verify skip to content points to main content region 1`]
</Unknown>
}
className="my-page-class"
defaultManagedSidebarOpen={true}
defaultManagedSidebarIsOpen={true}
header={
<Unknown
avatar=" | Avatar"
Expand Down Expand Up @@ -732,7 +732,7 @@ exports[`Check page vertical layout example against snapshot 1`] = `
aria-label="Page layout"
breadcrumb={null}
className="my-page-class"
defaultManagedSidebarOpen={true}
defaultManagedSidebarIsOpen={true}
header={
<Unknown
avatar=" | Avatar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class PageManagedSidebarClosedDemo extends React.Component {
const Sidebar = <PageSidebar nav="Navigation" />;

return (
<Page id="page-managed-sidebar-closed-demo" header={Header} sidebar={Sidebar} isManagedSidebar defaultManagedSidebarOpen={false}>
<Page id="page-managed-sidebar-closed-demo" header={Header} sidebar={Sidebar} isManagedSidebar defaultManagedSidebarIsOpen={false}>
<PageSection variant={PageSectionVariants.darker}>Section with darker background</PageSection>
<PageSection variant={PageSectionVariants.dark}>Section with dark background</PageSection>
<PageSection variant={PageSectionVariants.light}>Section with light background</PageSection>
Expand Down

0 comments on commit 364c920

Please sign in to comment.