@jetbrains/kotlin-web-site-ui 4.0.0-alpha.2 → 4.1.0-alpha.0
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.
- package/out/blocks/formik-wrapper/input.js +3 -3
- package/out/blocks/formik-wrapper/privacy-checkbox.js +17 -21
- package/out/blocks/formik-wrapper/privacy-notice.js +19 -28
- package/out/blocks/formik-wrapper/submit-button.js +3 -3
- package/out/components/cta-block/cta-block.js +17 -33
- package/out/components/footer/footer.js +30 -48
- package/out/components/footer/logo/logo.js +3 -5
- package/out/components/footer/nav/nav-item.js +11 -15
- package/out/components/footer/nav/nav-list.js +8 -11
- package/out/components/footer/social-list/social-item/social-item.js +3 -5
- package/out/components/footer/social-list/social-list.js +6 -7
- package/out/components/header/{consts.js → components/header/consts.js} +0 -0
- package/out/components/header/components/header/full-search/chapters/chapters.js +56 -0
- package/out/components/header/components/header/full-search/chapters/chapters.module.pcss.js +11 -0
- package/out/components/header/components/header/full-search/empty/empty.js +22 -0
- package/out/components/header/components/header/full-search/empty/empty.module.pcss.js +6 -0
- package/out/components/header/components/header/full-search/empty/full-search-empty.svg.js +1539 -0
- package/out/components/header/components/header/full-search/full-search.js +70 -0
- package/out/components/header/components/header/full-search/full-search.module.pcss.js +9 -0
- package/out/components/header/components/header/full-search/hit-list/hit-list.js +44 -0
- package/out/components/header/components/header/full-search/hit-list/hit-list.module.pcss.js +5 -0
- package/out/components/header/components/header/full-search/loading/loading.js +11 -0
- package/out/components/header/components/header/full-search/loading/loading.module.pcss.js +4 -0
- package/out/components/header/components/header/full-search/result/get-extended-hits.js +55 -0
- package/out/components/header/components/header/full-search/results-list/results-list.js +25 -0
- package/out/components/header/components/header/header.js +105 -0
- package/out/components/header/{header.module.pcss.js → components/header/header.module.pcss.js} +0 -0
- package/out/components/header/components/header/horizontal-menu/horizontal-menu.js +100 -0
- package/out/components/header/{horizontal-menu → components/header/horizontal-menu}/horizontal-menu.module.pcss.js +0 -0
- package/out/components/header/{index.js → components/header/index.js} +0 -0
- package/out/components/header/{logo-large → components/header/logo-large}/kotlin-logo-large.svg.js +0 -0
- package/out/components/header/{logo-large → components/header/logo-large}/logo-large.js +11 -17
- package/out/components/header/{logo-large → components/header/logo-large}/logo-large.module.pcss.js +0 -0
- package/out/components/header/{logo-small → components/header/logo-small}/kotlin-logo-small.svg.js +0 -0
- package/out/components/header/components/header/logo-small/logo-small.js +27 -0
- package/out/components/header/{logo-small → components/header/logo-small}/logo-small.module.pcss.js +0 -0
- package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/close-icon.svg.js +0 -0
- package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/hamburger-icon.svg.js +0 -0
- package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/menu-button.js +3 -5
- package/out/components/header/{menu-popup → components/header/menu-popup}/menu-button/menu-button.module.pcss.js +0 -0
- package/out/components/header/{menu-popup → components/header/menu-popup}/menu-popup.js +28 -37
- package/out/components/header/{menu-popup → components/header/menu-popup}/menu-popup.module.pcss.js +0 -0
- package/out/components/header/{nav-scheme.js → components/header/nav-scheme.js} +0 -0
- package/out/components/header/components/header/quick-search/empty/empty.js +16 -0
- package/out/components/header/components/header/quick-search/empty/empty.module.pcss.js +4 -0
- package/out/components/header/components/header/quick-search/list/list.js +31 -0
- package/out/components/header/components/header/quick-search/list/list.module.pcss.js +6 -0
- package/out/components/header/components/header/quick-search/loading/loading.js +14 -0
- package/out/components/header/components/header/quick-search/loading/loading.module.pcss.js +4 -0
- package/out/components/header/components/header/quick-search/quick-search.js +41 -0
- package/out/components/header/components/header/quick-search/quick-search.module.pcss.js +4 -0
- package/out/components/header/components/header/quick-search/result/result.js +30 -0
- package/out/components/header/components/header/quick-search/result/result.module.pcss.js +6 -0
- package/out/components/header/components/header/search-box/search-box.js +69 -0
- package/out/components/header/components/header/search-box/search-box.module.pcss.js +4 -0
- package/out/components/header/{search-button → components/header/search-button}/search-button.js +6 -6
- package/out/components/header/{search-button → components/header/search-button}/search-button.module.pcss.js +0 -0
- package/out/components/header/{search-button → components/header/search-button}/search.svg.js +0 -0
- package/out/components/header/components/header/search-wrapper/init-search.js +60 -0
- package/out/components/header/components/header/search-wrapper/search-const.js +13 -0
- package/out/components/header/components/header/search-wrapper/search-context.js +18 -0
- package/out/components/header/components/header/search-wrapper/search-with-algolia.js +58 -0
- package/out/components/header/components/header/search-wrapper/search-wrapper.js +40 -0
- package/out/components/header/components/header/search-wrapper/use-search.js +85 -0
- package/out/components/header/helper/is-macos.js +5 -0
- package/out/components/header/helper/key-codes.js +3 -0
- package/out/components/header/index.css +253 -0
- package/out/components/popup/popup.js +34 -40
- package/out/components/quotes-slider/quites-slider.js +33 -63
- package/out/components/top-menu/dropdown-menu/dropdown-menu.js +28 -40
- package/out/components/top-menu/horizontal-menu/horizontal-menu.js +13 -17
- package/out/components/top-menu/top-menu.js +19 -23
- package/out/components/youtube-player/youtube-player.js +24 -31
- package/package.json +13 -8
- package/out/components/header/header.js +0 -68
- package/out/components/header/horizontal-menu/horizontal-menu.js +0 -110
- package/out/components/header/logo-small/logo-small.js +0 -33
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState, useRef, useEffect } from 'react';
|
|
1
|
+
import React__default, { useState, useRef, useEffect } from 'react';
|
|
3
2
|
import classNames from 'classnames';
|
|
4
3
|
import styles from './youtube-player.module.pcss.js';
|
|
5
4
|
import SvgPlay24 from './play_24.svg.js';
|
|
@@ -108,7 +107,7 @@ const YoutubePlayer = ({
|
|
|
108
107
|
}
|
|
109
108
|
};
|
|
110
109
|
}, [isAPILoaded, showVideo, startTime, id, mode]);
|
|
111
|
-
return
|
|
110
|
+
return React__default.createElement("div", {
|
|
112
111
|
ref: playerWrapperDivRef,
|
|
113
112
|
onClick: e => {
|
|
114
113
|
e.preventDefault();
|
|
@@ -119,34 +118,28 @@ const YoutubePlayer = ({
|
|
|
119
118
|
[styles.showVideo]: showVideo
|
|
120
119
|
}),
|
|
121
120
|
style: wrapperStyles
|
|
122
|
-
}, {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}), void 0)]
|
|
145
|
-
}), void 0), jsx("div", {
|
|
146
|
-
className: styles.player,
|
|
147
|
-
ref: playerDivRef
|
|
148
|
-
}, void 0)]
|
|
149
|
-
}), void 0);
|
|
121
|
+
}, React__default.createElement("div", {
|
|
122
|
+
className: classNames(styles.preview, {
|
|
123
|
+
[styles.previewPlaylist]: !preview && !imgPreview && mode === YoutubePlayerMode.Playlist
|
|
124
|
+
})
|
|
125
|
+
}, preview ? preview : imgPreview && React__default.createElement("img", {
|
|
126
|
+
src: imgPreview,
|
|
127
|
+
alt: previewImgAlt ? previewImgAlt : '',
|
|
128
|
+
className: styles.imagePreview
|
|
129
|
+
}), React__default.createElement("button", {
|
|
130
|
+
type: "button",
|
|
131
|
+
className: classNames(styles.playButton, {
|
|
132
|
+
[styles.hide]: showVideo && !videoLoading,
|
|
133
|
+
[styles.playButtonWhite]: playButtonMode === YoutubePlayButtonMode.White,
|
|
134
|
+
[styles.playButtonBlack]: playButtonMode === YoutubePlayButtonMode.Black,
|
|
135
|
+
[styles.playButtonPrimary]: playButtonMode === YoutubePlayButtonMode.Primary
|
|
136
|
+
})
|
|
137
|
+
}, videoLoading ? React__default.createElement(SvgLoading24, {
|
|
138
|
+
className: styles.iconLoading
|
|
139
|
+
}) : React__default.createElement(SvgPlay24, null))), React__default.createElement("div", {
|
|
140
|
+
className: styles.player,
|
|
141
|
+
ref: playerDivRef
|
|
142
|
+
}));
|
|
150
143
|
};
|
|
151
144
|
|
|
152
145
|
export { YoutubePlayButtonMode, YoutubePlayer, YoutubePlayerMode };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetbrains/kotlin-web-site-ui",
|
|
3
3
|
"description": "UI components for Kotlin web sites development",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.1.0-alpha.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "JetBrains",
|
|
7
7
|
"files": [
|
|
@@ -17,12 +17,10 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"codegeneration": "node ./scripts/build.js && yarn run copy-static",
|
|
19
19
|
"copy-static": "copyfiles -f src/svg/*.svg out/svg",
|
|
20
|
-
"build": "webpack --mode production --devtool source-map",
|
|
21
|
-
"watch": "webpack --mode development --watch",
|
|
22
20
|
"storybook": "yarn & start-storybook -p 6006",
|
|
23
21
|
"build-storybook": "build-storybook",
|
|
24
22
|
"storybook-docs": "start-storybook --docs --no-manager-cache",
|
|
25
|
-
"release:ci": "npm run
|
|
23
|
+
"release:ci": "npm run codegeneration && standard-version && git push --follow-tags origin master && npm publish"
|
|
26
24
|
},
|
|
27
25
|
"peerDependencies": {
|
|
28
26
|
"@rescui/checkbox": "0.x",
|
|
@@ -31,12 +29,17 @@
|
|
|
31
29
|
"@rescui/tooltip": "0.x",
|
|
32
30
|
"@rescui/typography": "0.x",
|
|
33
31
|
"@rescui/ui-contexts": "0.x",
|
|
32
|
+
"algoliasearch": "4.x",
|
|
34
33
|
"formik": "2.x",
|
|
35
34
|
"react": ">= 16.8.6 < 18",
|
|
36
|
-
"react-dom": ">= 16.8.6 < 18"
|
|
35
|
+
"react-dom": ">= 16.8.6 < 18",
|
|
36
|
+
"react-outside-click-handler": "^1.3.0",
|
|
37
|
+
"react-swipeable-views": "0.x",
|
|
38
|
+
"sha.js": "2.x"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@babel/core": "^7.11.6",
|
|
42
|
+
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
40
43
|
"@babel/preset-env": "^7.11.5",
|
|
41
44
|
"@babel/preset-react": "^7.13.13",
|
|
42
45
|
"@babel/preset-typescript": "^7.13.0",
|
|
@@ -46,8 +49,9 @@
|
|
|
46
49
|
"@rescui/checkbox": "^0.1.0",
|
|
47
50
|
"@rescui/icons": "^0.2.0",
|
|
48
51
|
"@rescui/input": "^0.1.2",
|
|
52
|
+
"@rescui/switcher": "^0.2.2",
|
|
49
53
|
"@rescui/tooltip": "^0.1.2",
|
|
50
|
-
"@rescui/typography": "^0.3
|
|
54
|
+
"@rescui/typography": "^0.7.3",
|
|
51
55
|
"@rescui/ui-contexts": "^0.1.3",
|
|
52
56
|
"@rollup/plugin-babel": "^5.3.1",
|
|
53
57
|
"@rollup/plugin-json": "^4.1.0",
|
|
@@ -64,11 +68,13 @@
|
|
|
64
68
|
"@types/react": "^17.0.0",
|
|
65
69
|
"@types/react-dom": "^17.0.0",
|
|
66
70
|
"@types/react-modal": "^3.13.1",
|
|
71
|
+
"@types/react-outside-click-handler": "^1.3.1",
|
|
67
72
|
"@types/react-swipeable-views": "^0.13.1",
|
|
68
73
|
"@types/sha.js": "^2.4.0",
|
|
69
74
|
"@types/youtube": "^0.0.45",
|
|
70
75
|
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
|
71
76
|
"@typescript-eslint/parser": "^4.22.0",
|
|
77
|
+
"algoliasearch": "^4.13.1",
|
|
72
78
|
"autoprefixer": "^10.2.5",
|
|
73
79
|
"babel-loader": "^8.2.2",
|
|
74
80
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
@@ -80,7 +86,6 @@
|
|
|
80
86
|
"copyfiles": "^2.4.1",
|
|
81
87
|
"core-js": "^3.10.0",
|
|
82
88
|
"css-loader": "^5.2.0",
|
|
83
|
-
"csso-webpack-plugin": "^2.0.0-beta.3",
|
|
84
89
|
"eslint": "^7.24.0",
|
|
85
90
|
"eslint-config-prettier": "^8.2.0",
|
|
86
91
|
"eslint-plugin-import": "^2.22.1",
|
|
@@ -103,6 +108,7 @@
|
|
|
103
108
|
"react": "^16.8.6",
|
|
104
109
|
"react-dom": "^16.8.6",
|
|
105
110
|
"react-modal": "^3.14.4",
|
|
111
|
+
"react-outside-click-handler": "^1.3.0",
|
|
106
112
|
"react-remove-scroll-bar": "^2.2.0",
|
|
107
113
|
"react-swipeable-views": "^0.14.0",
|
|
108
114
|
"rollup": "^2.70.1",
|
|
@@ -112,7 +118,6 @@
|
|
|
112
118
|
"sha.js": "^2.4.11",
|
|
113
119
|
"standard-version": "^9.2.0",
|
|
114
120
|
"svgo-loader": "^3.0.0",
|
|
115
|
-
"terser-webpack-plugin": "^5.1.1",
|
|
116
121
|
"typescript": "^4.2.4",
|
|
117
122
|
"webpack": "^5.30.0",
|
|
118
123
|
"webpack-cli": "^4.6.0",
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useState, useMemo, useRef, useImperativeHandle, useLayoutEffect } from 'react';
|
|
3
|
-
import { ThemeProvider } from '@rescui/ui-contexts';
|
|
4
|
-
import useResizeObserver from '@react-hook/resize-observer';
|
|
5
|
-
import { LogoLarge } from './logo-large/logo-large.js';
|
|
6
|
-
import styles from './header.module.pcss.js';
|
|
7
|
-
import { getNavScheme } from './nav-scheme.js';
|
|
8
|
-
import { HorizontalMenu } from './horizontal-menu/horizontal-menu.js';
|
|
9
|
-
import { SearchButton } from './search-button/search-button.js';
|
|
10
|
-
import { MenuPopup } from './menu-popup/menu-popup.js';
|
|
11
|
-
import { LogoSmall } from './logo-small/logo-small.js';
|
|
12
|
-
import classNames from 'classnames';
|
|
13
|
-
const MENU_POPUP_BREAKPOINT = 640;
|
|
14
|
-
const Header = forwardRef(({
|
|
15
|
-
productWebUrl,
|
|
16
|
-
hasSearch = false,
|
|
17
|
-
onSearchClick,
|
|
18
|
-
currentUrl,
|
|
19
|
-
currentTitle,
|
|
20
|
-
className,
|
|
21
|
-
hasBorder = true,
|
|
22
|
-
dropdownTheme = 'dark',
|
|
23
|
-
linkHandler,
|
|
24
|
-
isPlayground,
|
|
25
|
-
isUrlActive
|
|
26
|
-
}, forwardedRef) => {
|
|
27
|
-
const [menuPopupExpanded, setMenuPopupExpanded] = useState(false);
|
|
28
|
-
const [isMenuPopupVisible, setIsMenuPopupVisible] = useState(false);
|
|
29
|
-
const items = useMemo(() => getNavScheme(isUrlActive, currentUrl, isPlayground), [isUrlActive, currentUrl, isPlayground]);
|
|
30
|
-
const headerRef = useRef(null);
|
|
31
|
-
useImperativeHandle(forwardedRef, () => headerRef.current);
|
|
32
|
-
useLayoutEffect(() => {
|
|
33
|
-
setIsMenuPopupVisible((headerRef.current?.getBoundingClientRect?.().width ?? 0) <= MENU_POPUP_BREAKPOINT);
|
|
34
|
-
}, [headerRef]);
|
|
35
|
-
useResizeObserver(headerRef, entry => setIsMenuPopupVisible(entry.contentRect.width <= MENU_POPUP_BREAKPOINT));
|
|
36
|
-
return jsx(ThemeProvider, Object.assign({
|
|
37
|
-
theme: 'dark'
|
|
38
|
-
}, {
|
|
39
|
-
children: jsxs("header", Object.assign({
|
|
40
|
-
ref: headerRef,
|
|
41
|
-
className: classNames(styles.headerMenu, className, {
|
|
42
|
-
[styles.withMenuPopup]: menuPopupExpanded,
|
|
43
|
-
[styles.border]: hasBorder
|
|
44
|
-
})
|
|
45
|
-
}, {
|
|
46
|
-
children: [isMenuPopupVisible && currentTitle && currentUrl && !menuPopupExpanded ? jsx(LogoSmall, {
|
|
47
|
-
homeTitle: currentTitle,
|
|
48
|
-
homeUrl: currentUrl
|
|
49
|
-
}, void 0) : jsx(LogoLarge, {
|
|
50
|
-
productWebUrl: productWebUrl
|
|
51
|
-
}, void 0), !isMenuPopupVisible && jsx(HorizontalMenu, {
|
|
52
|
-
items: items,
|
|
53
|
-
theme: dropdownTheme,
|
|
54
|
-
linkHandler: linkHandler
|
|
55
|
-
}, void 0), jsx(SearchButton, {
|
|
56
|
-
onClick: onSearchClick,
|
|
57
|
-
isActive: hasSearch && !!onSearchClick
|
|
58
|
-
}, void 0), isMenuPopupVisible && jsx(MenuPopup, {
|
|
59
|
-
items: items,
|
|
60
|
-
setExpand: setMenuPopupExpanded,
|
|
61
|
-
isExpanded: menuPopupExpanded,
|
|
62
|
-
headerRef: headerRef,
|
|
63
|
-
linkHandler: linkHandler
|
|
64
|
-
}, void 0)]
|
|
65
|
-
}), void 0)
|
|
66
|
-
}), void 0);
|
|
67
|
-
});
|
|
68
|
-
export { Header };
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect, createElement } from 'react';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import styles from './horizontal-menu.module.pcss.js';
|
|
5
|
-
import { useTextStyles } from '@rescui/typography';
|
|
6
|
-
|
|
7
|
-
const DropdownMenu = ({
|
|
8
|
-
items,
|
|
9
|
-
isExpanded,
|
|
10
|
-
alignRight,
|
|
11
|
-
linkHandler
|
|
12
|
-
}) => {
|
|
13
|
-
const textCn = useTextStyles();
|
|
14
|
-
return jsx("ul", Object.assign({
|
|
15
|
-
className: classNames(styles.dropdownMenu, textCn('rs-text-2'), {
|
|
16
|
-
[styles.dropdownMenuExpanded]: isExpanded,
|
|
17
|
-
[styles.dropdownMenuAlignRight]: alignRight
|
|
18
|
-
})
|
|
19
|
-
}, {
|
|
20
|
-
children: items.map((item, key) => {
|
|
21
|
-
const Tag = !item.isActive && item.url ? 'a' : 'span';
|
|
22
|
-
return jsx("li", {
|
|
23
|
-
children: jsx(Tag, Object.assign({
|
|
24
|
-
className: classNames(styles.dropdownMenuItem, {
|
|
25
|
-
[styles.active]: item.isActive
|
|
26
|
-
})
|
|
27
|
-
}, item.url ? {
|
|
28
|
-
href: item.url,
|
|
29
|
-
onClick: linkHandler ? event => item.url && linkHandler(event, item.url) : undefined
|
|
30
|
-
} : {}, {
|
|
31
|
-
children: item.title
|
|
32
|
-
}), void 0)
|
|
33
|
-
}, key);
|
|
34
|
-
})
|
|
35
|
-
}), void 0);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const HorizontalMenuItem = ({
|
|
39
|
-
item,
|
|
40
|
-
onMouseEnter,
|
|
41
|
-
onMouseLeave,
|
|
42
|
-
isExpanded,
|
|
43
|
-
isLast,
|
|
44
|
-
linkHandler
|
|
45
|
-
}) => {
|
|
46
|
-
const Tag = item.isActive || !item.url ? 'span' : 'a';
|
|
47
|
-
const textCn = useTextStyles();
|
|
48
|
-
|
|
49
|
-
const handleEnter = () => onMouseEnter(item);
|
|
50
|
-
|
|
51
|
-
return jsxs("li", Object.assign({
|
|
52
|
-
className: styles.menuItemWrap,
|
|
53
|
-
onMouseEnter: handleEnter,
|
|
54
|
-
onMouseLeave: onMouseLeave
|
|
55
|
-
}, {
|
|
56
|
-
children: [createElement(Tag, Object.assign({}, item.url ? {
|
|
57
|
-
href: item.url,
|
|
58
|
-
onClick: linkHandler ? event => item.url && linkHandler(event, item.url) : undefined
|
|
59
|
-
} : {}, {
|
|
60
|
-
key: item.title,
|
|
61
|
-
className: classNames(styles.menuItem, textCn('rs-text-2'), {
|
|
62
|
-
[styles.itemActive]: item.isActive,
|
|
63
|
-
[styles.expanded]: isExpanded && !!item.items?.length
|
|
64
|
-
})
|
|
65
|
-
}), item.title), !!item.items?.length && jsx(DropdownMenu, {
|
|
66
|
-
items: item.items,
|
|
67
|
-
isExpanded: isExpanded,
|
|
68
|
-
alignRight: isLast,
|
|
69
|
-
linkHandler: linkHandler
|
|
70
|
-
}, void 0)]
|
|
71
|
-
}), void 0);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const HorizontalMenu = ({
|
|
75
|
-
items,
|
|
76
|
-
theme,
|
|
77
|
-
linkHandler
|
|
78
|
-
}) => {
|
|
79
|
-
const [activeIndex, setActiveIndex] = useState(-1);
|
|
80
|
-
const [debouncedActiveIndex, setDebouncedActiveIndex] = useState(activeIndex);
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
const handler = setTimeout(() => setDebouncedActiveIndex(activeIndex), activeIndex !== -1 ? 200 : 400);
|
|
83
|
-
return () => clearTimeout(handler);
|
|
84
|
-
}, [activeIndex]);
|
|
85
|
-
|
|
86
|
-
const handleEnter = item => setActiveIndex(items.findIndex(val => val === item));
|
|
87
|
-
|
|
88
|
-
const handleLeave = () => setActiveIndex(-1);
|
|
89
|
-
|
|
90
|
-
return jsx("nav", Object.assign({
|
|
91
|
-
className: classNames(styles.nav, {
|
|
92
|
-
[styles.darkTheme]: theme === 'dark'
|
|
93
|
-
})
|
|
94
|
-
}, {
|
|
95
|
-
children: jsx("ul", Object.assign({
|
|
96
|
-
className: styles.menuList
|
|
97
|
-
}, {
|
|
98
|
-
children: items.map((item, index) => jsx(HorizontalMenuItem, {
|
|
99
|
-
item: item,
|
|
100
|
-
onMouseEnter: handleEnter,
|
|
101
|
-
onMouseLeave: handleLeave,
|
|
102
|
-
isExpanded: index === debouncedActiveIndex,
|
|
103
|
-
isLast: index === items.length - 1,
|
|
104
|
-
linkHandler: linkHandler
|
|
105
|
-
}, index))
|
|
106
|
-
}), void 0)
|
|
107
|
-
}), void 0);
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export { HorizontalMenu };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import SvgKotlinLogoSmall from './kotlin-logo-small.svg.js';
|
|
3
|
-
import styles from './logo-small.module.pcss.js';
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { useTextStyles } from '@rescui/typography';
|
|
6
|
-
import { KOTLINLANG_URL } from '../consts.js';
|
|
7
|
-
|
|
8
|
-
const LogoSmall = ({
|
|
9
|
-
homeTitle,
|
|
10
|
-
homeUrl,
|
|
11
|
-
className
|
|
12
|
-
}) => {
|
|
13
|
-
const textCn = useTextStyles();
|
|
14
|
-
return jsxs("div", Object.assign({
|
|
15
|
-
className: classNames(styles.logoSmall, className)
|
|
16
|
-
}, {
|
|
17
|
-
children: [jsx("a", Object.assign({
|
|
18
|
-
href: KOTLINLANG_URL,
|
|
19
|
-
className: styles.iconWrap
|
|
20
|
-
}, {
|
|
21
|
-
children: jsx(SvgKotlinLogoSmall, {
|
|
22
|
-
className: styles.icon
|
|
23
|
-
}, void 0)
|
|
24
|
-
}), void 0), jsx("a", Object.assign({
|
|
25
|
-
href: homeUrl,
|
|
26
|
-
className: classNames(styles.link, textCn('rs-h3'))
|
|
27
|
-
}, {
|
|
28
|
-
children: homeTitle
|
|
29
|
-
}), void 0)]
|
|
30
|
-
}), void 0);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { LogoSmall };
|