@redneckz/wildless-cms-uni-blocks 0.2.101 → 0.2.103

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.
Files changed (229) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +121 -58
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/dist/components/BlockContent.d.ts +3 -2
  5. package/dist/components/Blocks.d.ts +1 -0
  6. package/dist/components/Blocks.js +2 -0
  7. package/dist/components/Blocks.js.map +1 -1
  8. package/dist/components/Footer/FooterContent.d.ts +1 -1
  9. package/dist/components/Footer/Sitemap.d.ts +1 -1
  10. package/dist/components/Footer/Sitemap.js +2 -2
  11. package/dist/components/Footer/Sitemap.js.map +1 -1
  12. package/dist/components/Header/Header.js +13 -9
  13. package/dist/components/Header/Header.js.map +1 -1
  14. package/dist/components/Header/HeaderContent.d.ts +8 -1
  15. package/dist/components/Header/HeaderSecondaryMenu.d.ts +2 -1
  16. package/dist/components/Header/HeaderSecondaryMenu.js +14 -2
  17. package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  18. package/dist/components/Header/HeaderSecondaryMenuButton.js +1 -1
  19. package/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  20. package/dist/components/Headline/HeadlineContent.d.ts +2 -9
  21. package/dist/components/MobileBlocks.d.ts +1 -0
  22. package/dist/components/MobileBlocks.js +2 -0
  23. package/dist/components/MobileBlocks.js.map +1 -1
  24. package/dist/components/Navigation/Navigation.d.ts +5 -0
  25. package/dist/components/Navigation/Navigation.js +16 -0
  26. package/dist/components/Navigation/Navigation.js.map +1 -0
  27. package/dist/components/Navigation/NavigationContent.d.ts +10 -0
  28. package/dist/components/Navigation/NavigationContent.js +2 -0
  29. package/dist/components/Navigation/NavigationContent.js.map +1 -0
  30. package/dist/components/Navigation/NavigationItem.d.ts +4 -0
  31. package/dist/components/Navigation/NavigationItem.js +6 -0
  32. package/dist/components/Navigation/NavigationItem.js.map +1 -0
  33. package/dist/hooks/useLink.js +2 -1
  34. package/dist/hooks/useLink.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/model/BgColorVersion.d.ts +8 -0
  38. package/dist/model/BgColorVersion.js +2 -0
  39. package/dist/model/BgColorVersion.js.map +1 -0
  40. package/dist/services/sitemap/SitemapProps.d.ts +13 -0
  41. package/dist/services/sitemap/SitemapProps.js +2 -0
  42. package/dist/services/sitemap/SitemapProps.js.map +1 -0
  43. package/dist/services/sitemap/findActiveSubItem.d.ts +3 -0
  44. package/dist/services/sitemap/findActiveSubItem.js +13 -0
  45. package/dist/services/sitemap/findActiveSubItem.js.map +1 -0
  46. package/dist/services/sitemap/isHrefActive.d.ts +4 -0
  47. package/dist/services/sitemap/isHrefActive.js +9 -0
  48. package/dist/services/sitemap/isHrefActive.js.map +1 -0
  49. package/dist/services/sitemap/isSubItemActive.d.ts +3 -0
  50. package/dist/services/sitemap/isSubItemActive.js +6 -0
  51. package/dist/services/sitemap/isSubItemActive.js.map +1 -0
  52. package/dist/services/sitemap/isTopItemActive.d.ts +3 -0
  53. package/dist/services/sitemap/isTopItemActive.js +7 -0
  54. package/dist/services/sitemap/isTopItemActive.js.map +1 -0
  55. package/dist/services/sitemap/mergeTopItems.d.ts +2 -0
  56. package/dist/{mergeTopItems.js → services/sitemap/mergeTopItems.js} +1 -3
  57. package/dist/services/sitemap/mergeTopItems.js.map +1 -0
  58. package/dist/services/sitemap/useSitemap.d.ts +3 -0
  59. package/dist/{hooks → services/sitemap}/useSitemap.js +1 -1
  60. package/dist/services/sitemap/useSitemap.js.map +1 -0
  61. package/dist/ui-kit/HeaderItem/HeaderItem.js +16 -4
  62. package/dist/ui-kit/HeaderItem/HeaderItem.js.map +1 -1
  63. package/dist/ui-kit/Icon/IconProps.d.ts +39 -37
  64. package/dist/ui-kit/Icon/IconProps.js +37 -36
  65. package/dist/ui-kit/Icon/IconProps.js.map +1 -1
  66. package/dist/ui-kit/Logo/Logo.d.ts +1 -0
  67. package/dist/ui-kit/Logo/Logo.js +10 -2
  68. package/dist/ui-kit/Logo/Logo.js.map +1 -1
  69. package/dist/ui-kit/TopItem/TopItem.d.ts +2 -0
  70. package/dist/ui-kit/TopItem/TopItem.js +19 -7
  71. package/dist/ui-kit/TopItem/TopItem.js.map +1 -1
  72. package/dist/utils/adjustHref.d.ts +4 -0
  73. package/dist/utils/adjustHref.js +21 -0
  74. package/dist/utils/adjustHref.js.map +1 -0
  75. package/dist/utils/maxBy.d.ts +2 -0
  76. package/dist/utils/maxBy.js +7 -0
  77. package/dist/utils/maxBy.js.map +1 -0
  78. package/dist/utils/url.d.ts +0 -13
  79. package/dist/utils/url.js +2 -26
  80. package/dist/utils/url.js.map +1 -1
  81. package/dist/utils/withoutMobilePath.d.ts +2 -0
  82. package/dist/utils/withoutMobilePath.js +6 -0
  83. package/dist/utils/withoutMobilePath.js.map +1 -0
  84. package/lib/common.css +1 -1
  85. package/lib/components/BlockContent.d.ts +3 -2
  86. package/lib/components/Blocks.d.ts +1 -0
  87. package/lib/components/Blocks.js +2 -0
  88. package/lib/components/Blocks.js.map +1 -1
  89. package/lib/components/Footer/FooterContent.d.ts +1 -1
  90. package/lib/components/Footer/Sitemap.d.ts +1 -1
  91. package/lib/components/Footer/Sitemap.js +2 -2
  92. package/lib/components/Footer/Sitemap.js.map +1 -1
  93. package/lib/components/Header/Header.fixture.d.ts +4 -1
  94. package/lib/components/Header/Header.js +13 -9
  95. package/lib/components/Header/Header.js.map +1 -1
  96. package/lib/components/Header/HeaderContent.d.ts +8 -1
  97. package/lib/components/Header/HeaderSecondaryMenu.d.ts +2 -1
  98. package/lib/components/Header/HeaderSecondaryMenu.js +14 -2
  99. package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  100. package/lib/components/Header/HeaderSecondaryMenuButton.js +1 -1
  101. package/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  102. package/lib/components/Headline/HeadlineContent.d.ts +2 -9
  103. package/lib/components/MobileBlocks.d.ts +1 -0
  104. package/lib/components/MobileBlocks.js +2 -0
  105. package/lib/components/MobileBlocks.js.map +1 -1
  106. package/lib/components/Navigation/Navigation.d.ts +5 -0
  107. package/lib/components/Navigation/Navigation.fixture.d.ts +2 -0
  108. package/lib/components/Navigation/Navigation.js +14 -0
  109. package/lib/components/Navigation/Navigation.js.map +1 -0
  110. package/lib/components/Navigation/NavigationContent.d.ts +10 -0
  111. package/lib/components/Navigation/NavigationContent.js +2 -0
  112. package/lib/components/Navigation/NavigationContent.js.map +1 -0
  113. package/lib/components/Navigation/NavigationItem.d.ts +4 -0
  114. package/lib/components/Navigation/NavigationItem.js +4 -0
  115. package/lib/components/Navigation/NavigationItem.js.map +1 -0
  116. package/lib/hooks/useLink.js +2 -1
  117. package/lib/hooks/useLink.js.map +1 -1
  118. package/lib/index.d.ts +1 -1
  119. package/lib/index.js.map +1 -1
  120. package/lib/model/BgColorVersion.d.ts +8 -0
  121. package/lib/model/BgColorVersion.js +2 -0
  122. package/lib/model/BgColorVersion.js.map +1 -0
  123. package/lib/services/sitemap/SitemapProps.d.ts +13 -0
  124. package/lib/services/sitemap/SitemapProps.js +2 -0
  125. package/lib/services/sitemap/SitemapProps.js.map +1 -0
  126. package/lib/services/sitemap/findActiveSubItem.d.ts +3 -0
  127. package/lib/services/sitemap/findActiveSubItem.js +10 -0
  128. package/lib/services/sitemap/findActiveSubItem.js.map +1 -0
  129. package/lib/services/sitemap/isHrefActive.d.ts +4 -0
  130. package/lib/services/sitemap/isHrefActive.js +6 -0
  131. package/lib/services/sitemap/isHrefActive.js.map +1 -0
  132. package/lib/services/sitemap/isSubItemActive.d.ts +3 -0
  133. package/lib/services/sitemap/isSubItemActive.js +3 -0
  134. package/lib/services/sitemap/isSubItemActive.js.map +1 -0
  135. package/lib/services/sitemap/isTopItemActive.d.ts +3 -0
  136. package/lib/services/sitemap/isTopItemActive.js +4 -0
  137. package/lib/services/sitemap/isTopItemActive.js.map +1 -0
  138. package/lib/services/sitemap/mergeTopItems.d.ts +2 -0
  139. package/lib/{mergeTopItems.js → services/sitemap/mergeTopItems.js} +1 -3
  140. package/lib/services/sitemap/mergeTopItems.js.map +1 -0
  141. package/lib/services/sitemap/useSitemap.d.ts +3 -0
  142. package/lib/{hooks → services/sitemap}/useSitemap.js +1 -1
  143. package/lib/services/sitemap/useSitemap.js.map +1 -0
  144. package/lib/ui-kit/HeaderItem/HeaderItem.js +16 -4
  145. package/lib/ui-kit/HeaderItem/HeaderItem.js.map +1 -1
  146. package/lib/ui-kit/Icon/IconProps.d.ts +39 -37
  147. package/lib/ui-kit/Icon/IconProps.js +37 -36
  148. package/lib/ui-kit/Icon/IconProps.js.map +1 -1
  149. package/lib/ui-kit/Logo/Logo.d.ts +1 -0
  150. package/lib/ui-kit/Logo/Logo.js +10 -2
  151. package/lib/ui-kit/Logo/Logo.js.map +1 -1
  152. package/lib/ui-kit/TopItem/TopItem.d.ts +2 -0
  153. package/lib/ui-kit/TopItem/TopItem.js +19 -7
  154. package/lib/ui-kit/TopItem/TopItem.js.map +1 -1
  155. package/lib/utils/adjustHref.d.ts +4 -0
  156. package/lib/utils/adjustHref.js +18 -0
  157. package/lib/utils/adjustHref.js.map +1 -0
  158. package/lib/utils/maxBy.d.ts +2 -0
  159. package/lib/utils/maxBy.js +3 -0
  160. package/lib/utils/maxBy.js.map +1 -0
  161. package/lib/utils/url.d.ts +0 -13
  162. package/lib/utils/url.js +1 -21
  163. package/lib/utils/url.js.map +1 -1
  164. package/lib/utils/withoutMobilePath.d.ts +2 -0
  165. package/lib/utils/withoutMobilePath.js +3 -0
  166. package/lib/utils/withoutMobilePath.js.map +1 -0
  167. package/package.json +4 -2
  168. package/src/components/BlockContent.ts +4 -2
  169. package/src/components/Blocks.ts +2 -0
  170. package/src/components/ContentPage/ContentPage.page.json +26 -13
  171. package/src/components/Footer/FooterContent.ts +1 -1
  172. package/src/components/Footer/Sitemap.tsx +4 -3
  173. package/src/components/Header/Header.fixture.tsx +4 -18
  174. package/src/components/Header/Header.tsx +56 -45
  175. package/src/components/Header/HeaderContent.ts +8 -1
  176. package/src/components/Header/HeaderSecondaryMenu.tsx +25 -12
  177. package/src/components/Header/HeaderSecondaryMenuButton.tsx +2 -4
  178. package/src/components/Headline/HeadlineContent.ts +2 -10
  179. package/src/components/MobileBlocks.ts +2 -0
  180. package/src/components/Navigation/Navigation.fixture.tsx +28 -0
  181. package/src/components/Navigation/Navigation.tsx +39 -0
  182. package/src/components/Navigation/NavigationContent.ts +11 -0
  183. package/src/components/Navigation/NavigationItem.tsx +17 -0
  184. package/src/hooks/useLink.ts +2 -1
  185. package/src/icons/GridIcon.svg +1 -1
  186. package/src/icons/GridIconWhite.svg +4 -0
  187. package/src/index.ts +1 -1
  188. package/src/model/BgColorVersion.ts +8 -0
  189. package/src/services/sitemap/SitemapProps.ts +15 -0
  190. package/src/services/sitemap/findActiveSubItem.ts +14 -0
  191. package/src/services/sitemap/isHrefActive.ts +13 -0
  192. package/src/services/sitemap/isSubItemActive.ts +8 -0
  193. package/src/services/sitemap/isTopItemActive.ts +9 -0
  194. package/src/{mergeTopItems.spec.ts → services/sitemap/mergeTopItems.spec.ts} +0 -0
  195. package/src/{mergeTopItems.ts → services/sitemap/mergeTopItems.ts} +3 -4
  196. package/src/{hooks → services/sitemap}/useSitemap.ts +3 -3
  197. package/src/ui-kit/HeaderItem/HeaderItem.tsx +32 -18
  198. package/src/ui-kit/Icon/IconProps.ts +3 -1
  199. package/src/ui-kit/Logo/Logo.tsx +30 -18
  200. package/src/ui-kit/TopItem/TopItem.tsx +46 -19
  201. package/src/utils/adjustHref.spec.ts +25 -0
  202. package/src/utils/adjustHref.ts +24 -0
  203. package/src/utils/maxBy.spec.ts +11 -0
  204. package/src/utils/maxBy.ts +7 -0
  205. package/src/utils/url.spec.ts +1 -37
  206. package/src/utils/url.ts +2 -39
  207. package/src/utils/withoutMobilePath.ts +3 -0
  208. package/dist/components/Header/isSubItemActive.d.ts +0 -3
  209. package/dist/components/Header/isSubItemActive.js +0 -8
  210. package/dist/components/Header/isSubItemActive.js.map +0 -1
  211. package/dist/components/Header/isTopItemActive.d.ts +0 -3
  212. package/dist/components/Header/isTopItemActive.js +0 -8
  213. package/dist/components/Header/isTopItemActive.js.map +0 -1
  214. package/dist/hooks/useSitemap.d.ts +0 -3
  215. package/dist/hooks/useSitemap.js.map +0 -1
  216. package/dist/mergeTopItems.d.ts +0 -2
  217. package/dist/mergeTopItems.js.map +0 -1
  218. package/lib/components/Header/isSubItemActive.d.ts +0 -3
  219. package/lib/components/Header/isSubItemActive.js +0 -5
  220. package/lib/components/Header/isSubItemActive.js.map +0 -1
  221. package/lib/components/Header/isTopItemActive.d.ts +0 -3
  222. package/lib/components/Header/isTopItemActive.js +0 -5
  223. package/lib/components/Header/isTopItemActive.js.map +0 -1
  224. package/lib/hooks/useSitemap.d.ts +0 -3
  225. package/lib/hooks/useSitemap.js.map +0 -1
  226. package/lib/mergeTopItems.d.ts +0 -2
  227. package/lib/mergeTopItems.js.map +0 -1
  228. package/src/components/Header/isSubItemActive.ts +0 -7
  229. package/src/components/Header/isTopItemActive.ts +0 -8
