mautourco-components 0.2.123 → 0.2.124
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/dist/components/organisms/TabServiceDetails/DetailsContentAccom.js +2 -2
- package/dist/components/organisms/TabServiceDetails/TabServiceDetailsLayout/TabServiceDetailsLayout.js +2 -2
- package/dist/components/organisms/TopNavigation/TopNavigation.d.ts +1 -1
- package/dist/components/organisms/TopNavigation/TopNavigation.js +4 -4
- package/dist/hooks/useMobile.d.ts +6 -1
- package/dist/hooks/useMobile.js +11 -5
- package/package.json +1 -1
- package/src/components/organisms/TabServiceDetails/DetailsContentAccom.tsx +2 -2
- package/src/components/organisms/TabServiceDetails/TabServiceDetailsLayout/TabServiceDetailsLayout.tsx +2 -2
- package/src/components/organisms/TopNavigation/TopNavigation.tsx +5 -5
|
@@ -21,7 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { useMobile } from '../../../hooks/useMobile';
|
|
24
|
+
import { Breakpoint, useMobile } from '../../../hooks/useMobile';
|
|
25
25
|
import CardServiceAccom from '../../atoms/CardServiceAccom/CardServiceAccom';
|
|
26
26
|
import Chip from '../../atoms/Chip/Chip';
|
|
27
27
|
import { Text } from '../../atoms/Typography/Typography';
|
|
@@ -59,7 +59,7 @@ function DetailsContentAccomBody(props) {
|
|
|
59
59
|
*/
|
|
60
60
|
export function DetailsContentAccom(props) {
|
|
61
61
|
var roomTitle = props.roomTitle, roomDescription = props.roomDescription, rest = __rest(props, ["roomTitle", "roomDescription"]);
|
|
62
|
-
var isMobile = useMobile(
|
|
62
|
+
var isMobile = useMobile(Breakpoint.LG).isMobile;
|
|
63
63
|
return (_jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "space-y-4", children: [_jsx(TextWithBorderBottom, { variant: "bold", size: "xl", children: roomTitle }), _jsx(Text, { variant: "medium", leading: "5", children: roomDescription })] }), !isMobile && _jsx(DetailsContentAccomBody, __assign({}, rest))] }));
|
|
64
64
|
}
|
|
65
65
|
DetailsContentAccom.Body = DetailsContentAccomBody;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMobile } from '../../../../hooks/useMobile';
|
|
2
|
+
import { Breakpoint, useMobile } from '../../../../hooks/useMobile';
|
|
3
3
|
import { cn } from '../../../../lib/utils';
|
|
4
4
|
import Chip from '../../../atoms/Chip/Chip';
|
|
5
5
|
import TextWithIcon from '../../../molecules/TextWithIcon/TextWithIcon';
|
|
@@ -23,6 +23,6 @@ import './TabServiceDetailsLayout.css';
|
|
|
23
23
|
*/
|
|
24
24
|
export default function TabServiceDetailsLayout(props) {
|
|
25
25
|
var title = props.title, icon = props.icon, isOnRequest = props.isOnRequest, children = props.children, images = props.images, mobileContent = props.mobileContent;
|
|
26
|
-
var isMobile = useMobile(
|
|
26
|
+
var isMobile = useMobile(Breakpoint.LG).isMobile;
|
|
27
27
|
return (_jsxs("div", { children: [_jsxs("div", { className: "details-service__layout", children: [_jsxs(TextWithIcon, { icon: icon, color: isOnRequest ? 'yellow' : 'accent', textVariant: "bold", children: [title, isOnRequest && _jsx(Chip, { color: "yellow", children: "On request" })] }), _jsxs("div", { className: "details-service__layout-flex", children: [_jsxs("div", { className: "details-service__layout-flex-images", children: [images[0] && (_jsx("figure", { className: cn(images.length === 1 && 'single-image'), children: _jsx("img", { src: images[0], alt: title, width: 400, height: 400 }) }, images[0])), images.length > 1 && (_jsx("div", { className: "details-service__layout-flex-images-grid", children: images.slice(1, 3).map(function (image) { return (_jsx("figure", { children: _jsx("img", { src: image, alt: title, width: 400, height: 400 }) }, image)); }) }))] }), _jsx("div", { className: "details-service__layout-content", children: _jsx("div", { className: "details-service__layout-content-body", children: children }) })] })] }), isMobile && mobileContent] }));
|
|
28
28
|
}
|
|
@@ -10,11 +10,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { useMobile } from
|
|
14
|
-
import
|
|
15
|
-
import
|
|
13
|
+
import { Breakpoint, useMobile } from '../../../hooks/useMobile';
|
|
14
|
+
import { DesktopNav } from './DesktopNav';
|
|
15
|
+
import MobileNav from './MobileNav';
|
|
16
16
|
export var TopNavigation = function (props) {
|
|
17
|
-
var _a = useMobile(), isMobile = _a.isMobile, isTablet = _a.isTablet;
|
|
17
|
+
var _a = useMobile(Breakpoint.LG), isMobile = _a.isMobile, isTablet = _a.isTablet;
|
|
18
18
|
var isSmallScreen = isMobile || isTablet;
|
|
19
19
|
return isSmallScreen ? _jsx(MobileNav, __assign({}, props)) : _jsx(DesktopNav, __assign({}, props));
|
|
20
20
|
};
|
package/dist/hooks/useMobile.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
export var Breakpoint;
|
|
3
|
+
(function (Breakpoint) {
|
|
4
|
+
Breakpoint[Breakpoint["SM"] = 768] = "SM";
|
|
5
|
+
Breakpoint[Breakpoint["MD"] = 1024] = "MD";
|
|
6
|
+
Breakpoint[Breakpoint["LG"] = 1280] = "LG";
|
|
7
|
+
})(Breakpoint || (Breakpoint = {}));
|
|
2
8
|
export function useMobile(breakpoint) {
|
|
3
|
-
if (breakpoint === void 0) { breakpoint =
|
|
9
|
+
if (breakpoint === void 0) { breakpoint = Breakpoint.SM; }
|
|
4
10
|
var _a = useState(false), isMobile = _a[0], setIsMobile = _a[1];
|
|
5
11
|
var _b = useState(false), isTablet = _b[0], setIsTablet = _b[1];
|
|
6
12
|
var _c = useState(false), isDesktop = _c[0], setIsDesktop = _c[1];
|
|
7
13
|
useEffect(function () {
|
|
8
|
-
var userAgent = typeof window.navigator ===
|
|
14
|
+
var userAgent = typeof window.navigator === 'undefined' ? '' : navigator.userAgent;
|
|
9
15
|
var mobileRegex = /Android|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i;
|
|
10
16
|
var tabletRegex = /iPad|Tablet|PlayBook|Nexus 7|Nexus 10/i;
|
|
11
17
|
var isUserAgentMobile = mobileRegex.test(userAgent);
|
|
@@ -19,8 +25,8 @@ export function useMobile(breakpoint) {
|
|
|
19
25
|
setIsDesktop(!isUserAgentMobile && !isUserAgentTablet && width >= 1024);
|
|
20
26
|
};
|
|
21
27
|
handleResize();
|
|
22
|
-
window.addEventListener(
|
|
23
|
-
return function () { return window.removeEventListener(
|
|
28
|
+
window.addEventListener('resize', handleResize);
|
|
29
|
+
return function () { return window.removeEventListener('resize', handleResize); };
|
|
24
30
|
}, [breakpoint]);
|
|
25
31
|
return { isMobile: isMobile, isTablet: isTablet, isDesktop: isDesktop };
|
|
26
32
|
}
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMobile } from '@/src/hooks/useMobile';
|
|
1
|
+
import { Breakpoint, useMobile } from '@/src/hooks/useMobile';
|
|
2
2
|
import CardServiceAccom from '../../atoms/CardServiceAccom/CardServiceAccom';
|
|
3
3
|
import Chip from '../../atoms/Chip/Chip';
|
|
4
4
|
import { Text } from '../../atoms/Typography/Typography';
|
|
@@ -104,7 +104,7 @@ function DetailsContentAccomBody(
|
|
|
104
104
|
export function DetailsContentAccom(props: DetailsContentAccomProps) {
|
|
105
105
|
const { roomTitle, roomDescription, ...rest } = props;
|
|
106
106
|
|
|
107
|
-
const { isMobile } = useMobile(
|
|
107
|
+
const { isMobile } = useMobile(Breakpoint.LG);
|
|
108
108
|
|
|
109
109
|
return (
|
|
110
110
|
<div className="space-y-6">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMobile } from '@/src/hooks/useMobile';
|
|
1
|
+
import { Breakpoint, useMobile } from '@/src/hooks/useMobile';
|
|
2
2
|
import { cn } from '@/src/lib/utils';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import Chip from '../../../atoms/Chip/Chip';
|
|
@@ -40,7 +40,7 @@ export interface TabServiceDetailsLayoutProps {
|
|
|
40
40
|
*/
|
|
41
41
|
export default function TabServiceDetailsLayout(props: TabServiceDetailsLayoutProps) {
|
|
42
42
|
const { title, icon, isOnRequest, children, images, mobileContent } = props;
|
|
43
|
-
const { isMobile } = useMobile(
|
|
43
|
+
const { isMobile } = useMobile(Breakpoint.LG);
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
46
|
<div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { useMobile } from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Breakpoint, useMobile } from '../../../hooks/useMobile';
|
|
3
|
+
import { DesktopNav } from './DesktopNav';
|
|
4
|
+
import MobileNav from './MobileNav';
|
|
5
5
|
|
|
6
6
|
type Link = {
|
|
7
7
|
label: string;
|
|
@@ -38,7 +38,7 @@ export interface TopNavigationProps {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
export const TopNavigation: React.FC<TopNavigationProps> = (props) => {
|
|
41
|
-
const { isMobile, isTablet } = useMobile();
|
|
41
|
+
const { isMobile, isTablet } = useMobile(Breakpoint.LG);
|
|
42
42
|
const isSmallScreen = isMobile || isTablet;
|
|
43
43
|
|
|
44
44
|
return isSmallScreen ? <MobileNav {...props} /> : <DesktopNav {...props} />;
|