@patternfly/react-core#ApplicationLauncher JavaScript Examples

The following examples show how to use @patternfly/react-core#ApplicationLauncher. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Launcher.js    From operate-first.github.io-old with GNU General Public License v3.0 5 votes vote down vote up
Launcher = () => {
  const [isOpen, setIsOpen] = useState(false);
  const {
    site: {
      siteMetadata: { clusters },
    },
  } = useStaticQuery(
    graphql`
      query {
        site {
          siteMetadata {
            clusters {
              name
              clusters {
                name
                url
              }
            }
          }
        }
      }
    `
  );

  return (
    <ApplicationLauncher
      onSelect={() => setIsOpen(!isOpen)}
      onToggle={(v) => setIsOpen(v)}
      position={DropdownPosition.right}
      isOpen={isOpen}
      items={clusters.map((group) => (
        <ApplicationLauncherGroup label={group.name} key={group.name}>
          {group.clusters.map((cluster) => (
            <ApplicationLauncherItem
              key={cluster.name}
              isExternal
              href={cluster.url}
              icon={<OpenshiftIcon color="red" />}
            >
              {cluster.name} - Red Hat OpenShift Console
            </ApplicationLauncherItem>
          ))}
        </ApplicationLauncherGroup>
      ))}
      isGrouped
    />
  );
}