@@ -0,0 +1,15 @@
1
+ import type { LinkProps } from '../../model/LinkProps';
2
+
3
+ /**
4
+ * @title Ссылка
5
+ * @required ["text", "href"]
6
+ */
7
+ export interface TopMenuItem extends LinkProps {
8
+ /** @hidden */
9
+ items?: LinkProps[];
10
+ }
11
+
12
+ export interface SitemapProps {
13
+ /** @title Дополнительное меню */
14
+ topItems?: TopMenuItem[];
15
+ }
@@ -0,0 +1,14 @@
1
+ import type { Router } from '../../components/ContentPage/ContentPageContext';
2
+ import type { LinkProps } from '../../model/LinkProps';
3
+ import { maxBy } from '../../utils/maxBy';
4
+ import { isSubItemActive } from './isSubItemActive';
5
+
6
+ export const findActiveSubItem =
7
+ (router: Router) =>
8
+ <T extends LinkProps>(items: T[] = []): T | null => {
9
+ const possibleActiveSubItems = items?.filter(isSubItemActive(router));
10
+ const activeSubItem = possibleActiveSubItems?.length
11
+ ? maxBy((_: T) => _.href?.length || 0)(possibleActiveSubItems) // More specific item with max length
12
+ : null;
13
+ return activeSubItem;
14
+ };
@@ -0,0 +1,13 @@
1
+ import { isURL, withoutQuery } from '../../utils/url';
2
+ import { withoutMobilePath } from '../../utils/withoutMobilePath';
3
+
4
+ export const isHrefActive = (
5
+ href: string | undefined,
6
+ router: { pathname?: string; href?: string },
7
+ cmp: (href: string, baseHref: string) => boolean = (href, baseHref) => baseHref.startsWith(href),
8
+ ) => {
9
+ return cmp(
10
+ withoutQuery(href),
11
+ withoutMobilePath(withoutQuery(isURL(href) ? router.href : router.pathname)),
12
+ );
13
+ };
@@ -0,0 +1,8 @@
1
+ import type { Router } from '../../components/ContentPage/ContentPageContext';
2
+ import type { LinkProps } from '../../model/LinkProps';
3
+ import { isHrefActive } from './isHrefActive';
4
+
5
+ export const isSubItemActive =
6
+ (router: Router) =>
7
+ (subItem: LinkProps): boolean =>
8
+ isHrefActive(subItem.href, router);
@@ -0,0 +1,9 @@
1
+ import type { Router } from '../../components/ContentPage/ContentPageContext';
2
+ import { isHrefActive } from './isHrefActive';
3
+ import { isSubItemActive } from './isSubItemActive';
4
+ import { TopMenuItem } from './SitemapProps';
5
+
6
+ export const isTopItemActive =
7
+ (router: Router) =>
8
+ (topItem: TopMenuItem): boolean =>
9
+ topItem.items?.some(isSubItemActive(router)) || isHrefActive(topItem.href, router);
@@ -1,4 +1,4 @@
1
- import type { LinkProps } from './model/LinkProps';
1
+ import type { LinkProps } from '../../model/LinkProps';
2
2
 
