From 7288481b87220512fcaf977d95ea1dcacb90c825 Mon Sep 17 00:00:00 2001 From: Matt Lantz Date: Tue, 5 Sep 2023 20:36:44 -0400 Subject: [PATCH] because of an optional backdrop --- src/Components/Offcanvas.php | 4 ++++ src/Tags/OffCanvas.php | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Components/Offcanvas.php b/src/Components/Offcanvas.php index bfde9bc..397a74c 100644 --- a/src/Components/Offcanvas.php +++ b/src/Components/Offcanvas.php @@ -11,6 +11,7 @@ class Offcanvas extends HtmlComponent public $cssClass; public $id; public $position; + public $backdrop; /** * Create a new component instance. @@ -21,11 +22,13 @@ public function __construct( $title = null, $cssClass = null, $id = null, + $backdrop = 'true', $position = 'end' ) { $this->title = $title; $this->cssClass = $cssClass; $this->position = $position; + $this->backdrop = $backdrop; $this->id = $id; } @@ -41,6 +44,7 @@ public function render() ->css($this->cssClass) ->id($this->id) ->position($this->position) + ->backdrop($this->backdrop) ->render(); } } diff --git a/src/Tags/OffCanvas.php b/src/Tags/OffCanvas.php index 8ad895f..9f025d5 100644 --- a/src/Tags/OffCanvas.php +++ b/src/Tags/OffCanvas.php @@ -8,6 +8,8 @@ class OffCanvas extends HtmlComponent { public static $position; + public static $backdrop; + public static function position($position) { self::$position = $position; @@ -15,16 +17,24 @@ public static function position($position) return new static(); } + public static function backdrop($backdrop) + { + self::$backdrop = $backdrop; + + return new static(); + } + public static function process() { $css = self::$css ?? ''; $text = self::$text ?? ''; $position = self::$position ?? 'end'; + $backdrop = self::$backdrop ?? 'true'; $id = self::$id ?? 'html_component_offcanvas_' . Str::uuid(); self::$html = << +
{$text}