How to use the @uifabric/example-app-base/lib/index2.getPageFirstPlatform function in @uifabric/example-app-base

To help you get started, we’ve selected a few @uifabric/example-app-base examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
public componentDidUpdate(prevProps: ISiteProps, prevState: ISiteState): void {
    if (prevState.pagePath !== this.state.pagePath) {
      this._jumpToAnchor(extractAnchorLink(location.hash));
    }

    const { activePages, pagePlatforms } = this.state;
    const { siteDefinition } = this.props;

    // If current page doesn't have pages for the active platform, switch to its first platform.
    if (Object.keys(pagePlatforms).length > 0 && activePages.length === 0) {
      const firstPlatform = getPageFirstPlatform(getSiteArea(siteDefinition.pages), siteDefinition);
      this._onPlatformChanged(firstPlatform);
    }
  }
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
} catch (ex) {
        // ignore
      }

      // Set active platform for each top level page to local storage platform or the first platform defined for that page.
      topLevelPages.forEach(item => {
        activePlatforms[item] = activePlatforms[item] || getPageFirstPlatform(item, siteDefinition);
      });
    }

    const navData = this._getNavData(activePlatforms);
    let platform = 'default' as TPlatforms;

    // If current page doesn't have pages for the active platform, switch to its first platform.
    if (Object.keys(navData.pagePlatforms).length > 0 && navData.activePages.length === 0) {
      const firstPlatform = getPageFirstPlatform(getSiteArea(siteDefinition.pages), siteDefinition);
      const currentPage = getSiteArea(siteDefinition.pages);
      platform = firstPlatform;
      activePlatforms = {
        ...activePlatforms,
        [currentPage]: firstPlatform
      };
    }

    this.state = {
      activePlatforms,
      platform,
      ...navData
    };
  }
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
topLevelPages.forEach(item => {
        activePlatforms[item] = activePlatforms[item] || getPageFirstPlatform(item, siteDefinition);
      });
    }