@redneckz/wildless-cms-uni-blocks 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,7 +40,7 @@ export const Carousel: JSXBlock<CarouselProps> = JSX<CarouselProps>(
40
40
  isCyclic,
41
41
  });
42
42
 
43
- const isBankHistoryCarousel = childBlocks && childBlocks[0].type === 'CarouselBankHistoryCard';
43
+ const isBankHistoryCarousel = childBlocks && childBlocks[0]?.type === 'CarouselBankHistoryCard';
44
44
 
45
45
  return (
46
46
  <BlockWrapper className={style(getPaddingStyle(isPadding), className)} {...rest}>
@@ -86,7 +86,7 @@ Carousel.childrenTypes = [
86
86
  ];
87
87
 
88
88
  const buildBlocks = (blocks?: BlockDef[], activeIndex?: number) => {
89
- return blocks && blocks[0].type === 'CarouselBankHistoryCard'
89
+ return blocks && blocks[0]?.type === 'CarouselBankHistoryCard'
90
90
  ? blocks.map((_, i) => {
91
91
  return {
92
92
  ..._,
@@ -1,7 +1,15 @@
1
1
  import type { Router } from '../../hooks/useRouter';
2
+ import { projectSettings } from '../../ProjectSettings';
2
3
  import { isURL, withoutQuery } from '../../utils/url';
3
4
 
4
5
  export const isHrefActive =
5
6
  (router: Router) =>
6
- ({ href }: { href?: string }): boolean =>
7
- withoutQuery(isURL(href) ? router.href : router.pathname).startsWith(withoutQuery(href));
7
+ ({ href }: { href?: string }): boolean => {
8
+ const { BASE_PATH } = projectSettings;
9
+ const relativeHref =
10
+ BASE_PATH && href?.startsWith(BASE_PATH) ? href.substring(BASE_PATH.length) : href;
11
+
12
+ return withoutQuery(isURL(href) ? router.href : router.pathname).startsWith(
13
+ withoutQuery(relativeHref),
14
+ );
15
+ };