Files
CWC/header.php
T
Keith Solomon c82e6187af
Deploy to Dreamhost (dev) / build (push) Successful in 33s
Sync TODOs with Issues / sync_todos (push) Successful in 6s
feature: Add independent chrome tint elements for iOS 26+ compatibility and enhance related tests
2026-07-12 14:30:41 -05:00

83 lines
2.9 KiB
PHP

<?php
/**
* Theme header template
*
* @package CWC
* @since 1.0.0
*/
namespace CWC;
global $views;
$headerLogo = getFieldValue( 'header.header_logo.url' ) ? getFieldValue( 'header.header_logo.url' ) : get_theme_file_uri( '/static/img/logo.svg' );
// Check conditions for displaying the hero section.
// The inner-page hero renders only on the Services page, its direct children,
// and its grandchildren. All other views (blog index, archives, single posts,
// search, 404) render without the hero.
$services = get_page_by_path( 'services' )->ID;
$showHero = $post->post_parent === $services ? true : false;
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<!-- Status bar tint (top, behind notch/Dynamic Island). Updated at runtime
by static/js/modules/ChromeTint.js based on which element is in view. -->
<meta name="theme-color" content="#032F46">
<?php wp_head(); ?>
</head>
<body <?php echo body_class(); ?>>
<a class="skip-link" href="#maincontent">
<?php echo esc_html__( 'Skip to main content' ); ?>
</a>
<?php
/*
* Chrome tint elements.
*
* iOS 26+ Safari ignores the <meta name="theme-color"> tag and
* instead samples the background-color of fixed/sticky elements
* near the top and bottom of the viewport to tint the browser
* chrome (status bar / home indicator). Their backgroundColor is
* updated at runtime by static/js/modules/ChromeTint.js based on
* which element (site-header or site-footer) is in view.
*
* Sampling windows (iOS 26):
* - top: within 4px of top, width >=80%, min-height 12px
* - bottom: within 3px of bottom, width >=80%, min-height 3px
*
* aria-hidden because these are visual-only and carry no meaning.
*/
?>
<div class="chrome-tint chrome-tint--top" aria-hidden="true"></div>
<div class="chrome-tint chrome-tint--bottom" aria-hidden="true"></div>
<header role="banner" class="site-header bg-secondary flex flex-col items-center justify-start">
<?php get_template_part( 'views/components/nav-aux' ); ?>
<div class="header__nav-main container px-0! py-4 items-center grid gap-x-8 gap-y-0 grid-cols-[437px_auto] grid-rows-[1fr] justify-between">
<a href="<?php bloginfo( 'url' ); ?>" class="site-header__logo block">
<img class="h-full w-auto" src="<?php echo esc_url( $headerLogo ); ?>" alt="<?php bloginfo( 'name' ); ?> logo"/>
</a>
<?php get_template_part( 'views/components/nav-main' ); ?>
</div>
</header>
<main id="maincontent" class="overflow-hidden min-h-[78dvh]">
<?php
if ( $showHero ) :
get_template_part( 'views/partials/page-hero-services' );
elseif ( ! is_front_page() && ! is_page( 'contact' ) ) :
get_template_part( 'views/partials/page-hero' );
endif;
?>