How to use the @uifabric/example-app-base/lib/index2.getSiteArea 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 / pages / HomePage / HomePage.base.tsx View on Github external
private _onInternalLinkClick = (ev: React.MouseEvent<{}> | React.KeyboardEvent<{}>, url: string): void => {
    trackEvent(EventNames.ClickedInternalLink, {
      topic: url, // @TODO: Remove topic when data is stale.
      currentArea: getSiteArea(),
      nextArea: getSiteArea(undefined, url),
      nextPage: url,
      currentPage: window.location.hash
    });
  };
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / pages / HomePage / HomePage.base.tsx View on Github external
private _onInternalLinkClick = (ev: React.MouseEvent<{}> | React.KeyboardEvent<{}>, url: string): void => {
    trackEvent(EventNames.ClickedInternalLink, {
      topic: url, // @TODO: Remove topic when data is stale.
      currentArea: getSiteArea(),
      nextArea: getSiteArea(undefined, url),
      nextPage: url,
      currentPage: window.location.hash
    });
  };
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
// 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
private _onPlatformChanged = (platformKey: TPlatforms): void => {
    const { siteDefinition } = this.props;
    if (platformKey !== this.state.platform) {
      trackEvent(EventNames.ChangedPlatform, {
        topic: getSiteArea(siteDefinition.pages), // @TODO: Remove topic when data is stale.
        currentArea: getSiteArea(siteDefinition.pages),
        platform: platformKey, // @TODO: Remove platform when data is stale.
        currentPlatform: this.state.platform,
        nextPlatform: platformKey
      });

      const { activePlatforms } = this.state;
      const currentPage = getSiteArea(siteDefinition.pages);

      this.setState(
        {
          platform: platformKey,
          activePlatforms: {
            ...activePlatforms,
            [currentPage]: platformKey
          }
        },
        this._setActivePlatforms
      );
    }
  };
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
private _onLeftNavLinkClick = (ev: React.MouseEvent) => {
    const { platform } = this.state;
    const { siteDefinition } = this.props;
    const target = ev.currentTarget as HTMLAnchorElement;
    trackEvent(EventNames.ClickedLeftNavLink, {
      // Use the dom element's title or innerText as the topic.
      topic: target.title || target.innerText, // @TODO: Remove topic when data is stale.
      currentArea: getSiteArea(siteDefinition.pages),
      nextArea: getSiteArea(siteDefinition.pages, target.hash || target.href),
      nextPage: target.hash || target.href,
      currentPage: window.location.hash,
      platform: platform === 'default' ? 'None' : platform, // @TODO: Remove platform when data is stale.
      currentPlatform: platform === 'default' ? 'None' : platform // Pages that don't have a platform will say 'none'
    });
  };
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
private _onLeftNavSearchBoxClick = (ev: React.MouseEvent) => {
    const { platform } = this.state;
    const { siteDefinition } = this.props;
    trackEvent(EventNames.ClickedSearchFilter, {
      // Use the dom element's title or innerText as the topic.
      topic: getSiteArea(siteDefinition.pages), // @TODO: Remove topic when data is stale.
      currentArea: getSiteArea(siteDefinition.pages),
      platform: platform === 'default' ? 'None' : platform, // @TODO: Remove platform when data is stale.
      currentPlatform: platform === 'default' ? 'None' : platform // Pages that don't have a platform will say 'none'
    });
  };
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
private _onTopNavLinkClick = (ev: React.MouseEvent) => {
    const { platform } = this.state;
    const { siteDefinition } = this.props;
    const target = ev.currentTarget as HTMLAnchorElement;
    trackEvent(EventNames.ClickedTopNavLink, {
      // Use the dom element's title or innerText as the topic.
      topic: target.title || target.innerText, // @TODO: Remove topic when data is stale.
      currentArea: getSiteArea(siteDefinition.pages),
      nextArea: getSiteArea(siteDefinition.pages, target.hash || target.href),
      nextPage: target.hash || target.href,
      currentPage: window.location.hash,
      platform: platform === 'default' ? 'None' : platform, // @TODO: Remove platform when data is stale.
      currentPlatform: platform === 'default' ? 'None' : platform // Pages that don't have a platform will say 'none'
    });
  };
github OfficeDev / office-ui-fabric-react / apps / fabric-website / src / components / Site / Site.tsx View on Github external
private _getPlatform = (activePlatforms: ISiteState['activePlatforms'] = this.state.activePlatforms): TPlatforms => {
    const currentPage = getSiteArea(this.props.siteDefinition.pages);

    if (activePlatforms && activePlatforms[currentPage]) {
      return activePlatforms[currentPage];
    }

    return 'default' as TPlatforms;
  };