diff --git a/resources/views/components/sky-link.blade.php b/resources/views/components/sky-link.blade.php index 43097e6..a80e206 100644 --- a/resources/views/components/sky-link.blade.php +++ b/resources/views/components/sky-link.blade.php @@ -1,3 +1,3 @@ -except('label')->except('hasLabelWrap') }}> +except(['label', 'hasLabelWrap']) }}> {{ $label }} diff --git a/src/Classes/LinkRenderers/NavLinkRenderer.php b/src/Classes/LinkRenderers/NavLinkRenderer.php index aee9e84..5d27ef4 100644 --- a/src/Classes/LinkRenderers/NavLinkRenderer.php +++ b/src/Classes/LinkRenderers/NavLinkRenderer.php @@ -13,10 +13,9 @@ public function __construct( ) { } - // TODO: something to control these classes for end-user? public static string $activeClasses = 'border-b border-b-secondary-500 text-secondary-500'; - public static string $defaultActiveClass = 'border-transparent'; + public static string $nonActiveClasses = 'border-transparent'; abstract public function getModel(): ?Model; @@ -28,7 +27,7 @@ public function getActiveClass(): string { return $this->isActiveRoute() ? self::$activeClasses : - self::$defaultActiveClass; + self::$nonActiveClasses; } /** diff --git a/src/Configuration.php b/src/Configuration.php index 39f545c..b35ad54 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -311,4 +311,26 @@ public function getNavRenderers(): array $this->navRenderers ); } + + /** + * Set the default active CSS class(es) on a nav link. + * @param string $activeClasses + * @return $this + */ + public function setActiveClasses(string $activeClasses): static + { + NavLinkRenderer::$activeClasses = $activeClasses; + return $this; + } + + /** + * Set the default non-active CSS class(es) on a nav link. + * @param string $nonActiveClass + * @return $this + */ + public function setNonActiveClasses(string $nonActiveClass): static + { + NavLinkRenderer::$nonActiveClasses = $nonActiveClass; + return $this; + } }