/** * @license * Copyright (c) 2014, 2026, Oracle and/or its affiliates. * Licensed under The Universal Permissive License (UPL), Version 1.0 * as shown at https://oss.oracle.com/licenses/upl/ * @ignore */ import { h } from "preact"; import { useRef, useState, useEffect } from "preact/hooks"; import * as ResponsiveUtils from "ojs/ojresponsiveutils"; import "ojs/ojtoolbar"; import "ojs/ojmenu"; import "ojs/ojbutton"; type Props = Readonly<{ appName: string, userLogin: string }>; export function Header({ appName, userLogin }: Props) { const mediaQueryRef = useRef(window.matchMedia(ResponsiveUtils.getFrameworkQuery("sm-only")!)); const [isSmallWidth, setIsSmallWidth] = useState(mediaQueryRef.current.matches); useEffect(() => { mediaQueryRef.current.addEventListener("change", handleMediaQueryChange); return (() => mediaQueryRef.current.removeEventListener("change", handleMediaQueryChange)); }, [mediaQueryRef]); function handleMediaQueryChange(e: MediaQueryListEvent) { setIsSmallWidth(e.matches); } function getDisplayType() { return (isSmallWidth ? "icons" : "all"); }; function getEndIconClass() { return (isSmallWidth ? "oj-icon demo-appheader-avatar" : "oj-component-icon oj-button-menu-dropdown-icon"); } return ( ); }