3
3
  const cmp = (a?: LinkProps) => (b?: LinkProps) => a?.href === b?.href;
4
4
 
@@ -8,6 +8,5 @@ const substitute = <L extends LinkProps>(items?: L[], substitution?: L[]): L[] =
8
8
  const subtract = <L extends LinkProps>(minuend?: L[], subtrahend?: L[]): L[] =>
9
9
  (minuend || []).filter((_) => !subtrahend?.find(cmp(_)));
10
10
 
11
- export function mergeTopItems<L extends LinkProps>(left?: L[], right?: L[]): L[] {
12
- return substitute(left, right).concat(subtract(right, left));
13
- }
11
+ export const mergeTopItems = <L extends LinkProps>(left?: L[], right?: L[]): L[] =>
12
+ substitute(left, right).concat(subtract(right, left));
@@ -1,6 +1,6 @@
1
- import type { AsyncDataHook } from '../components/ContentPage/ContentPageContext';
2
- import type { HeaderContent } from '../components/Header/HeaderContent';
3
- import { projectSettings } from '../ProjectSettings';
1
+ import type { AsyncDataHook } from '../../components/ContentPage/ContentPageContext';
2
+ import type { HeaderContent } from '../../components/Header/HeaderContent';
3
+ import { projectSettings } from '../../ProjectSettings';
4
4
 
