@sok-brand-sites/common-frontend-components 0.0.1-security → 1.643.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @sok-brand-sites/common-frontend-components might be problematic. Click here for more details.
- package/LICENSE +21 -0
- package/README.md +31 -3
- package/dist/_virtual/_tslib.js +234 -0
- package/dist/assets/icons/Icons.js +118 -0
- package/dist/assets/logos/logos.js +19 -0
- package/dist/components/Accordion/Accordion.js +36 -0
- package/dist/components/Accordion/Accordion.styles.js +75 -0
- package/dist/components/AnimationWrapper/AnimationWrapper.js +35 -0
- package/dist/components/AnimationWrapper/AnimationWrapper.styles.js +26 -0
- package/dist/components/BlockGenerator/BlockContent.js +139 -0
- package/dist/components/BlockGenerator/BlockGenerator.js +62 -0
- package/dist/components/BlockGenerator/BlockGenerator.styles.js +44 -0
- package/dist/components/Button/Button.js +49 -0
- package/dist/components/Button/Button.styles.js +46 -0
- package/dist/components/Card/Card.js +79 -0
- package/dist/components/Card/Card.styles.js +137 -0
- package/dist/components/Carousel/Carousel.js +153 -0
- package/dist/components/Carousel/Carousel.styles.js +261 -0
- package/dist/components/CarouselNarrow/CarouselNarrow.js +120 -0
- package/dist/components/CarouselNarrow/CarouselNarrow.styles.js +281 -0
- package/dist/components/Column/Column.js +31 -0
- package/dist/components/Column/Column.styles.js +34 -0
- package/dist/components/Columns/Columns.js +38 -0
- package/dist/components/Columns/Columns.styles.js +21 -0
- package/dist/components/Embed/Embed.js +54 -0
- package/dist/components/Embed/Embed.styles.js +12 -0
- package/dist/components/Footer/Footer.js +63 -0
- package/dist/components/Footer/Footer.styles.js +67 -0
- package/dist/components/FormBuilder/FormBuilder.js +364 -0
- package/dist/components/FormBuilder/FormBuilder.styles.js +224 -0
- package/dist/components/FormBuilder/FormBuilderCheckboxes.js +39 -0
- package/dist/components/FormBuilder/FormBuilderInput.js +29 -0
- package/dist/components/FormBuilder/FormBuilderParagraph.js +15 -0
- package/dist/components/FormBuilder/FormBuilderSelect.js +39 -0
- package/dist/components/FormBuilder/FormBuilderTextAreaInput.js +29 -0
- package/dist/components/FormBuilder/utiles.js +13 -0
- package/dist/components/FullBgHero/FullBgHero.js +93 -0
- package/dist/components/FullBgHero/FullBgHero.styles.js +180 -0
- package/dist/components/GlobalStyle/GlobalStyle.js +285 -0
- package/dist/components/Header/Header.js +290 -0
- package/dist/components/Header/Header.styles.js +314 -0
- package/dist/components/Heading/Heading.js +29 -0
- package/dist/components/Heading/Heading.styles.js +21 -0
- package/dist/components/Hero/Hero.js +76 -0
- package/dist/components/Hero/Hero.styles.js +128 -0
- package/dist/components/IconLinks/IconLinks.js +118 -0
- package/dist/components/IconLinks/IconLinks.styles.js +259 -0
- package/dist/components/ImageCarousel/ImageCarousel.js +102 -0
- package/dist/components/ImageCarousel/ImageCarousel.styles.js +96 -0
- package/dist/components/LanguageSelector/LanguageSelector.js +72 -0
- package/dist/components/LanguageSelector/LanguageSelector.styles.js +72 -0
- package/dist/components/Layout/Layout.js +15 -0
- package/dist/components/Layout/Layout.styles.js +8 -0
- package/dist/components/List/List.js +25 -0
- package/dist/components/List/List.styles.js +11 -0
- package/dist/components/MarginWrapper/MarginWrapper.js +17 -0
- package/dist/components/MarginWrapper/MarginWrapper.styles.js +38 -0
- package/dist/components/OverlayCards/OverlayCard/OverlayCard.js +132 -0
- package/dist/components/OverlayCards/OverlayCard/OverlayCard.styles.js +133 -0
- package/dist/components/OverlayCards/OverlayCards.js +46 -0
- package/dist/components/OverlayCards/OverlayCards.styles.js +14 -0
- package/dist/components/OverlayCards/OverlayCards.types.js +9 -0
- package/dist/components/Paragraph/Paragraph.js +29 -0
- package/dist/components/Paragraph/Paragraph.styles.js +14 -0
- package/dist/components/PlaceOfBusiness/ContactInformation/ContactInformation.js +45 -0
- package/dist/components/PlaceOfBusiness/ContactInformation/ContactInformation.styles.js +37 -0
- package/dist/components/PlaceOfBusiness/LogoTitle/LogoTitle.js +16 -0
- package/dist/components/PlaceOfBusiness/LogoTitle/LogoTitle.styles.js +44 -0
- package/dist/components/PlaceOfBusiness/OpenToday/OpenToday.js +43 -0
- package/dist/components/PlaceOfBusiness/OpenToday/OpenToday.styles.js +63 -0
- package/dist/components/PlaceOfBusiness/OpeningHours/OpeningHours.js +77 -0
- package/dist/components/PlaceOfBusiness/OpeningHours/OpeningHours.styles.js +68 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessInfo/PlaceOfBusinessInfo.js +125 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessInfo/PlaceOfBusinessInfo.styles.js +32 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessListItem/PlaceOfBusinessListItem.js +85 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessListItem/PlaceOfBusinessListItem.styles.js +134 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessSearch/PlaceOfBusinessSearch.js +142 -0
- package/dist/components/PlaceOfBusiness/PlaceOfBusinessSearch/PlaceOfBusinessSearch.styles.js +43 -0
- package/dist/components/PlaceOfBusiness/Services/Services.js +30 -0
- package/dist/components/PlaceOfBusiness/Services/Services.styles.js +61 -0
- package/dist/components/PlaceOfBusiness/utils.js +177 -0
- package/dist/components/Promotion/Promotion.js +66 -0
- package/dist/components/Promotion/Promotion.styles.js +124 -0
- package/dist/components/RestrictedWidthContainer/RestrictedWidthContainer.js +63 -0
- package/dist/components/Seo/Seo.js +58 -0
- package/dist/components/SideBySide/SideBySide.js +81 -0
- package/dist/components/SideBySide/SideBySide.styles.js +179 -0
- package/dist/components/SocialMediaLinks/SocialMediaLinks.js +28 -0
- package/dist/components/SocialMediaLinks/SocialMediaLinks.styles.js +22 -0
- package/dist/components/SubHero/SubHero.js +22 -0
- package/dist/components/SubHero/SubHero.styles.js +52 -0
- package/dist/components/Table/Table.js +23 -0
- package/dist/components/Table/Table.styles.js +121 -0
- package/dist/components/Table/WpTable.styles.js +5 -0
- package/dist/components/constants.js +34 -0
- package/dist/components/utils.js +160 -0
- package/dist/fonts/Agrandir/Agrandir-Bold.woff.js +2 -0
- package/dist/fonts/Agrandir/Agrandir-Bold.woff2.js +2 -0
- package/dist/fonts/Agrandir/Agrandir-Light.woff.js +2 -0
- package/dist/fonts/Agrandir/Agrandir-Light.woff2.js +2 -0
- package/dist/fonts/Agrandir/index.js +16 -0
- package/dist/fonts/Brule/Brule-Bold.woff.js +2 -0
- package/dist/fonts/Brule/Brule-Bold.woff2.js +2 -0
- package/dist/fonts/Brule/Brule-Medium.woff.js +2 -0
- package/dist/fonts/Brule/Brule-Medium.woff2.js +2 -0
- package/dist/fonts/Brule/Brule-Regular.woff.js +2 -0
- package/dist/fonts/Brule/Brule-Regular.woff2.js +2 -0
- package/dist/fonts/Brule/index.js +18 -0
- package/dist/fonts/Domaine/Domaine-Text-Medium.woff.js +2 -0
- package/dist/fonts/Domaine/Domaine-Text-Medium.woff2.js +2 -0
- package/dist/fonts/Domaine/index.js +14 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-Bk.woff.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-Bk.woff2.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-DmCn.woff.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-DmCn.woff2.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-MdCn.woff.js +2 -0
- package/dist/fonts/FranklinGothic/FranklinGothic-LT-Com-MdCn.woff2.js +2 -0
- package/dist/fonts/FranklinGothic/index.js +18 -0
- package/dist/fonts/MinionPro/MinionPro-Regular.woff.js +2 -0
- package/dist/fonts/MinionPro/MinionPro-Regular.woff2.js +2 -0
- package/dist/fonts/MinionPro/index.js +14 -0
- package/dist/fonts/Montserrat/Montserrat-Bold.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Bold.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-BoldItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-BoldItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBold.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBold.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBoldItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-ExtraBoldItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Italic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Italic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Light.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Light.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-LightItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-LightItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Medium.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Medium.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-MediumItalic.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-MediumItalic.woff2.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Regular.woff.js +2 -0
- package/dist/fonts/Montserrat/Montserrat-Regular.woff2.js +2 -0
- package/dist/fonts/Montserrat/index.js +90 -0
- package/dist/fonts/SBonus/SBonusUX-BoldItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-BoldItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-ExtraboldItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-ExtraboldItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-LightItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-LightItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-MediumItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-MediumItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-RegularItalic.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUX-RegularItalic.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Bold.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Bold.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Extrabold.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Extrabold.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Light.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Light.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Medium.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Medium.woff2.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Regular.woff.js +2 -0
- package/dist/fonts/SBonus/SBonusUXWEB-Regular.woff2.js +2 -0
- package/dist/fonts/SBonus/index.js +95 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Bold.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Bold.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Light.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Light.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Medium.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Medium.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Regular.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-Regular.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-SemiBold.woff.js +2 -0
- package/dist/fonts/SBonusDisplay/SBonusDisplay-SemiBold.woff2.js +2 -0
- package/dist/fonts/SBonusDisplay/index.js +22 -0
- package/dist/fonts/SuomiGrumpy/SuomiGrumpy-Black.woff.js +2 -0
- package/dist/fonts/SuomiGrumpy/SuomiGrumpy-Black.woff2.js +2 -0
- package/dist/fonts/SuomiGrumpy/index.js +14 -0
- package/dist/fonts/utils.js +5 -0
- package/dist/hooks/useElementRect.js +65 -0
- package/dist/hooks/windowsize.js +31 -0
- package/dist/locales/constants.js +6 -0
- package/dist/locales/translations.json.js +153 -0
- package/dist/styles/media.js +40 -0
- package/dist/themes/neutral/breakpoints.js +11 -0
- package/dist/themes/neutral/colors.js +3 -0
- package/dist/themes/neutral/components.js +940 -0
- package/dist/themes/neutral/fonts.js +7 -0
- package/dist/themes/neutral/index.js +10 -0
- package/dist/themes/neutral/spacings.js +21 -0
- package/dist/themes/ravintolakonseptit/breakpoints.js +11 -0
- package/dist/themes/ravintolakonseptit/colors.js +17 -0
- package/dist/themes/ravintolakonseptit/components.js +936 -0
- package/dist/themes/ravintolakonseptit/fonts.js +5 -0
- package/dist/themes/ravintolakonseptit/index.js +10 -0
- package/dist/themes/ravintolakonseptit/spacings.js +21 -0
- package/dist/themes/sokos/breakpoints.js +11 -0
- package/dist/themes/sokos/colors.js +3 -0
- package/dist/themes/sokos/components.js +936 -0
- package/dist/themes/sokos/index.js +10 -0
- package/dist/themes/sokospalvelut/breakpoints.js +11 -0
- package/dist/themes/sokospalvelut/colors.js +3 -0
- package/dist/themes/sokospalvelut/components.js +936 -0
- package/dist/themes/sokospalvelut/fonts.js +11 -0
- package/dist/themes/sokospalvelut/index.js +10 -0
- package/dist/themes/theme.types.js +12 -0
- package/dist/themes/tykkimakiresort/colors.js +35 -0
- package/dist/themes/tykkimakiresort/components.js +936 -0
- package/dist/themes/tykkimakiresort/fonts.js +7 -0
- package/dist/themes/tykkimakiresort/index.js +10 -0
- package/package.json +33 -3
- package/scripts/build.js +132 -0
@@ -0,0 +1,68 @@
|
|
1
|
+
import { __makeTemplateObject } from '../../../_virtual/_tslib.js';
|
2
|
+
import styled, { css } from 'styled-components';
|
3
|
+
var OpeningHoursContainer = styled.div.withConfig({
|
4
|
+
displayName: "OpeningHoursstyles__OpeningHoursContainer",
|
5
|
+
componentId: "sc-9qb51m-0"
|
6
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n row-gap: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n row-gap: ", ";\n"])), function (_a) {
|
7
|
+
var theme = _a.theme;
|
8
|
+
return theme.spacings.spacing20;
|
9
|
+
});
|
10
|
+
var ButtonsContainer = styled.div.withConfig({
|
11
|
+
displayName: "OpeningHoursstyles__ButtonsContainer",
|
12
|
+
componentId: "sc-9qb51m-1"
|
13
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n column-gap: ", ";\n"], ["\n display: flex;\n flex-direction: row;\n column-gap: ", ";\n"])), function (_a) {
|
14
|
+
var theme = _a.theme;
|
15
|
+
return theme.spacings.spacing12;
|
16
|
+
});
|
17
|
+
var Button = styled.button.withConfig({
|
18
|
+
displayName: "OpeningHoursstyles__Button",
|
19
|
+
componentId: "sc-9qb51m-2"
|
20
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border: none;\n background: transparent;\n cursor: pointer;\n\n color: ", ";\n :hover {\n color: ", ";\n }\n\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n ", "\n"], ["\n border: none;\n background: transparent;\n cursor: pointer;\n\n color: ", ";\n :hover {\n color: ", ";\n }\n\n font-family: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: ", ";\n\n ", "\n"])), function (_a) {
|
21
|
+
var theme = _a.theme;
|
22
|
+
return theme.components.placeOfBusiness.openingHours.button.textColor;
|
23
|
+
}, function (_a) {
|
24
|
+
var theme = _a.theme;
|
25
|
+
return theme.components.placeOfBusiness.openingHours.button.hoverColor;
|
26
|
+
}, function (_a) {
|
27
|
+
var theme = _a.theme;
|
28
|
+
return theme.components.placeOfBusiness.openingHours.button.fontFamily;
|
29
|
+
}, function (_a) {
|
30
|
+
var theme = _a.theme;
|
31
|
+
return theme.components.placeOfBusiness.openingHours.button.fontWeight;
|
32
|
+
}, function (_a) {
|
33
|
+
var theme = _a.theme;
|
34
|
+
return theme.components.placeOfBusiness.openingHours.button.fontSizes.mobile.fontSize;
|
35
|
+
}, function (_a) {
|
36
|
+
var theme = _a.theme;
|
37
|
+
return theme.components.placeOfBusiness.openingHours.button.fontSizes.mobile.lineHeight;
|
38
|
+
}, function (_a) {
|
39
|
+
var active = _a.active;
|
40
|
+
return active && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n color: ", ";\n\n :hover {\n color: ", ";\n }\n cursor: unset;\n "], ["\n color: ", ";\n\n :hover {\n color: ", ";\n }\n cursor: unset;\n "])), function (_a) {
|
41
|
+
var theme = _a.theme;
|
42
|
+
return theme.components.placeOfBusiness.openingHours.button.activeColor;
|
43
|
+
}, function (_a) {
|
44
|
+
var theme = _a.theme;
|
45
|
+
return theme.components.placeOfBusiness.openingHours.button.activeColor;
|
46
|
+
});
|
47
|
+
});
|
48
|
+
var OpeningHoursList = styled.dl.withConfig({
|
49
|
+
displayName: "OpeningHoursstyles__OpeningHoursList",
|
50
|
+
componentId: "sc-9qb51m-3"
|
51
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n width: 300px;\n margin: 0;\n"], ["\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n width: 300px;\n margin: 0;\n"])), function (_a) {
|
52
|
+
var theme = _a.theme;
|
53
|
+
return theme.spacings.spacing8;
|
54
|
+
});
|
55
|
+
var HoursRow = styled.div.withConfig({
|
56
|
+
displayName: "OpeningHoursstyles__HoursRow",
|
57
|
+
componentId: "sc-9qb51m-4"
|
58
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n"], ["\n display: flex;\n flex-direction: row;\n"])));
|
59
|
+
var Day = styled.dt.withConfig({
|
60
|
+
displayName: "OpeningHoursstyles__Day",
|
61
|
+
componentId: "sc-9qb51m-5"
|
62
|
+
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n flex-basis: 20%;\n"], ["\n display: flex;\n flex-basis: 20%;\n"])));
|
63
|
+
var Hours = styled.dd.withConfig({
|
64
|
+
displayName: "OpeningHoursstyles__Hours",
|
65
|
+
componentId: "sc-9qb51m-6"
|
66
|
+
})(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n margin-inline-start: 0;\n display: flex;\n flex-direction: column;\n"], ["\n margin-inline-start: 0;\n display: flex;\n flex-direction: column;\n"])));
|
67
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
|
68
|
+
export { Button, ButtonsContainer, Day, Hours, HoursRow, OpeningHoursContainer, OpeningHoursList };
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import { __read, __awaiter, __generator } from '../../../_virtual/_tslib.js';
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
3
|
+
import { useState, useEffect } from 'react';
|
4
|
+
import { PlaceOfBusinessInfoContainer, FlexContainer, FlexColumnContainer } from './PlaceOfBusinessInfo.styles.js';
|
5
|
+
import OpenToday from '../OpenToday/OpenToday.js';
|
6
|
+
import LogoTitle from '../LogoTitle/LogoTitle.js';
|
7
|
+
import OpeningHours from '../OpeningHours/OpeningHours.js';
|
8
|
+
import ContactInformation from '../ContactInformation/ContactInformation.js';
|
9
|
+
import SocialMediaLinks from '../../SocialMediaLinks/SocialMediaLinks.js';
|
10
|
+
import Services from '../Services/Services.js';
|
11
|
+
import translationJSON from '../../../locales/translations.json.js';
|
12
|
+
import axios from 'axios';
|
13
|
+
|
14
|
+
var PlaceOfBusinessInfo = function PlaceOfBusinessInfo(_a) {
|
15
|
+
var _b, _c;
|
16
|
+
|
17
|
+
var laariId = _a.laariId,
|
18
|
+
endpoint = _a.endpoint,
|
19
|
+
lang = _a.lang;
|
20
|
+
|
21
|
+
var _d = __read(useState(), 2),
|
22
|
+
data = _d[0],
|
23
|
+
setData = _d[1];
|
24
|
+
|
25
|
+
var _e = __read(useState(true), 2),
|
26
|
+
loading = _e[0],
|
27
|
+
setLoading = _e[1];
|
28
|
+
|
29
|
+
var _f = __read(useState(false), 2),
|
30
|
+
error = _f[0],
|
31
|
+
setError = _f[1];
|
32
|
+
|
33
|
+
useEffect(function () {
|
34
|
+
var fetchData = function fetchData() {
|
35
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
36
|
+
var response;
|
37
|
+
return __generator(this, function (_a) {
|
38
|
+
switch (_a.label) {
|
39
|
+
case 0:
|
40
|
+
_a.trys.push([0, 2,, 3]);
|
41
|
+
|
42
|
+
return [4
|
43
|
+
/*yield*/
|
44
|
+
, axios.get(endpoint + "/pobs/" + laariId + "?lang=" + lang.toLowerCase())];
|
45
|
+
|
46
|
+
case 1:
|
47
|
+
response = _a.sent();
|
48
|
+
|
49
|
+
if (response === null || response === void 0 ? void 0 : response.data) {
|
50
|
+
setData(response.data);
|
51
|
+
setLoading(false);
|
52
|
+
} else {
|
53
|
+
setError(true);
|
54
|
+
}
|
55
|
+
|
56
|
+
return [3
|
57
|
+
/*break*/
|
58
|
+
, 3];
|
59
|
+
|
60
|
+
case 2:
|
61
|
+
_a.sent();
|
62
|
+
|
63
|
+
setError(true);
|
64
|
+
return [3
|
65
|
+
/*break*/
|
66
|
+
, 3];
|
67
|
+
|
68
|
+
case 3:
|
69
|
+
return [2
|
70
|
+
/*return*/
|
71
|
+
];
|
72
|
+
}
|
73
|
+
});
|
74
|
+
});
|
75
|
+
};
|
76
|
+
|
77
|
+
fetchData();
|
78
|
+
}, []);
|
79
|
+
var socialMediaLinks = (_b = data === null || data === void 0 ? void 0 : data.links) === null || _b === void 0 ? void 0 : _b.reduce(function (obj, link) {
|
80
|
+
if (link.category === 'SOME') {
|
81
|
+
// @ts-ignore
|
82
|
+
obj[link.type] = link.url;
|
83
|
+
}
|
84
|
+
|
85
|
+
return obj;
|
86
|
+
}, {});
|
87
|
+
return jsxs(Fragment, {
|
88
|
+
children: [error && jsx("p", {
|
89
|
+
children: translationJSON.placeOfBusiness.error[lang]
|
90
|
+
}, void 0), !loading && !error && jsxs(PlaceOfBusinessInfoContainer, {
|
91
|
+
children: [jsx(LogoTitle, {
|
92
|
+
name: data === null || data === void 0 ? void 0 : data.name,
|
93
|
+
logoUrl: (_c = data === null || data === void 0 ? void 0 : data.media) === null || _c === void 0 ? void 0 : _c.logoCircle.svg
|
94
|
+
}, void 0), jsxs(FlexContainer, {
|
95
|
+
children: [(data === null || data === void 0 ? void 0 : data.weeklyOpeningTimes) && jsxs(FlexColumnContainer, {
|
96
|
+
children: [jsx(OpenToday, {
|
97
|
+
weeklyOpeningTimes: data === null || data === void 0 ? void 0 : data.weeklyOpeningTimes,
|
98
|
+
lang: lang,
|
99
|
+
large: true
|
100
|
+
}, void 0), jsx(OpeningHours, {
|
101
|
+
weeklyOpeningTimes: data === null || data === void 0 ? void 0 : data.weeklyOpeningTimes,
|
102
|
+
lang: lang
|
103
|
+
}, void 0)]
|
104
|
+
}, void 0), jsxs(FlexColumnContainer, {
|
105
|
+
children: [jsx(ContactInformation, {
|
106
|
+
location: data === null || data === void 0 ? void 0 : data.location,
|
107
|
+
contactInfo: data === null || data === void 0 ? void 0 : data.contactInfo,
|
108
|
+
website: data === null || data === void 0 ? void 0 : data.website,
|
109
|
+
lang: lang
|
110
|
+
}, void 0), socialMediaLinks && jsx(SocialMediaLinks, {
|
111
|
+
socialMediaLinks: socialMediaLinks,
|
112
|
+
defaultColors: true
|
113
|
+
}, void 0)]
|
114
|
+
}, void 0)]
|
115
|
+
}, void 0), (data === null || data === void 0 ? void 0 : data.description) && jsx("p", {
|
116
|
+
children: data.description
|
117
|
+
}, void 0), jsx(Services, {
|
118
|
+
services: data === null || data === void 0 ? void 0 : data.services,
|
119
|
+
lang: lang
|
120
|
+
}, void 0)]
|
121
|
+
}, void 0)]
|
122
|
+
}, void 0);
|
123
|
+
};
|
124
|
+
|
125
|
+
export { PlaceOfBusinessInfo, PlaceOfBusinessInfo as default };
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { __makeTemplateObject } from '../../../_virtual/_tslib.js';
|
2
|
+
import styled from 'styled-components';
|
3
|
+
import media from '../../../styles/media.js';
|
4
|
+
var PlaceOfBusinessInfoContainer = styled.div.withConfig({
|
5
|
+
displayName: "PlaceOfBusinessInfostyles__PlaceOfBusinessInfoContainer",
|
6
|
+
componentId: "sc-94l050-0"
|
7
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n max-width: 768px;\n\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n max-width: 768px;\n\n ", "\n"])), function (_a) {
|
8
|
+
var theme = _a.theme;
|
9
|
+
return theme.spacings.spacing32;
|
10
|
+
}, media.desktop(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n row-gap: ", ";\n "], ["\n row-gap: ", ";\n "])), function (_a) {
|
11
|
+
var theme = _a.theme;
|
12
|
+
return theme.spacings.spacing64;
|
13
|
+
}));
|
14
|
+
var FlexContainer = styled.div.withConfig({
|
15
|
+
displayName: "PlaceOfBusinessInfostyles__FlexContainer",
|
16
|
+
componentId: "sc-94l050-1"
|
17
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n width: 100%;\n column-gap: ", ";\n row-gap: ", ";\n\n ", "\n"], ["\n display: flex;\n flex-direction: column;\n width: 100%;\n column-gap: ", ";\n row-gap: ", ";\n\n ", "\n"])), function (_a) {
|
18
|
+
var theme = _a.theme;
|
19
|
+
return theme.spacings.spacing64;
|
20
|
+
}, function (_a) {
|
21
|
+
var theme = _a.theme;
|
22
|
+
return theme.spacings.spacing32;
|
23
|
+
}, media.tablet(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-direction: row;\n "], ["\n flex-direction: row;\n "]))));
|
24
|
+
var FlexColumnContainer = styled.div.withConfig({
|
25
|
+
displayName: "PlaceOfBusinessInfostyles__FlexColumnContainer",
|
26
|
+
componentId: "sc-94l050-2"
|
27
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n"], ["\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n"])), function (_a) {
|
28
|
+
var theme = _a.theme;
|
29
|
+
return theme.spacings.spacing32;
|
30
|
+
});
|
31
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
32
|
+
export { FlexColumnContainer, FlexContainer, PlaceOfBusinessInfoContainer };
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { __assign } from '../../../_virtual/_tslib.js';
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
3
|
+
import { getUrl } from '../utils.js';
|
4
|
+
import translationJSON from '../../../locales/translations.json.js';
|
5
|
+
import { PlaceOfBusinessListItemContainer, LogoTitleContainer, Logo, LocationLinkContainer, LocationLinkText, ContactInfoContainer, ContactInfo, ContactInfoLabel, StyledLink, OpeningTimesContainer } from './PlaceOfBusinessListItem.styles.js';
|
6
|
+
import { icons } from '../../../assets/icons/Icons.js';
|
7
|
+
import OpenToday from '../OpenToday/OpenToday.js';
|
8
|
+
import { parseInternalLink } from '../../utils.js';
|
9
|
+
|
10
|
+
var PlaceOfBusinessListItem = function PlaceOfBusinessListItem(_a) {
|
11
|
+
var _b, _c, _d, _e, _f, _g, _h, _j;
|
12
|
+
|
13
|
+
var pob = _a.pob,
|
14
|
+
language = _a.language,
|
15
|
+
forceGeneratedPages = _a.forceGeneratedPages,
|
16
|
+
contactInfoToShow = _a.contactInfoToShow;
|
17
|
+
var location = pob.location,
|
18
|
+
weeklyOpeningTimes = pob.weeklyOpeningTimes,
|
19
|
+
name = pob.name,
|
20
|
+
relations = pob.relations,
|
21
|
+
website = pob.website,
|
22
|
+
contactInfo = pob.contactInfo;
|
23
|
+
var logoSrc = (_c = (_b = pob.media) === null || _b === void 0 ? void 0 : _b.logoCircle) === null || _c === void 0 ? void 0 : _c.svg;
|
24
|
+
var fullAddress = (location === null || location === void 0 ? void 0 : location.address) ? (location.address.street ? location.address.street + "," : '') + " " + location.address.postcode + " " + location.address.postcodeName : undefined;
|
25
|
+
var generatedPageUrl = name ? getUrl(name, (_d = relations === null || relations === void 0 ? void 0 : relations.laari) === null || _d === void 0 ? void 0 : _d.id, language) : '';
|
26
|
+
var pobLink = !forceGeneratedPages && (website === null || website === void 0 ? void 0 : website.url) ? website.url : parseInternalLink(generatedPageUrl);
|
27
|
+
var showPhoneNumber = ((_e = contactInfo === null || contactInfo === void 0 ? void 0 : contactInfo.phoneNumber) === null || _e === void 0 ? void 0 : _e.number) && (contactInfoToShow === 'phone' || contactInfoToShow === 'all');
|
28
|
+
var showAddress = (location === null || location === void 0 ? void 0 : location.address) && (contactInfoToShow === 'address' || contactInfoToShow === 'all');
|
29
|
+
return jsxs(PlaceOfBusinessListItemContainer, {
|
30
|
+
children: [jsxs(LogoTitleContainer, {
|
31
|
+
children: [logoSrc && jsx(Logo, {
|
32
|
+
src: logoSrc
|
33
|
+
}, void 0), jsx("p", {
|
34
|
+
children: name
|
35
|
+
}, void 0)]
|
36
|
+
}, void 0), pobLink && jsxs(LocationLinkContainer, __assign({
|
37
|
+
href: pobLink,
|
38
|
+
rel: "noopener noreferrer",
|
39
|
+
target: !(website === null || website === void 0 ? void 0 : website.url) || forceGeneratedPages ? '_self' : '_blank',
|
40
|
+
isArrow: forceGeneratedPages || !(website === null || website === void 0 ? void 0 : website.url),
|
41
|
+
"data-testid": 'pob-link'
|
42
|
+
}, {
|
43
|
+
children: [jsx(LocationLinkText, {
|
44
|
+
children: translationJSON.placeOfBusiness.placeOfBusinessSearch.detailsAndServices[language]
|
45
|
+
}, void 0), forceGeneratedPages || !(website === null || website === void 0 ? void 0 : website.url) ? jsx(icons.Arrow, {}, void 0) : jsx(icons.ExternalLink, {}, void 0)]
|
46
|
+
}), void 0), (showPhoneNumber || showAddress) && jsxs(ContactInfoContainer, {
|
47
|
+
children: [showAddress && jsxs(ContactInfo, {
|
48
|
+
children: [jsx(ContactInfoLabel, {
|
49
|
+
children: translationJSON.placeOfBusiness.placeOfBusinessSearch.address[language]
|
50
|
+
}, void 0), jsx("p", {
|
51
|
+
children: (_f = location === null || location === void 0 ? void 0 : location.address) === null || _f === void 0 ? void 0 : _f.street
|
52
|
+
}, void 0), jsx("p", {
|
53
|
+
children: ((_g = location === null || location === void 0 ? void 0 : location.address) === null || _g === void 0 ? void 0 : _g.postcode) + " " + ((_h = location === null || location === void 0 ? void 0 : location.address) === null || _h === void 0 ? void 0 : _h.postcodeName)
|
54
|
+
}, void 0), fullAddress && jsx(StyledLink, __assign({
|
55
|
+
href: "https://www.google.com/maps/place/" + fullAddress,
|
56
|
+
rel: "noopener noreferrer",
|
57
|
+
target: "_blank"
|
58
|
+
}, {
|
59
|
+
children: translationJSON.placeOfBusiness.getRoute[language]
|
60
|
+
}), void 0)]
|
61
|
+
}, void 0), showPhoneNumber && jsxs(ContactInfo, {
|
62
|
+
children: [jsx(ContactInfoLabel, {
|
63
|
+
children: translationJSON.placeOfBusiness.phone[language]
|
64
|
+
}, void 0), jsx("p", {
|
65
|
+
children: (_j = contactInfo === null || contactInfo === void 0 ? void 0 : contactInfo.phoneNumber) === null || _j === void 0 ? void 0 : _j.number
|
66
|
+
}, void 0)]
|
67
|
+
}, void 0)]
|
68
|
+
}, void 0), jsxs(OpeningTimesContainer, {
|
69
|
+
children: [weeklyOpeningTimes && jsx(OpenToday, {
|
70
|
+
weeklyOpeningTimes: weeklyOpeningTimes,
|
71
|
+
lang: language,
|
72
|
+
large: false
|
73
|
+
}, void 0), ((website === null || website === void 0 ? void 0 : website.url) || weeklyOpeningTimes) && jsx(StyledLink, __assign({
|
74
|
+
href: pobLink,
|
75
|
+
rel: "noopener noreferrer",
|
76
|
+
target: "_blank",
|
77
|
+
"data-testid": 'opening-times-link'
|
78
|
+
}, {
|
79
|
+
children: translationJSON.placeOfBusiness.allOpeningTimes[language]
|
80
|
+
}), void 0)]
|
81
|
+
}, void 0)]
|
82
|
+
}, void 0);
|
83
|
+
};
|
84
|
+
|
85
|
+
export { PlaceOfBusinessListItem, PlaceOfBusinessListItem as default };
|
package/dist/components/PlaceOfBusiness/PlaceOfBusinessListItem/PlaceOfBusinessListItem.styles.js
ADDED
@@ -0,0 +1,134 @@
|
|
1
|
+
import { __makeTemplateObject } from '../../../_virtual/_tslib.js';
|
2
|
+
import styled from 'styled-components';
|
3
|
+
import media from '../../../styles/media.js';
|
4
|
+
var PlaceOfBusinessListItemContainer = styled.div.withConfig({
|
5
|
+
displayName: "PlaceOfBusinessListItemstyles__PlaceOfBusinessListItemContainer",
|
6
|
+
componentId: "sc-stje0q-0"
|
7
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: ", ";\n padding: ", ";\n margin-bottom: ", ";\n display: flex;\n flex-wrap: wrap;\n\n ", "\n\n // This is necessary due to sokospalvelut theme having default font size of 20px for all paragraphs (defined in <GlobalStyle/>)\n // which is too large in this context. Therefore we cannot rely on the default <p> font styling in all themes\n // and have to set the size specifically in each theme. For most themes, this is the same as the default paragraph font size\n p {\n font-size: ", ";\n }\n"], ["\n border: ", ";\n padding: ", ";\n margin-bottom: ", ";\n display: flex;\n flex-wrap: wrap;\n\n ", "\n\n // This is necessary due to sokospalvelut theme having default font size of 20px for all paragraphs (defined in <GlobalStyle/>)\n // which is too large in this context. Therefore we cannot rely on the default <p> font styling in all themes\n // and have to set the size specifically in each theme. For most themes, this is the same as the default paragraph font size\n p {\n font-size: ", ";\n }\n"])), function (_a) {
|
8
|
+
var theme = _a.theme;
|
9
|
+
return "1px solid " + theme.components.placeOfBusiness.listItem.borderColor;
|
10
|
+
}, function (_a) {
|
11
|
+
var theme = _a.theme;
|
12
|
+
return theme.spacings.spacing16;
|
13
|
+
}, function (_a) {
|
14
|
+
var theme = _a.theme;
|
15
|
+
return theme.spacings.spacing16;
|
16
|
+
}, media.desktop(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n flex-wrap: unset;\n align-items: center;\n "], ["\n flex-wrap: unset;\n align-items: center;\n "]))), function (_a) {
|
17
|
+
var theme = _a.theme;
|
18
|
+
return theme.components.placeOfBusiness.fontSizes.medium.fontSize;
|
19
|
+
});
|
20
|
+
var LogoTitleContainer = styled.div.withConfig({
|
21
|
+
displayName: "PlaceOfBusinessListItemstyles__LogoTitleContainer",
|
22
|
+
componentId: "sc-stje0q-1"
|
23
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n width: 85%;\n display: flex;\n align-items: center;\n margin-bottom: ", ";\n word-break: break-word;\n\n ", "\n"], ["\n width: 85%;\n display: flex;\n align-items: center;\n margin-bottom: ", ";\n word-break: break-word;\n\n ", "\n"])), function (_a) {
|
24
|
+
var theme = _a.theme;
|
25
|
+
return theme.spacings.spacing16;
|
26
|
+
}, media.desktop(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 35%;\n order: 0;\n margin-right: ", ";\n margin-bottom: unset;\n "], ["\n width: 35%;\n order: 0;\n margin-right: ", ";\n margin-bottom: unset;\n "])), function (_a) {
|
27
|
+
var theme = _a.theme;
|
28
|
+
return theme.spacings.spacing32;
|
29
|
+
}));
|
30
|
+
var LocationLinkContainer = styled.a.withConfig({
|
31
|
+
displayName: "PlaceOfBusinessListItemstyles__LocationLinkContainer",
|
32
|
+
componentId: "sc-stje0q-2"
|
33
|
+
})(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: auto;\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n\n svg {\n transform: ", ";\n path {\n fill: ", ";\n }\n }\n\n ", "\n"], ["\n margin-left: auto;\n display: flex;\n align-items: center;\n margin-bottom: 16px;\n\n svg {\n transform: ", ";\n path {\n fill: ", ";\n }\n }\n\n ", "\n"])), function (_a) {
|
34
|
+
var isArrow = _a.isArrow;
|
35
|
+
return isArrow ? 'rotate(180deg)' : 'unset';
|
36
|
+
}, function (_a) {
|
37
|
+
var theme = _a.theme;
|
38
|
+
return theme.components.placeOfBusiness.listItem.externalLinkHoverColor;
|
39
|
+
}, media.desktop(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n order: 3;\n margin-bottom: 0;\n "], ["\n order: 3;\n margin-bottom: 0;\n "]))));
|
40
|
+
styled.div.withConfig({
|
41
|
+
displayName: "PlaceOfBusinessListItemstyles__StatusCircleContainer",
|
42
|
+
componentId: "sc-stje0q-3"
|
43
|
+
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-right: ", ";\n"], ["\n display: flex;\n align-items: center;\n margin-right: ", ";\n"])), function (_a) {
|
44
|
+
var theme = _a.theme;
|
45
|
+
return theme.spacings.spacing8;
|
46
|
+
});
|
47
|
+
var ContactInfoContainer = styled.div.withConfig({
|
48
|
+
displayName: "PlaceOfBusinessListItemstyles__ContactInfoContainer",
|
49
|
+
componentId: "sc-stje0q-4"
|
50
|
+
})(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n width: 45%;\n margin-right: 10%;\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n\n ", "\n"], ["\n width: 45%;\n margin-right: 10%;\n display: flex;\n flex-direction: column;\n row-gap: ", ";\n\n ", "\n"])), function (_a) {
|
51
|
+
var theme = _a.theme;
|
52
|
+
return theme.spacings.spacing16;
|
53
|
+
}, media.desktop(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n width: 25%;\n order: 2;\n margin-right: ", ";\n row-gap: ", ";\n "], ["\n width: 25%;\n order: 2;\n margin-right: ", ";\n row-gap: ", ";\n "])), function (_a) {
|
54
|
+
var theme = _a.theme;
|
55
|
+
return theme.spacings.spacing32;
|
56
|
+
}, function (_a) {
|
57
|
+
var theme = _a.theme;
|
58
|
+
return theme.spacings.spacing8;
|
59
|
+
}));
|
60
|
+
var ContactInfo = styled.div.withConfig({
|
61
|
+
displayName: "PlaceOfBusinessListItemstyles__ContactInfo",
|
62
|
+
componentId: "sc-stje0q-5"
|
63
|
+
})(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n word-break: break-word;\n"], ["\n display: flex;\n flex-direction: column;\n word-break: break-word;\n"])));
|
64
|
+
var ContactInfoLabel = styled.div.withConfig({
|
65
|
+
displayName: "PlaceOfBusinessListItemstyles__ContactInfoLabel",
|
66
|
+
componentId: "sc-stje0q-6"
|
67
|
+
})(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n\n"], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n color: ", ";\n\n"])), function (_a) {
|
68
|
+
var theme = _a.theme;
|
69
|
+
return theme.components.placeOfBusiness.fontFamily;
|
70
|
+
}, function (_a) {
|
71
|
+
var theme = _a.theme;
|
72
|
+
return theme.components.placeOfBusiness.fontSizes.small.fontSize;
|
73
|
+
}, function (_a) {
|
74
|
+
var theme = _a.theme;
|
75
|
+
return theme.components.placeOfBusiness.fontSizes.small.lineHeight;
|
76
|
+
}, function (_a) {
|
77
|
+
var theme = _a.theme;
|
78
|
+
return theme.components.placeOfBusiness.listItem.labelColor;
|
79
|
+
});
|
80
|
+
var OpeningTimesContainer = styled.div.withConfig({
|
81
|
+
displayName: "PlaceOfBusinessListItemstyles__OpeningTimesContainer",
|
82
|
+
componentId: "sc-stje0q-7"
|
83
|
+
})(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n width: 45%;\n display: flex;\n flex-direction: column;\n\n ", "\n"], ["\n width: 45%;\n display: flex;\n flex-direction: column;\n\n ", "\n"])), media.desktop(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n width: 15%;\n order: 1;\n margin-right: ", ";\n "], ["\n width: 15%;\n order: 1;\n margin-right: ", ";\n "])), function (_a) {
|
84
|
+
var theme = _a.theme;
|
85
|
+
return theme.spacings.spacing32;
|
86
|
+
}));
|
87
|
+
styled.div.withConfig({
|
88
|
+
displayName: "PlaceOfBusinessListItemstyles__OpeningHoursContainer",
|
89
|
+
componentId: "sc-stje0q-8"
|
90
|
+
})(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n margin-bottom: ", ";\n\n ", "\n"], ["\n display: flex;\n align-items: center;\n margin-bottom: ", ";\n\n ", "\n"])), function (_a) {
|
91
|
+
var theme = _a.theme;
|
92
|
+
return theme.spacings.spacing16;
|
93
|
+
}, media.desktop(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n margin-bottom: unset;\n "], ["\n margin-bottom: unset;\n "]))));
|
94
|
+
var Logo = styled.img.withConfig({
|
95
|
+
displayName: "PlaceOfBusinessListItemstyles__Logo",
|
96
|
+
componentId: "sc-stje0q-9"
|
97
|
+
})(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n width: 33px;\n height: 33px;\n margin-right: ", ";\n\n ", "\n"], ["\n width: 33px;\n height: 33px;\n margin-right: ", ";\n\n ", "\n"])), function (_a) {
|
98
|
+
var theme = _a.theme;
|
99
|
+
return theme.spacings.spacing16;
|
100
|
+
}, media.desktop(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n width: 65px;\n height: 65px;\n margin-right: ", ";\n "], ["\n width: 65px;\n height: 65px;\n margin-right: ", ";\n "])), function (_a) {
|
101
|
+
var theme = _a.theme;
|
102
|
+
return theme.spacings.spacing32;
|
103
|
+
}));
|
104
|
+
var StyledLink = styled.a.withConfig({
|
105
|
+
displayName: "PlaceOfBusinessListItemstyles__StyledLink",
|
106
|
+
componentId: "sc-stje0q-10"
|
107
|
+
})(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n margin-top: ", ";\n"], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n margin-top: ", ";\n"])), function (_a) {
|
108
|
+
var theme = _a.theme;
|
109
|
+
return theme.components.placeOfBusiness.fontFamily;
|
110
|
+
}, function (_a) {
|
111
|
+
var theme = _a.theme;
|
112
|
+
return theme.components.placeOfBusiness.fontSizes.small.fontSize;
|
113
|
+
}, function (_a) {
|
114
|
+
var theme = _a.theme;
|
115
|
+
return theme.components.placeOfBusiness.fontSizes.small.lineHeight;
|
116
|
+
}, function (_a) {
|
117
|
+
var theme = _a.theme;
|
118
|
+
return theme.spacings.spacing4;
|
119
|
+
});
|
120
|
+
var LocationLinkText = styled.p.withConfig({
|
121
|
+
displayName: "PlaceOfBusinessListItemstyles__LocationLinkText",
|
122
|
+
componentId: "sc-stje0q-11"
|
123
|
+
})(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n display: none;\n ", "\n"], ["\n display: none;\n ", "\n"])), media.desktop(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n display: inline;\n color: ", ";\n white-space: nowrap;\n margin-right: ", ";\n &:hover {\n color: ", ";\n }\n "], ["\n display: inline;\n color: ", ";\n white-space: nowrap;\n margin-right: ", ";\n &:hover {\n color: ", ";\n }\n "])), function (_a) {
|
124
|
+
var theme = _a.theme;
|
125
|
+
return theme.components.placeOfBusiness.listItem.externalLinkColor;
|
126
|
+
}, function (_a) {
|
127
|
+
var theme = _a.theme;
|
128
|
+
return theme.spacings.spacing8;
|
129
|
+
}, function (_a) {
|
130
|
+
var theme = _a.theme;
|
131
|
+
return theme.components.placeOfBusiness.listItem.externalLinkHoverColor;
|
132
|
+
}));
|
133
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20;
|
134
|
+
export { ContactInfo, ContactInfoContainer, ContactInfoLabel, LocationLinkContainer, LocationLinkText, Logo, LogoTitleContainer, OpeningTimesContainer, PlaceOfBusinessListItemContainer, StyledLink };
|
@@ -0,0 +1,142 @@
|
|
1
|
+
import { __rest, __read, __assign, __awaiter, __generator } from '../../../_virtual/_tslib.js';
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
3
|
+
import { forwardRef, useState, useEffect } from 'react';
|
4
|
+
import MoonLoader from 'react-spinners/MoonLoader';
|
5
|
+
import { PlaceOfBusinessSearchContainer, Input, LoaderContainer, NoSearchResults } from './PlaceOfBusinessSearch.styles.js';
|
6
|
+
import translationJSON from '../../../locales/translations.json.js';
|
7
|
+
import { getCurrentLanguage } from '../../utils.js';
|
8
|
+
import { filterPobs } from '../utils.js';
|
9
|
+
import Button from '../../Button/Button.js';
|
10
|
+
import PlaceOfBusinessListItem from '../PlaceOfBusinessListItem/PlaceOfBusinessListItem.js';
|
11
|
+
import axios from 'axios';
|
12
|
+
var PlaceOfBusinessSearch = forwardRef(function (_a, ref) {
|
13
|
+
var hideInitial = _a.hideInitial,
|
14
|
+
pageSize = _a.pageSize,
|
15
|
+
_b = _a.forceGeneratedPages,
|
16
|
+
forceGeneratedPages = _b === void 0 ? false : _b,
|
17
|
+
pobsEndpointWithoutProtocol = _a.pobsEndpointWithoutProtocol,
|
18
|
+
databaseId = _a.databaseId,
|
19
|
+
blockId = _a.blockId,
|
20
|
+
contactInfoToShow = _a.contactInfoToShow,
|
21
|
+
rest = __rest(_a, ["hideInitial", "pageSize", "forceGeneratedPages", "pobsEndpointWithoutProtocol", "databaseId", "blockId", "contactInfoToShow"]);
|
22
|
+
|
23
|
+
var lang = getCurrentLanguage();
|
24
|
+
|
25
|
+
var _c = __read(useState([]), 2),
|
26
|
+
locations = _c[0],
|
27
|
+
setLocations = _c[1];
|
28
|
+
|
29
|
+
var _d = __read(useState(false), 2),
|
30
|
+
error = _d[0],
|
31
|
+
setError = _d[1];
|
32
|
+
|
33
|
+
var _e = __read(useState([]), 2),
|
34
|
+
filteredLocations = _e[0],
|
35
|
+
setFilteredLocations = _e[1];
|
36
|
+
|
37
|
+
var _f = __read(useState([]), 2),
|
38
|
+
locationsToShow = _f[0],
|
39
|
+
setLocationsToShow = _f[1];
|
40
|
+
|
41
|
+
var _g = __read(useState(1), 2),
|
42
|
+
currentPage = _g[0],
|
43
|
+
setCurrentPage = _g[1];
|
44
|
+
|
45
|
+
var _h = __read(useState(hideInitial), 2),
|
46
|
+
hide = _h[0],
|
47
|
+
setHide = _h[1];
|
48
|
+
|
49
|
+
var onInputChange = function onInputChange(event) {
|
50
|
+
var filteredLocations = filterPobs(locations, event.target.value);
|
51
|
+
setFilteredLocations(filteredLocations);
|
52
|
+
setLocationsToShow(filteredLocations.slice(0, pageSize));
|
53
|
+
setCurrentPage(1);
|
54
|
+
setHide(false);
|
55
|
+
};
|
56
|
+
|
57
|
+
var onButtonClick = function onButtonClick() {
|
58
|
+
setCurrentPage(currentPage + 1);
|
59
|
+
setLocationsToShow(filteredLocations.slice(0, (currentPage + 1) * pageSize));
|
60
|
+
};
|
61
|
+
|
62
|
+
useEffect(function () {
|
63
|
+
var fetchData = function fetchData() {
|
64
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
65
|
+
var url, response;
|
66
|
+
return __generator(this, function (_a) {
|
67
|
+
switch (_a.label) {
|
68
|
+
case 0:
|
69
|
+
_a.trys.push([0, 2,, 3]);
|
70
|
+
|
71
|
+
url = "https://" + pobsEndpointWithoutProtocol + "/pobs?blockId=" + blockId + "&databaseId=" + databaseId + "&lang=" + lang.toLowerCase();
|
72
|
+
return [4
|
73
|
+
/*yield*/
|
74
|
+
, axios.get(url)];
|
75
|
+
|
76
|
+
case 1:
|
77
|
+
response = _a.sent();
|
78
|
+
setLocations(response.data);
|
79
|
+
setFilteredLocations(response.data);
|
80
|
+
|
81
|
+
if (!hide) {
|
82
|
+
setLocationsToShow(response.data.slice(0, pageSize));
|
83
|
+
}
|
84
|
+
|
85
|
+
return [3
|
86
|
+
/*break*/
|
87
|
+
, 3];
|
88
|
+
|
89
|
+
case 2:
|
90
|
+
_a.sent();
|
91
|
+
|
92
|
+
setError(true);
|
93
|
+
return [3
|
94
|
+
/*break*/
|
95
|
+
, 3];
|
96
|
+
|
97
|
+
case 3:
|
98
|
+
return [2
|
99
|
+
/*return*/
|
100
|
+
];
|
101
|
+
}
|
102
|
+
});
|
103
|
+
});
|
104
|
+
};
|
105
|
+
|
106
|
+
fetchData();
|
107
|
+
}, []);
|
108
|
+
return jsxs(PlaceOfBusinessSearchContainer, __assign({
|
109
|
+
ref: ref
|
110
|
+
}, rest, {
|
111
|
+
children: [jsx(Input, {
|
112
|
+
onChange: onInputChange,
|
113
|
+
placeholder: translationJSON.placeOfBusiness.placeOfBusinessSearch.search[lang],
|
114
|
+
size: 'large',
|
115
|
+
buttonLabel: translationJSON.placeOfBusiness.placeOfBusinessSearch.search[lang],
|
116
|
+
disabled: (locations === null || locations === void 0 ? void 0 : locations.length) === 0,
|
117
|
+
"data-testid": "pob-search-input"
|
118
|
+
}, void 0), (locations === null || locations === void 0 ? void 0 : locations.length) === 0 && !error && jsx(LoaderContainer, {
|
119
|
+
children: jsx(MoonLoader, {
|
120
|
+
size: 30
|
121
|
+
}, void 0)
|
122
|
+
}, void 0), error && jsx("p", {
|
123
|
+
children: translationJSON.placeOfBusiness.error[lang]
|
124
|
+
}, void 0), (locations === null || locations === void 0 ? void 0 : locations.length) > 0 && jsxs(Fragment, {
|
125
|
+
children: [!hide && locationsToShow.map(function (pob) {
|
126
|
+
return jsx(PlaceOfBusinessListItem, {
|
127
|
+
pob: pob,
|
128
|
+
language: lang,
|
129
|
+
forceGeneratedPages: forceGeneratedPages,
|
130
|
+
contactInfoToShow: contactInfoToShow
|
131
|
+
}, pob.id);
|
132
|
+
}), !hide && (locationsToShow === null || locationsToShow === void 0 ? void 0 : locationsToShow.length) > 0 && locationsToShow.length !== (filteredLocations === null || filteredLocations === void 0 ? void 0 : filteredLocations.length) && jsx(Button, {
|
133
|
+
align: 'center',
|
134
|
+
onClick: onButtonClick,
|
135
|
+
buttonText: translationJSON.placeOfBusiness.placeOfBusinessSearch.showMore[lang]
|
136
|
+
}, void 0), !filteredLocations || filteredLocations.length === 0 && jsx(NoSearchResults, {
|
137
|
+
children: translationJSON.placeOfBusiness.placeOfBusinessSearch.noResults[lang]
|
138
|
+
}, void 0)]
|
139
|
+
}, void 0)]
|
140
|
+
}), void 0);
|
141
|
+
});
|
142
|
+
export { PlaceOfBusinessSearch, PlaceOfBusinessSearch as default };
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { __makeTemplateObject } from '../../../_virtual/_tslib.js';
|
2
|
+
import styled from 'styled-components';
|
3
|
+
import { SearchInput } from '@sok/design-system';
|
4
|
+
var PlaceOfBusinessSearchContainer = styled.div.withConfig({
|
5
|
+
displayName: "PlaceOfBusinessSearchstyles__PlaceOfBusinessSearchContainer",
|
6
|
+
componentId: "sc-1x8bn8n-0"
|
7
|
+
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n flex-direction: column;\n\n // Override font\n .ant-input-group-wrapper .ant-input-affix-wrapper > input,\n .ant-input-group-wrapper .ant-input-affix-wrapper > input::placeholder {\n font-family: ", ";\n }\n\n // Fix alignment of the input clear icon\n .ant-input-suffix {\n margin-top: 3px;\n }\n // Fix search button height to be equal to the input field\n .search-input-btn {\n height: 54px !important;\n width: 54px !important;\n border-bottom-left-radius: 0px !important;\n border-top-left-radius: 0px !important;\n pointer-events: none;\n }\n\n // Do not round the end of the input and start of the button\n .ant-input-affix-wrapper.ant-input-affix-wrapper-lg {\n border-bottom-right-radius: 0px !important;\n border-top-right-radius: 0px !important;\n border-right: 0 !important;\n }\n\n // For some reason left: -1px is added which adds a 1px white gap in mobile\n .ant-input-group-addon {\n left: 0 !important;\n }\n"], ["\n width: 100%;\n display: flex;\n flex-direction: column;\n\n // Override font\n .ant-input-group-wrapper .ant-input-affix-wrapper > input,\n .ant-input-group-wrapper .ant-input-affix-wrapper > input::placeholder {\n font-family: ", ";\n }\n\n // Fix alignment of the input clear icon\n .ant-input-suffix {\n margin-top: 3px;\n }\n // Fix search button height to be equal to the input field\n .search-input-btn {\n height: 54px !important;\n width: 54px !important;\n border-bottom-left-radius: 0px !important;\n border-top-left-radius: 0px !important;\n pointer-events: none;\n }\n\n // Do not round the end of the input and start of the button\n .ant-input-affix-wrapper.ant-input-affix-wrapper-lg {\n border-bottom-right-radius: 0px !important;\n border-top-right-radius: 0px !important;\n border-right: 0 !important;\n }\n\n // For some reason left: -1px is added which adds a 1px white gap in mobile\n .ant-input-group-addon {\n left: 0 !important;\n }\n"])), function (_a) {
|
8
|
+
var theme = _a.theme;
|
9
|
+
return theme.components.placeOfBusiness.fontFamily;
|
10
|
+
});
|
11
|
+
var Input = styled(SearchInput).withConfig({
|
12
|
+
displayName: "PlaceOfBusinessSearchstyles__Input",
|
13
|
+
componentId: "sc-1x8bn8n-1"
|
14
|
+
})(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-bottom: ", " !important;\n"], ["\n margin-bottom: ", " !important;\n"])), function (_a) {
|
15
|
+
var theme = _a.theme;
|
16
|
+
return theme.spacings.spacing32;
|
17
|
+
});
|
18
|
+
styled.div.withConfig({
|
19
|
+
displayName: "PlaceOfBusinessSearchstyles__ButtonContainer",
|
20
|
+
componentId: "sc-1x8bn8n-2"
|
21
|
+
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n justify-content: center;\n margin-top: ", ";\n"], ["\n width: 100%;\n display: flex;\n justify-content: center;\n margin-top: ", ";\n"])), function (_a) {
|
22
|
+
var theme = _a.theme;
|
23
|
+
return theme.spacings.spacing16;
|
24
|
+
});
|
25
|
+
var NoSearchResults = styled.div.withConfig({
|
26
|
+
displayName: "PlaceOfBusinessSearchstyles__NoSearchResults",
|
27
|
+
componentId: "sc-1x8bn8n-3"
|
28
|
+
})(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n"], ["\n font-family: ", ";\n font-size: ", ";\n line-height: ", ";\n"])), function (_a) {
|
29
|
+
var theme = _a.theme;
|
30
|
+
return theme.components.placeOfBusiness.fontFamily;
|
31
|
+
}, function (_a) {
|
32
|
+
var theme = _a.theme;
|
33
|
+
return theme.components.placeOfBusiness.fontSizes.medium.fontSize;
|
34
|
+
}, function (_a) {
|
35
|
+
var theme = _a.theme;
|
36
|
+
return theme.components.placeOfBusiness.fontSizes.medium.lineHeight;
|
37
|
+
});
|
38
|
+
var LoaderContainer = styled.div.withConfig({
|
39
|
+
displayName: "PlaceOfBusinessSearchstyles__LoaderContainer",
|
40
|
+
componentId: "sc-1x8bn8n-4"
|
41
|
+
})(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n justify-content: center;\n"], ["\n width: 100%;\n display: flex;\n justify-content: center;\n"])));
|
42
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
43
|
+
export { Input, LoaderContainer, NoSearchResults, PlaceOfBusinessSearchContainer };
|