@reykjavik/hanna-react 0.10.134 → 0.10.135
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/CHANGELOG.md +6 -0
- package/MainMenu2.d.ts +2 -0
- package/MainMenu2.js +5 -2
- package/esm/MainMenu2.d.ts +2 -0
- package/esm/MainMenu2.js +5 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/MainMenu2.d.ts
CHANGED
|
@@ -101,6 +101,8 @@ export type MainMenu2Props = {
|
|
|
101
101
|
relatedTitle?: string;
|
|
102
102
|
related?: MainMenu2ButtonItemList;
|
|
103
103
|
};
|
|
104
|
+
/** Visual type */
|
|
105
|
+
variant?: 'default' | 'light';
|
|
104
106
|
/**
|
|
105
107
|
* NOTE: Clicking a MainMenu2 item will automatically close HannaUIState's
|
|
106
108
|
* "Hamburger menu" (a.k.a. "Mobile menu")
|
package/MainMenu2.js
CHANGED
|
@@ -117,7 +117,7 @@ const getRenderers = (props) => {
|
|
|
117
117
|
};
|
|
118
118
|
// eslint-disable-next-line complexity
|
|
119
119
|
const MainMenu2 = (props) => {
|
|
120
|
-
const { homeLink = '/', items, onItemClick, illustration, imageUrl, wrapperProps = {}, } = props;
|
|
120
|
+
const { homeLink = '/', items, onItemClick, illustration, imageUrl, variant, wrapperProps = {}, } = props;
|
|
121
121
|
const domid = (0, utils_js_1.useDomid)(wrapperProps.id);
|
|
122
122
|
const isBrowser = (0, utils_js_1.useIsBrowserSide)(props.ssr);
|
|
123
123
|
const [isMenuOpen, setIsMenuOpen] = (0, react_1.useState)(false);
|
|
@@ -198,7 +198,10 @@ const MainMenu2 = (props) => {
|
|
|
198
198
|
: homeLink)), { modifier: 'home' });
|
|
199
199
|
const menuImageUrl = imageUrl || (illustration && (0, assets_1.getIllustrationUrl)(illustration));
|
|
200
200
|
const menuId = `${domid}-menu`;
|
|
201
|
-
return (react_1.default.createElement("nav", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('MainMenu2',
|
|
201
|
+
return (react_1.default.createElement("nav", Object.assign({}, props.wrapperProps, { className: (0, classUtils_1.modifiedClass)('MainMenu2', [
|
|
202
|
+
isBrowser && (isMenuOpen ? 'open' : 'closed'),
|
|
203
|
+
variant && variant !== 'default' ? `variant--${variant}` : undefined,
|
|
204
|
+
], wrapperProps.className), style: menuImageUrl
|
|
202
205
|
? Object.assign(Object.assign({}, wrapperProps.style), { '--menu-image': `url(${menuImageUrl})` })
|
|
203
206
|
: wrapperProps.style, ref: wrapperRef, "aria-label": txt.title, "data-sprinkled": isBrowser, id: menuId }),
|
|
204
207
|
isMenuOpen && react_1.default.createElement(FocusTrap_js_1.FocusTrap, { atTop: true }),
|
package/esm/MainMenu2.d.ts
CHANGED
|
@@ -101,6 +101,8 @@ export type MainMenu2Props = {
|
|
|
101
101
|
relatedTitle?: string;
|
|
102
102
|
related?: MainMenu2ButtonItemList;
|
|
103
103
|
};
|
|
104
|
+
/** Visual type */
|
|
105
|
+
variant?: 'default' | 'light';
|
|
104
106
|
/**
|
|
105
107
|
* NOTE: Clicking a MainMenu2 item will automatically close HannaUIState's
|
|
106
108
|
* "Hamburger menu" (a.k.a. "Mobile menu")
|
package/esm/MainMenu2.js
CHANGED
|
@@ -113,7 +113,7 @@ const getRenderers = (props) => {
|
|
|
113
113
|
};
|
|
114
114
|
// eslint-disable-next-line complexity
|
|
115
115
|
export const MainMenu2 = (props) => {
|
|
116
|
-
const { homeLink = '/', items, onItemClick, illustration, imageUrl, wrapperProps = {}, } = props;
|
|
116
|
+
const { homeLink = '/', items, onItemClick, illustration, imageUrl, variant, wrapperProps = {}, } = props;
|
|
117
117
|
const domid = useDomid(wrapperProps.id);
|
|
118
118
|
const isBrowser = useIsBrowserSide(props.ssr);
|
|
119
119
|
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
@@ -194,7 +194,10 @@ export const MainMenu2 = (props) => {
|
|
|
194
194
|
: homeLink)), { modifier: 'home' });
|
|
195
195
|
const menuImageUrl = imageUrl || (illustration && getIllustrationUrl(illustration));
|
|
196
196
|
const menuId = `${domid}-menu`;
|
|
197
|
-
return (React.createElement("nav", Object.assign({}, props.wrapperProps, { className: modifiedClass('MainMenu2',
|
|
197
|
+
return (React.createElement("nav", Object.assign({}, props.wrapperProps, { className: modifiedClass('MainMenu2', [
|
|
198
|
+
isBrowser && (isMenuOpen ? 'open' : 'closed'),
|
|
199
|
+
variant && variant !== 'default' ? `variant--${variant}` : undefined,
|
|
200
|
+
], wrapperProps.className), style: menuImageUrl
|
|
198
201
|
? Object.assign(Object.assign({}, wrapperProps.style), { '--menu-image': `url(${menuImageUrl})` })
|
|
199
202
|
: wrapperProps.style, ref: wrapperRef, "aria-label": txt.title, "data-sprinkled": isBrowser, id: menuId }),
|
|
200
203
|
isMenuOpen && React.createElement(FocusTrap, { atTop: true }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reykjavik/hanna-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.135",
|
|
4
4
|
"author": "Reykjavík (http://www.reykjavik.is)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Hugsmiðjan ehf (http://www.hugsmidjan.is)",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@hugsmidjan/qj": "^4.22.1",
|
|
19
19
|
"@hugsmidjan/react": "^0.4.32",
|
|
20
20
|
"@reykjavik/hanna-css": "^0.4.14",
|
|
21
|
-
"@reykjavik/hanna-utils": "^0.2.
|
|
21
|
+
"@reykjavik/hanna-utils": "^0.2.16",
|
|
22
22
|
"@types/react-autosuggest": "^10.1.0",
|
|
23
23
|
"@types/react-datepicker": "^4.8.0",
|
|
24
24
|
"@types/react-transition-group": "^4.4.0",
|