5
5
  export function useSitemap(useAsyncData: AsyncDataHook): HeaderContent {
6
6
  const { data } = useAsyncData(sitemapURL(), fetchSitemap);
@@ -1,25 +1,39 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { BgColorVersion } from '../../model/BgColorVersion';
2
3
  import type { TopItemProps } from '../TopItem/TopItem';
3
4
 
4
5
  export type HeaderItemProps = TopItemProps;
5
6
 
7
+ const TEXT_CLASSES = 'font-sans font-normal text-base';
8
+ const BORDER_CLASSES = 'absolute left-0 -bottom-2 w-full h-[2px]';
9
+
6
10
  export const HeaderItem = JSX<HeaderItemProps>(
7
- ({ className, text, href, target, active, onClick, children }) => {
8
- const textStyle = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
9
- return (
10
- <a
11
- className={`relative inline-block bg-transparent text-center no-underline ${
12
- className || ''
13
- }`}
14
- href={href}
15
- target={target}
16
- onClick={onClick}
17
- >
18
- <span className={`font-sans font-normal text-base ${textStyle}`}>{text || children}</span>
19
- {active ? (
20
- <div className="absolute left-0 -bottom-2 w-full h-[2px] bg-primary-main" />
21
- ) : null}
22
- </a>
23
- );
24
- },
11
+ ({ className, text, href, target, active, onClick, children, bgColor = 'bg-white' }) => (
12
+ <a
13
+ className={`relative inline-block bg-transparent text-center no-underline ${className || ''}`}
14
+ href={href}
15
+ target={target}
16
+ onClick={onClick}
17
+ >
18
+ <span className={getTextClasses(bgColor, active)}>{text || children}</span>
19
+ {active ? <div className={getBorderClasses(bgColor, active)} /> : null}
20
+ </a>
21
+ ),
25
22
  );
23
+
24
+ const getTextClasses = (bgColor: BgColorVersion, active?: boolean) => {
25
+ let classes = 'text-white';
26
+ if (bgColor === 'bg-white') {
27
+ classes = active ? 'text-primary-main' : 'text-primary-text hover:text-primary-main';
28
+ }
29
+
30
+ return `${classes} ${TEXT_CLASSES}`;
31
+ };
32
+
33
+ const getBorderClasses = (bgColor: BgColorVersion, active?: boolean) => {
34
+ if (!active) {
35
+ return BORDER_CLASSES;
36
+ }
37
+
38
+ return `${bgColor === 'bg-white' ? bgColor : 'bg-primary-main'} ${BORDER_CLASSES}`;
39
+ };
@@ -29,6 +29,7 @@ export enum IconMap {
29
29
  'GlassIcon',
30
30
  'GlobalIcon',
31
31
  'GridIcon',
32
+ 'GridIconWhite',
32
33
  'InterestGrowthIcon',
33
34
  'InterestIcon',
34
35
  'JCBIcon',
@@ -92,11 +93,12 @@ export enum IconMap {
92
93
  * "Доллар",
93
94
  * "Пустой кошелёк с возвратом",
94
95
  * "Пустой кошелёк",
95
- * "Пустой кошелёк белый",
96
+ * "Пустой кошелёк (белый)",
96
97
  * "Евро",
97
98
  * "Зеркало",
98
99
  * "Глобус",
99
100
  * "Сетка",
101
+ * "Сетка (белая)",
100
102
  * "Диаграмма роста",
101
103
  * "Скидка",
102
104
  * "JCB",
@@ -1,10 +1,12 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { BgColorVersion } from '../../model/BgColorVersion';
2
3
  import { SVG } from '../SVG';
3
4
 
4
5
  export interface LogoProps {
5
6
  className: string;
6
7
  href: string;
7
8
  targetBlank: boolean;
9
+ bgColor?: string;
8
10
  }
9
11
 
10
12
  const LOGO_PATHS = [
@@ -14,22 +16,32 @@ const LOGO_PATHS = [
14
16
  'M14.7 27.83h2.58c.67 0 1.14.14 1.4.4.27.25.4.72.4 1.38v7.4c0 .66-.12 1.12-.4 1.38-.4.41-1.16.41-1.78.41l-.4-.01v3.5l.78.14v-2.88c1.2 0 1.97-.4 2.34-1.22v4.29h.26l.5-.01V29.74c0-.68.13-1.16.4-1.43.25-.27.72-.4 1.37-.4.67 0 1.65-.1 2.16.4.26.27.38.76.38 1.43v3.8h-1.77v-4.06h-.77v12.99c.26-.03.5-.07.77-.12V34.3h1.77v7.64c.36-.1.72-.21 1.08-.34v-7c0-.8.19-1.4 1-1.67l-.9-4.87h1.8l.3 5.31h.22l.3-5.31h1.88l-1.01 4.87c.84.3 1.01.81 1.01 1.66v4.53a16.63 16.63 0 0 0 1.5-1.27v-9.83h5.25l.1-.72H24.93l.17.89c-.38-.72-1.12-1.08-2.2-1.08h-.77c-1.3 0-2.1.52-2.4 1.55-.27-1.08-1.1-1.62-2.46-1.62h-3.36v14.52c.26.09.52.18.78.25V27.84Zm16.29 5.58-.85-.8.85-4.37v5.17Z',
15
17
  'M27.66 40.79c.27-.14.55-.28.8-.43v-5.98h-.8v6.4Z',
16
18
  ];
19
+ const SVG_COLOR: Record<BgColorVersion, string> = {
20
+ 'bg-white': 'text-primary-main',
21
+ transparent: 'text-white',
22
+ };
23
+ const TEXT_COLOR: Record<BgColorVersion, string> = {
24
+ 'bg-white': 'text-black',
25
+ transparent: 'text-white',
26
+ };
17
27
 
18
- export const Logo = JSX<Partial<LogoProps>>(({ className, href, children, targetBlank }) => {
19
- return (
20
- <a
21
- className={`inline-flex items-center font-sans no-underline ${className || ''}`}
22
- href={href || 'https://rshb.ru/'}
23
- target={targetBlank ? '_blank' : '_self'}
24
- >
25
- <SVG
26
- className="text-primary-main w-10"
27
- viewBox="0 0 40 45"
28
- paths={LOGO_PATHS.map((d) => ({ d }))}
29
- />
30
- <span className="text-black text-base font-medium ml-2.5">
31
- {children || 'Россельхозбанк'}
32
- </span>
33
- </a>
34
- );
35
- });
28
+ export const Logo = JSX<Partial<LogoProps>>(
29
+ ({ className, href, children, targetBlank, bgColor = 'bg-white' }) => {
30
+ return (
31
+ <a
32
+ className={`inline-flex items-center font-sans no-underline ${className || ''}`}
33
+ href={href || 'https://rshb.ru/'}
34
+ target={targetBlank ? '_blank' : '_self'}
35
+ >
36
+ <SVG
37
+ className={`${SVG_COLOR[bgColor]} w-10`}
38
+ viewBox="0 0 40 45"
39
+ paths={LOGO_PATHS.map((d) => ({ d }))}
40
+ />
41
+ <span className={`${TEXT_COLOR[bgColor]} text-base font-medium ml-2.5`}>
42
+ {children || 'Россельхозбанк'}
43
+ </span>
44
+ </a>
45
+ );
46
+ },
47
+ );
@@ -1,4 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { BgColorVersion } from '../../model/BgColorVersion';
2
3
  import type { LinkProps } from '../../model/LinkProps';
3
4
 
4
5
  export interface TopItemContent extends LinkProps {
@@ -10,28 +11,54 @@ export interface TopItemProps extends TopItemContent {
10
11
  flat?: boolean;
11
12
  ariaLabel?: string;
12
13
  onClick?: (ev: MouseEvent) => any;
14
+ bgColor?: BgColorVersion;
13
15
  }
14
16
 
17
+ const TEXT_CLASSES = 'font-sans font-normal text-sm';
18
+ const LINK_CLASSES = 'inline-block border border-solid bg-transparent text-center no-underline';
19
+
15
20
  export const TopItem = JSX<TopItemProps>(
16
- ({ className, text, href, target, active, flat, onClick, children, ariaLabel }) => {
17
- const linkStyle = active ? 'border-primary-main rounded-md' : 'border-transparent';
18
- const textStyle = active
21
+ ({
22
+ className = '',
23
+ text,
24
+ href,
25
+ target,
26
+ active,
27
+ flat,
28
+ onClick,
29
+ children,
30
+ ariaLabel,
31
+ bgColor = 'bg-white',
32
+ }) => (
33
+ <a
34
+ className={`${getLinkClasses(bgColor, active, flat)} ${className}`}
35
+ href={href}
36
+ target={target}
37
+ onClick={onClick}
38
+ rel="noopener noreferrer"
39
+ aria-label={ariaLabel}
40
+ >
41
+ <span className={getTextClasses(bgColor, active, flat)}>{text || children}</span>
42
+ </a>
43
+ ),
44
+ );
45
+
46
+ const getLinkClasses = (bgColor: BgColorVersion, active?: boolean, flat?: boolean) => {
47
+ let classes = 'border-transparent';
48
+ if (active) {
49
+ classes = `rounded-md ${bgColor === 'bg-white' ? 'border-primary-main' : 'border-white'}`;
50
+ }
51
+
52
+ return `${classes} ${LINK_CLASSES} ${flat ? '' : 'px-4 py-2'}`;
53
+ };
54
+
55
+ const getTextClasses = (bgColor: BgColorVersion, active?: boolean, flat?: boolean) => {
56
+ let classes = 'text-white';
57
+ if (bgColor === 'bg-white') {
58
+ classes = active
19
59
  ? 'text-primary-main'
20
60
  : `${flat ? 'text-primary-text' : 'text-secondary-text'} hover:text-primary-main`;
61
+ }
21
62
 
22
- return (
23
- <a
24
- className={`inline-block border border-solid bg-transparent text-center no-underline ${
25
- flat ? '' : 'px-4 py-2'
26
- } ${linkStyle} ${className || ''}`}
27
- href={href}
28
- target={target}
29
- onClick={onClick}
30
- rel="noopener noreferrer"
31
- aria-label={ariaLabel}
32
- >
33
- <span className={`font-sans font-normal text-sm ${textStyle}`}>{text || children}</span>
34
- </a>
35
- );
36
- },
37
- );
63
+ return `${classes} ${TEXT_CLASSES}`;
64
+ };
@@ -0,0 +1,25 @@
1
+ import { adjustHref } from './adjustHref';
2
+
3
+ describe('adjustHref', () => {
4
+ it('should compute URL relative to some base URL', () => {
5
+ expect(
6
+ adjustHref('http://foo.ru/other/path', {
7
+ pathname: '/some/path',
8
+ href: 'http://foo.ru/some/path',
9
+ }),
10
+ ).toBe('/other/path');
11
+ });
12
+
13
+ it('should compute mobile URL for mobile pages', () => {
14
+ expect(
15
+ adjustHref('http://foo.ru/other/path', {
16
+ pathname: '/mobile/some/path',
17
+ href: 'http://foo.ru/mobile/some/path',
18
+ }),
19
+ ).toBe('/mobile/other/path');
20
+ });
21
+
22
+ it('should return nothing if nothing provided', () => {
23
+ expect(adjustHref(undefined, { pathname: '/mobile/some/path' })).toBe(undefined);
24
+ });
25
+ });
@@ -0,0 +1,24 @@
1
+ import { getOrigin, isURL } from './url';
2
+ import { MOBILE_URL_PATH } from './withoutMobilePath';
3
+
4
+ export const adjustHref = (
5
+ href: string | undefined,
6
+ router: { pathname: string; href?: string },
7
+ ) => {
8
+ if (!href) {
9
+ return href;
10
+ }
11
+
12
+ const relativeHref = toRelativeHref(href, router) || '';
13
+ const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
14
+ return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
15
+ };
16
+
17
+ const toRelativeHref = (href: string | undefined, router: { href?: string }) => {
18
+ if (!href) {
19
+ return href;
20
+ }
21
+
22
+ const origin = getOrigin(router?.href);
23
+ return origin ? href.replace(origin, '') || '/' : href;
24
+ };
@@ -0,0 +1,11 @@
1
+ import { maxBy } from './maxBy';
2
+
3
+ describe('maxBy', () => {
4
+ it('should return max value', () => {
5
+ expect(maxBy((_: number) => _)([1, 3, 2])).toBe(3);
6
+ });
7
+
8
+ it('should return max value with respect to discriminator', () => {
9
+ expect(maxBy((_: string) => _.length)(['123', '123456789', '123456'])).toBe('123456789');
10
+ });
11
+ });
@@ -0,0 +1,7 @@
1
+ export const maxBy =
2
+ <Item, Value>(discriminator: (item: Item) => Value) =>
3
+ (list: Item[]): Item =>
4
+ list.reduceRight((a, b) => (discriminator(a) > discriminator(b) ? a : b));
5
+
6
+ export const minBy = <Item, Value>(discriminator: (item: Item) => Value) =>
7
+ maxBy((_: Item) => -discriminator(_));
@@ -1,4 +1,4 @@
1
- import { adjustHref, getOrigin, toRelativeHref, withoutQuery } from './url';
1
+ import { getOrigin, withoutQuery } from './url';
2
2
 
3
3
  describe('url', () => {
4
4
  describe('withoutQuery', () => {
@@ -14,40 +14,4 @@ describe('url', () => {
14
14
  expect(getOrigin('http://foo.ru/other/path?first=1&second=2')).toBe('http://foo.ru');
15
15
  });
16
16
  });
17
-
18
- describe('adjustHref', () => {
19
- it('should compute URL relative to some base URL', () => {
20
- expect(
21
- adjustHref('http://foo.ru/other/path', {
22
- pathname: '/some/path',
23
- href: 'http://foo.ru/some/path',
24
- }),
25
- ).toBe('/other/path');
26
- });
27
-
28
- it('should compute mobile URL for mobile pages', () => {
29
- expect(
30
- adjustHref('http://foo.ru/other/path', {
31
- pathname: '/mobile/some/path',
32
- href: 'http://foo.ru/mobile/some/path',
33
- }),
34
- ).toBe('/mobile/other/path');
35
- });
36
-
37
- it('should return nothing if nothing provided', () => {
38
- expect(adjustHref(undefined, { pathname: '/mobile/some/path' })).toBe(undefined);
39
- });
40
- });
41
-
42
- describe('toRelativeHref', () => {
43
- it('should compute URL relative to some base URL', () => {
44
- expect(toRelativeHref('http://foo.ru/other/path', { href: 'http://foo.ru/some/path' })).toBe(
45
- '/other/path',
46
- );
47
- });
48
-
49
- it('should return nothing if nothing provided', () => {
50
- expect(toRelativeHref(undefined, {})).toBe(undefined);
51
- });
52
- });
53
17
  });
package/src/utils/url.ts CHANGED
@@ -1,52 +1,15 @@
1
- export const MOBILE_URL_PATH = '/mobile';
2
-
3
1
  export const isURL = (href?: string) => href?.includes('//');
4
2
 
5
- export const isHrefActive = (
6
- href: string | undefined,
7
- router: { pathname?: string; href?: string },
8
- cmp: (href: string, baseHref: string) => boolean = (href, baseHref) => href === baseHref,
9
- ) => {
10
- return cmp(
11
- withoutQuery(href),
12
- withoutMobilePath(withoutQuery(isURL(href) ? router.href : router.pathname)),
13
- );
14
- };
15
-
16
3
  export const withoutQuery = (href?: string) => (href || '').replace(/\/?\?.*/, '');
17
4
 
18
- export const withoutMobilePath = (href?: string) => (href || '').replace(MOBILE_URL_PATH, '');
19
-
20
5
  export const getOrigin = (href?: string) => {
21
- if (!isURL(href)) {
6
+ if (!href || !isURL(href)) {
22
7
  return undefined;
23
8
  }
24
9
 
25
- const url = href!;
10
+ const url = href;
26
11
  const protoSeparator = '//';
27
12
  const endOfProto = url.indexOf(protoSeparator);
28
13
  const endOfOrigin = url.indexOf('/', endOfProto + protoSeparator.length);
29
14
  return endOfOrigin !== -1 ? url.substring(0, endOfOrigin) : url;
30
15
  };
31
-
32
- export const adjustHref = (
33
- href: string | undefined,
34
- router: { pathname: string; href?: string },
35
- ) => {
36
- if (!href) {
37
- return href;
38
- }
39
-
40
- const relativeHref = toRelativeHref(href, router)!;
41
- const isMobilePage = router?.pathname.startsWith(MOBILE_URL_PATH);
42
- return isMobilePage && !isURL(relativeHref) ? `${MOBILE_URL_PATH}${relativeHref}` : relativeHref;
43
- };
44
-
45
- export const toRelativeHref = (href: string | undefined, router: { href?: string }) => {
46
- if (!href) {
47
- return href;
48
- }
49
-
50
- const origin = getOrigin(router?.href);
51
- return origin ? href.replace(origin, '') || '/' : href;
52
- };
@@ -0,0 +1,3 @@
1
+ export const MOBILE_URL_PATH = '/mobile';
2
+
3
+ export const withoutMobilePath = (href?: string) => (href || '').replace(MOBILE_URL_PATH, '');
@@ -1,3 +0,0 @@
1
- import type { LinkProps } from '../../model/LinkProps';
2
- import type { Router } from '../ContentPage/ContentPageContext';
3
- export declare function isSubItemActive(router: Router): (subItem: LinkProps) => boolean;
@@ -1,8 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.isSubItemActive = void 0;
3
- const url_1 = require("../../utils/url");
4
- function isSubItemActive(router) {
5
- return (subItem) => (0, url_1.isHrefActive)(subItem.href, router);
6
- }
7
- exports.isSubItemActive = isSubItemActive;
8
- //# sourceMappingURL=isSubItemActive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isSubItemActive.js","sourceRoot":"","sources":["../../../src/components/Header/isSubItemActive.ts"],"names":[],"mappings":";;AACA,yCAA+C;AAG/C,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAkB,EAAW,EAAE,CAAC,IAAA,kBAAY,EAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAFD,0CAEC"}
@@ -1,3 +0,0 @@
1
- import type { LinkProps } from '../../model/LinkProps';
2
- import type { Router } from '../ContentPage/ContentPageContext';
3
- export declare function isTopItemActive(router: Router): (topItem: LinkProps) => boolean;
@@ -1,8 +0,0 @@
1
- Object.defineProperty(exports, "__esModule", { value: true });
2
- exports.isTopItemActive = void 0;
3
- const url_1 = require("../../utils/url");
4
- function isTopItemActive(router) {
5
- return (topItem) => (0, url_1.isHrefActive)(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
6
- }
7
- exports.isTopItemActive = isTopItemActive;
8
- //# sourceMappingURL=isTopItemActive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isTopItemActive.js","sourceRoot":"","sources":["../../../src/components/Header/isTopItemActive.ts"],"names":[],"mappings":";;AACA,yCAA+C;AAG/C,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAkB,EAAW,EAAE,CACrC,IAAA,kBAAY,EAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;AACpG,CAAC;AAHD,0CAGC"}
@@ -1,3 +0,0 @@
1
- import type { AsyncDataHook } from '../components/ContentPage/ContentPageContext';
2
- import type { HeaderContent } from '../components/Header/HeaderContent';
3
- export declare function useSitemap(useAsyncData: AsyncDataHook): HeaderContent;
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSitemap.js","sourceRoot":"","sources":["../../src/hooks/useSitemap.ts"],"names":[],"mappings":";;AAEA,wDAAqD;AAErD,SAAgB,UAAU,CAAC,YAA2B;IACpD,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,UAAU,EAAE,EAAE,YAAY,CAAC,CAAC;IAC1D,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC;AAHD,gCAGC;AAED,KAAK,UAAU,YAAY;IACzB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,mBAAmB,iCAAe,CAAC,OAAO,IAAI,SAAS,OAAO,CAAC;AACxE,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { LinkProps } from './model/LinkProps';
2
- export declare function mergeTopItems<L extends LinkProps>(left?: L[], right?: L[]): L[];
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeTopItems.js","sourceRoot":"","sources":["../src/mergeTopItems.ts"],"names":[],"mappings":";;AAEA,MAAM,GAAG,GAAG,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,CAAC;AAEtE,MAAM,UAAU,GAAG,CAAsB,KAAW,EAAE,YAAkB,EAAO,EAAE,CAC/E,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAE5D,MAAM,QAAQ,GAAG,CAAsB,OAAa,EAAE,UAAgB,EAAO,EAAE,CAC7E,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3D,SAAgB,aAAa,CAAsB,IAAU,EAAE,KAAW;IACxE,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC;AAFD,sCAEC"}
@@ -1,3 +0,0 @@
1
- import type { LinkProps } from '../../model/LinkProps';
2
- import type { Router } from '../ContentPage/ContentPageContext';
3
- export declare function isSubItemActive(router: Router): (subItem: LinkProps) => boolean;
@@ -1,5 +0,0 @@
1
- import { isHrefActive } from '../../utils/url.js';
2
- export function isSubItemActive(router) {
3
- return (subItem) => isHrefActive(subItem.href, router);
4
- }
5
- //# sourceMappingURL=isSubItemActive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isSubItemActive.js","sourceRoot":"","sources":["../../../src/components/Header/isSubItemActive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAkB,EAAW,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { LinkProps } from '../../model/LinkProps';
2
- import type { Router } from '../ContentPage/ContentPageContext';
3
- export declare function isTopItemActive(router: Router): (topItem: LinkProps) => boolean;
@@ -1,5 +0,0 @@
1
- import { isHrefActive } from '../../utils/url.js';
2
- export function isTopItemActive(router) {
3
- return (topItem) => isHrefActive(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
4
- }
5
- //# sourceMappingURL=isTopItemActive.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isTopItemActive.js","sourceRoot":"","sources":["../../../src/components/Header/isTopItemActive.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,OAAO,CAAC,OAAkB,EAAW,EAAE,CACrC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;AACpG,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { AsyncDataHook } from '../components/ContentPage/ContentPageContext';
2
- import type { HeaderContent } from '../components/Header/HeaderContent';
3
- export declare function useSitemap(useAsyncData: AsyncDataHook): HeaderContent;
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSitemap.js","sourceRoot":"","sources":["../../src/hooks/useSitemap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,UAAU,UAAU,CAAC,YAA2B;IACpD,MAAM,EAAE,IAAI,EAAE,GAAG,YAAY,CAAC,UAAU,EAAE,EAAE,YAAY,CAAC,CAAC;IAC1D,OAAO,IAAI,IAAI,EAAE,CAAC;AACpB,CAAC;AAED,KAAK,UAAU,YAAY;IACzB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC;IAC3C,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;AAC/B,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,mBAAmB,eAAe,CAAC,OAAO,IAAI,SAAS,OAAO,CAAC;AACxE,CAAC"}
@@ -1,2 +0,0 @@
1
- import type { LinkProps } from './model/LinkProps';
2
- export declare function mergeTopItems<L extends LinkProps>(left?: L[], right?: L[]): L[];
@@ -1 +0,0 @@
1
- {"version":3,"file":"mergeTopItems.js","sourceRoot":"","sources":["../src/mergeTopItems.ts"],"names":[],"mappings":"AAEA,MAAM,GAAG,GAAG,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,IAAI,CAAC;AAEtE,MAAM,UAAU,GAAG,CAAsB,KAAW,EAAE,YAAkB,EAAO,EAAE,CAC/E,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AAE5D,MAAM,QAAQ,GAAG,CAAsB,OAAa,EAAE,UAAgB,EAAO,EAAE,CAC7E,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3D,MAAM,UAAU,aAAa,CAAsB,IAAU,EAAE,KAAW;IACxE,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"}
@@ -1,7 +0,0 @@
1
- import type { LinkProps } from '../../model/LinkProps';
2
- import { isHrefActive } from '../../utils/url';
3
- import type { Router } from '../ContentPage/ContentPageContext';
4
-
5
- export function isSubItemActive(router: Router) {
6
- return (subItem: LinkProps): boolean => isHrefActive(subItem.href, router);
7
- }
@@ -1,8 +0,0 @@
1
- import type { LinkProps } from '../../model/LinkProps';
2
- import { isHrefActive } from '../../utils/url';
3
- import type { Router } from '../ContentPage/ContentPageContext';
4
-
5
- export function isTopItemActive(router: Router) {
6
- return (topItem: LinkProps): boolean =>
7
- isHrefActive(topItem.href, router, (topItemHref, baseHref) => baseHref.startsWith(topItemHref));
8
- }