WizdomWeb/resources/views/partials/hero.php

44 lines
1.7 KiB
PHP

<?php
/**
* Modular Hero Partial
*
* This component is reusable and configurable for different pages.
*
* Usage:
* - Define `$heroConfig` as an array before rendering this partial.
* - Example:
* $heroConfig = [
* 'title' => 'Our Services',
* 'description' => 'Explore our IT consulting solutions.',
* 'image' => '/assets/images/services-hero.jpg',
* 'cta' => ['text' => 'Get Started', 'link' => '/contact'],
* 'style' => 'default', // Can be 'default', 'compact', 'overlay'
* 'position' => 'top' // Can be 'top', 'inline'
* ];
*/
// Ensure heroConfig is defined before rendering
$heroConfig = $heroConfig ?? [];
// Assign default values
$heroTitle = $heroConfig['title'] ?? "Welcome to Wizdom Networks";
$heroDescription = $heroConfig['description'] ?? "Your trusted partner for IT Consulting and Services.";
$heroImage = $heroConfig['image'] ?? "/assets/images/default-hero.jpg";
$heroCTA = $heroConfig['cta'] ?? null;
$heroStyle = $heroConfig['style'] ?? "default"; // 'default', 'compact', 'overlay'
$heroPosition = $heroConfig['position'] ?? "top"; // 'top', 'inline'
?>
<section class="hero-section hero-<?php echo $heroStyle; ?> hero-<?php echo $heroPosition; ?>" style="background-image: url('<?php echo $heroImage; ?>');">
<div class="hero-overlay">
<div class="hero-content text-center">
<h1><?php echo $heroTitle; ?></h1>
<p><?php echo $heroDescription; ?></p>
<?php if ($heroCTA): ?>
<a href="<?php echo $heroCTA['link']; ?>" class="btn btn-primary"><?php echo $heroCTA['text']; ?></a>
<?php endif; ?>
</div>
</div>
</section>