Skip to content

Commit

Permalink
fix: #1467 to add navContainerClass to Navbar and classUl to NavUl
Browse files Browse the repository at this point in the history
  • Loading branch information
shinokada committed Oct 27, 2024
1 parent 2e13923 commit d189933
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/lib/navbar/NavUl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
slideParams?: SlideParams;
activeClass?: string;
nonActiveClass?: string;
classUl?: string;
}
export let activeUrl: NonNullable<$$Props['activeUrl']> = '';
Expand All @@ -31,6 +32,7 @@
export let slideParams: $$Props['slideParams'] = { delay: 250, duration: 500, easing: sineIn };
export let activeClass: NonNullable<$$Props['activeClass']> = 'text-white bg-primary-700 md:bg-transparent md:text-primary-700 md:dark:text-white dark:bg-primary-600 md:dark:bg-transparent';
export let nonActiveClass: NonNullable<$$Props['nonActiveClass']> = 'text-gray-700 hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-primary-700 dark:text-gray-400 md:dark:hover:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent';
export let classUl: $$Props['classUl'] = '';
const activeUrlStore = writable('');
setContext<NavbarLiType>('navbarContext', { activeClass, nonActiveClass });
Expand All @@ -47,11 +49,7 @@
$: _divClass = twMerge(divClass, $$props.class);
let _ulClass: string;
$: _ulClass = twMerge(
ulClass,
// 'divide-y md:divide-y-0 divide-gray-100 dark:divide-gray-700',
$$props.classUl
);
$: _ulClass = twMerge( ulClass, classUl );
</script>

{#if !_hidden}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/navbar/Navbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
export let fluid: $$Props['fluid'] = false;
export let navContainerClass: string= '';
let hidden = writable(true);
setContext('navHidden', hidden);
Expand All @@ -24,7 +25,7 @@
</script>

<Frame tag="nav" {...$$restProps} class={twMerge('px-2 sm:px-4 py-2.5 w-full', $$props.class)}>
<NavContainer {fluid}>
<NavContainer {fluid} class={navContainerClass}>
<slot hidden={$hidden} {toggle} {NavContainer} />
</NavContainer>
</Frame>
Expand Down

0 comments on commit d189933

Please sign in to comment.