@reykjavik/hanna-react 0.10.83 → 0.10.85
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/AccordionList.d.ts +2 -2
- package/AccordionList.js +5 -5
- package/ActionCards.d.ts +2 -2
- package/ActionCards.js +4 -4
- package/Alert.d.ts +1 -1
- package/Alert.js +6 -6
- package/ArticleCards.d.ts +1 -1
- package/ArticleCards.js +2 -2
- package/ArticleCarousel/_ArticleCarouselCard.d.ts +2 -2
- package/ArticleCarousel/_ArticleCarouselCard.js +7 -7
- package/ArticleCarousel.d.ts +3 -3
- package/ArticleCarousel.js +3 -3
- package/ArticleMeta.js +2 -2
- package/BasicTable.d.ts +1 -1
- package/BasicTable.js +2 -2
- package/BgBox.d.ts +1 -1
- package/BgBox.js +3 -3
- package/Bling.js +2 -2
- package/BlockQuote.d.ts +1 -1
- package/BlockQuote.js +2 -2
- package/BreadCrumbs.js +2 -2
- package/ButtonBack.d.ts +1 -1
- package/ButtonBack.js +2 -2
- package/ButtonPrimary.d.ts +1 -1
- package/ButtonPrimary.js +2 -2
- package/ButtonSecondary.d.ts +1 -1
- package/ButtonSecondary.js +2 -2
- package/ButtonTertiary.d.ts +1 -1
- package/ButtonTertiary.js +2 -2
- package/CHANGELOG.md +13 -0
- package/Carousel.d.ts +2 -2
- package/Carousel.js +2 -2
- package/CenterColumn.d.ts +1 -1
- package/CenterColumn.js +2 -2
- package/Checkbox.d.ts +1 -1
- package/Checkbox.js +2 -2
- package/CheckboxButton.d.ts +1 -1
- package/CheckboxButton.js +2 -2
- package/CheckboxButtonsGroup.d.ts +1 -1
- package/CheckboxButtonsGroup.js +3 -3
- package/CheckboxGroup.d.ts +1 -1
- package/CheckboxGroup.js +3 -3
- package/CityBlock.d.ts +4 -4
- package/CityBlock.js +4 -4
- package/ContactBubble.d.ts +1 -1
- package/ContactBubble.js +6 -6
- package/ContentArticle.d.ts +4 -4
- package/ContentArticle.js +14 -14
- package/ContentImage.d.ts +1 -1
- package/ContentImage.js +2 -2
- package/Datepicker.d.ts +1 -1
- package/Datepicker.js +2 -2
- package/ExtraLinks.d.ts +2 -2
- package/ExtraLinks.js +6 -6
- package/FeatureList.d.ts +1 -1
- package/FeatureList.js +4 -4
- package/FileInput.d.ts +2 -2
- package/FileInput.js +4 -4
- package/Foonote.d.ts +1 -1
- package/Foonote.js +2 -2
- package/FooterBadges.js +2 -2
- package/Form.d.ts +1 -1
- package/FormField.d.ts +1 -1
- package/FormField.js +4 -4
- package/Gallery/_GalleryItem.d.ts +1 -1
- package/Gallery/_GalleryItem.js +7 -7
- package/Gallery/_GalleryModal.d.ts +1 -1
- package/Gallery/_GalleryModal.js +4 -4
- package/Gallery/_GalleryModalContext.d.ts +2 -2
- package/Gallery/_GalleryModalItem.d.ts +1 -1
- package/Gallery/_GalleryModalItem.js +2 -2
- package/Gallery.d.ts +4 -4
- package/Gallery.js +7 -7
- package/GridBlocks.d.ts +3 -3
- package/GridBlocks.js +8 -8
- package/Heading.d.ts +1 -1
- package/HeroBlock.d.ts +3 -3
- package/HeroBlock.js +8 -8
- package/Illustration.d.ts +1 -1
- package/Illustration.js +2 -2
- package/ImageCards.d.ts +2 -2
- package/ImageCards.js +4 -4
- package/InfoBlock.d.ts +1 -1
- package/InfoBlock.js +2 -2
- package/InfoHero.d.ts +3 -3
- package/InfoHero.js +10 -10
- package/IslandBlock.d.ts +4 -4
- package/IslandBlock.js +4 -4
- package/IslandPageBlock.d.ts +4 -4
- package/IslandPageBlock.js +4 -4
- package/LabeledTextBlock.d.ts +2 -2
- package/LabeledTextBlock.js +4 -4
- package/Layout.d.ts +1 -1
- package/Layout.js +13 -13
- package/MainMenu/_Auxiliary.d.ts +1 -1
- package/MainMenu/_Auxiliary.js +2 -2
- package/MainMenu/_PrimaryPanel.js +2 -2
- package/MainMenu.d.ts +3 -3
- package/MainMenu.js +15 -13
- package/MiniMetrics.d.ts +2 -2
- package/MiniMetrics.js +4 -4
- package/NameCard.js +4 -4
- package/NameCards.d.ts +1 -1
- package/NameCards.js +2 -2
- package/NewsHero.d.ts +2 -2
- package/NewsHero.js +7 -7
- package/PageFilter.d.ts +1 -1
- package/PageFilter.js +4 -4
- package/PageHeading.d.ts +1 -1
- package/PageHeading.js +2 -2
- package/Picture.d.ts +1 -1
- package/Picture.js +2 -2
- package/PullQuote.d.ts +1 -1
- package/PullQuote.js +2 -2
- package/RadioButtonsGroup.d.ts +1 -1
- package/RadioButtonsGroup.js +4 -4
- package/RadioGroup.d.ts +2 -2
- package/RadioGroup.js +4 -4
- package/RelatedLinks.js +2 -2
- package/RowBlock.d.ts +1 -1
- package/RowBlock.js +2 -2
- package/SearchInput.d.ts +1 -1
- package/SearchInput.js +2 -2
- package/SearchResults/_SearchResultsItem.js +4 -4
- package/SearchResults.d.ts +2 -2
- package/SearchResults.js +7 -7
- package/SeenEffect.d.ts +1 -1
- package/SeenEffect.js +3 -3
- package/Selectbox.d.ts +2 -2
- package/Selectbox.js +2 -2
- package/ShareButtons.d.ts +1 -1
- package/ShareButtons.js +2 -2
- package/SiteSearchAutocomplete.js +2 -2
- package/SiteSearchCurtain.js +2 -2
- package/SiteSearchInput.d.ts +2 -2
- package/SiteSearchInput.js +2 -2
- package/SubHeading.d.ts +2 -2
- package/SubHeading.js +2 -2
- package/Tabs.d.ts +2 -2
- package/Tabs.js +4 -4
- package/TagPill.d.ts +1 -1
- package/TagPill.js +3 -3
- package/TextBlock.d.ts +2 -2
- package/TextBlock.js +2 -2
- package/TextButton.d.ts +1 -1
- package/TextButton.js +2 -2
- package/TextInput.d.ts +1 -1
- package/TextInput.js +2 -2
- package/VerticalTabsTOC.d.ts +1 -1
- package/VerticalTabsTOC.js +2 -2
- package/WizardLayout.d.ts +1 -1
- package/WizardLayout.js +8 -8
- package/WizardLayoutClose.d.ts +1 -1
- package/WizardLayoutClose.js +2 -2
- package/_abstract/_AbstractCarousel.d.ts +2 -2
- package/_abstract/_AbstractCarousel.js +6 -6
- package/_abstract/_Blings.d.ts +1 -1
- package/_abstract/_Blings.js +2 -2
- package/_abstract/_Block.d.ts +3 -3
- package/_abstract/_Block.js +6 -6
- package/_abstract/_Button.js +2 -2
- package/_abstract/_CardList.d.ts +1 -1
- package/_abstract/_CardList.js +4 -4
- package/_abstract/_Image.js +2 -2
- package/_abstract/_Quote.js +2 -2
- package/_abstract/_TogglerGroup.d.ts +2 -2
- package/_abstract/_TogglerGroup.js +2 -2
- package/_abstract/_TogglerGroupField.d.ts +3 -3
- package/_abstract/_TogglerGroupField.js +4 -4
- package/assets.d.ts +2 -2
- package/esm/AccordionList.d.ts +25 -0
- package/esm/AccordionList.js +32 -0
- package/esm/ActionCards.d.ts +6 -0
- package/esm/ActionCards.js +9 -0
- package/esm/Alert.d.ts +48 -0
- package/esm/Alert.js +90 -0
- package/esm/ArticleCards.d.ts +8 -0
- package/esm/ArticleCards.js +4 -0
- package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +28 -0
- package/esm/ArticleCarousel/_ArticleCarouselCard.js +24 -0
- package/esm/ArticleCarousel.d.ts +12 -0
- package/esm/ArticleCarousel.js +8 -0
- package/esm/ArticleMeta.d.ts +10 -0
- package/esm/ArticleMeta.js +19 -0
- package/esm/Attention.d.ts +7 -0
- package/esm/Attention.js +4 -0
- package/esm/BasicTable.d.ts +14 -0
- package/esm/BasicTable.js +29 -0
- package/esm/BgBox.d.ts +8 -0
- package/esm/BgBox.js +9 -0
- package/esm/Bling.d.ts +81 -0
- package/esm/Bling.js +44 -0
- package/esm/BlockBreak.d.ts +2 -0
- package/esm/BlockBreak.js +6 -0
- package/esm/BlockQuote.d.ts +4 -0
- package/esm/BlockQuote.js +4 -0
- package/esm/BreadCrumbs.d.ts +11 -0
- package/esm/BreadCrumbs.js +28 -0
- package/esm/ButtonBack.d.ts +7 -0
- package/esm/ButtonBack.js +4 -0
- package/esm/ButtonBar.d.ts +17 -0
- package/esm/ButtonBar.js +15 -0
- package/esm/ButtonPrimary.d.ts +7 -0
- package/esm/ButtonPrimary.js +4 -0
- package/esm/ButtonSecondary.d.ts +7 -0
- package/esm/ButtonSecondary.js +4 -0
- package/esm/ButtonTertiary.d.ts +12 -0
- package/esm/ButtonTertiary.js +15 -0
- package/esm/Carousel.d.ts +4 -0
- package/esm/Carousel.js +4 -0
- package/esm/CarouselStepper.d.ts +4 -0
- package/esm/CarouselStepper.js +4 -0
- package/esm/CenterColumn.d.ts +7 -0
- package/esm/CenterColumn.js +7 -0
- package/esm/Checkbox.d.ts +4 -0
- package/esm/Checkbox.js +4 -0
- package/esm/CheckboxButton.d.ts +4 -0
- package/esm/CheckboxButton.js +4 -0
- package/esm/CheckboxButtonsGroup.d.ts +12 -0
- package/esm/CheckboxButtonsGroup.js +13 -0
- package/esm/CheckboxGroup.d.ts +10 -0
- package/esm/CheckboxGroup.js +7 -0
- package/esm/CityBlock.d.ts +21 -0
- package/esm/CityBlock.js +18 -0
- package/esm/ContactBubble.d.ts +58 -0
- package/esm/ContactBubble.js +152 -0
- package/esm/ContentArticle.d.ts +16 -0
- package/esm/ContentArticle.js +24 -0
- package/esm/ContentImage.d.ts +8 -0
- package/esm/ContentImage.js +18 -0
- package/esm/Datepicker.d.ts +40 -0
- package/esm/Datepicker.js +78 -0
- package/esm/ExtraLinks.d.ts +18 -0
- package/esm/ExtraLinks.js +24 -0
- package/esm/FeatureList.d.ts +12 -0
- package/esm/FeatureList.js +16 -0
- package/esm/FieldGroup.d.ts +10 -0
- package/esm/FieldGroup.js +9 -0
- package/esm/FileInput/_FileInput.utils.d.ts +36 -0
- package/esm/FileInput/_FileInput.utils.js +69 -0
- package/esm/FileInput/_FileInputFileList.d.ts +11 -0
- package/esm/FileInput/_FileInputFileList.js +19 -0
- package/esm/FileInput.d.ts +48 -0
- package/esm/FileInput.js +130 -0
- package/esm/Foonote.d.ts +12 -0
- package/esm/Foonote.js +7 -0
- package/esm/FooterBadges.d.ts +9 -0
- package/esm/FooterBadges.js +12 -0
- package/esm/FooterInfo.d.ts +20 -0
- package/esm/FooterInfo.js +12 -0
- package/esm/Footnote.d.ts +6 -0
- package/esm/Footnote.js +3 -0
- package/esm/Form.d.ts +7 -0
- package/esm/Form.js +10 -0
- package/esm/FormField.d.ts +65 -0
- package/esm/FormField.js +92 -0
- package/esm/Gallery/_GalleryItem.d.ts +7 -0
- package/esm/Gallery/_GalleryItem.js +19 -0
- package/esm/Gallery/_GalleryModal.d.ts +6 -0
- package/esm/Gallery/_GalleryModal.js +53 -0
- package/esm/Gallery/_GalleryModalContext.d.ts +9 -0
- package/esm/Gallery/_GalleryModalContext.js +2 -0
- package/esm/Gallery/_GalleryModalItem.d.ts +2 -0
- package/esm/Gallery/_GalleryModalItem.js +11 -0
- package/esm/Gallery.d.ts +17 -0
- package/esm/Gallery.js +27 -0
- package/esm/GridBlocks.d.ts +26 -0
- package/esm/GridBlocks.js +24 -0
- package/esm/Heading.d.ts +22 -0
- package/esm/Heading.js +19 -0
- package/esm/HeroBlock.d.ts +19 -0
- package/esm/HeroBlock.js +21 -0
- package/esm/IframeBlock.d.ts +28 -0
- package/esm/IframeBlock.js +26 -0
- package/esm/Illustration.d.ts +10 -0
- package/esm/Illustration.js +8 -0
- package/esm/ImageCards.d.ts +10 -0
- package/esm/ImageCards.js +12 -0
- package/esm/InfoBlock.d.ts +13 -0
- package/esm/InfoBlock.js +13 -0
- package/esm/InfoHero.d.ts +18 -0
- package/esm/InfoHero.js +83 -0
- package/esm/IslandBlock.d.ts +25 -0
- package/esm/IslandBlock.js +16 -0
- package/esm/IslandPageBlock.d.ts +24 -0
- package/esm/IslandPageBlock.js +16 -0
- package/esm/LabeledTextBlock.d.ts +11 -0
- package/esm/LabeledTextBlock.js +14 -0
- package/esm/Layout.d.ts +32 -0
- package/esm/Layout.js +56 -0
- package/esm/MainMenu/_Auxiliary.d.ts +6 -0
- package/esm/MainMenu/_Auxiliary.js +13 -0
- package/esm/MainMenu/_PrimaryPanel.d.ts +29 -0
- package/esm/MainMenu/_PrimaryPanel.js +22 -0
- package/esm/MainMenu.d.ts +62 -0
- package/esm/MainMenu.js +221 -0
- package/esm/MiniMetrics.d.ts +8 -0
- package/esm/MiniMetrics.js +12 -0
- package/esm/Modal.d.ts +8 -0
- package/esm/Modal.js +14 -0
- package/esm/NameCard.d.ts +64 -0
- package/esm/NameCard.js +82 -0
- package/esm/NameCards.d.ts +6 -0
- package/esm/NameCards.js +7 -0
- package/esm/NewsHero.d.ts +14 -0
- package/esm/NewsHero.js +86 -0
- package/esm/PageFilter.d.ts +16 -0
- package/esm/PageFilter.js +15 -0
- package/esm/PageHeading.d.ts +10 -0
- package/esm/PageHeading.js +12 -0
- package/esm/Picture.d.ts +7 -0
- package/esm/Picture.js +8 -0
- package/esm/ProcessOverview.d.ts +13 -0
- package/esm/ProcessOverview.js +17 -0
- package/esm/PullQuote.d.ts +4 -0
- package/esm/PullQuote.js +4 -0
- package/esm/RadioButtonsGroup.d.ts +12 -0
- package/esm/RadioButtonsGroup.js +14 -0
- package/esm/RadioGroup.d.ts +16 -0
- package/esm/RadioGroup.js +8 -0
- package/esm/RelatedLinks.d.ts +20 -0
- package/esm/RelatedLinks.js +26 -0
- package/esm/RowBlock.d.ts +12 -0
- package/esm/RowBlock.js +9 -0
- package/esm/RowBlockColumn.d.ts +8 -0
- package/esm/RowBlockColumn.js +11 -0
- package/esm/SearchInput.d.ts +18 -0
- package/esm/SearchInput.js +23 -0
- package/esm/SearchResults/_SearchResultsItem.d.ts +18 -0
- package/esm/SearchResults/_SearchResultsItem.js +14 -0
- package/esm/SearchResults.d.ts +37 -0
- package/esm/SearchResults.js +108 -0
- package/esm/SeenEffect.d.ts +4 -0
- package/esm/SeenEffect.js +9 -0
- package/esm/Selectbox.d.ts +11 -0
- package/esm/Selectbox.js +40 -0
- package/esm/ShareButtons.d.ts +9 -0
- package/esm/ShareButtons.js +56 -0
- package/esm/Sharpie.d.ts +23 -0
- package/esm/Sharpie.js +22 -0
- package/esm/SiteSearchAutocomplete.d.ts +40 -0
- package/esm/SiteSearchAutocomplete.js +48 -0
- package/esm/SiteSearchCurtain.d.ts +6 -0
- package/esm/SiteSearchCurtain.js +28 -0
- package/esm/SiteSearchInput.d.ts +24 -0
- package/esm/SiteSearchInput.js +30 -0
- package/esm/Skeleton.d.ts +25 -0
- package/esm/Skeleton.js +30 -0
- package/esm/SubHeading.d.ts +10 -0
- package/esm/SubHeading.js +13 -0
- package/esm/Tabs.d.ts +35 -0
- package/esm/Tabs.js +94 -0
- package/esm/TagPill.d.ts +25 -0
- package/esm/TagPill.js +34 -0
- package/esm/TextBlock.d.ts +15 -0
- package/esm/TextBlock.js +15 -0
- package/esm/TextButton.d.ts +9 -0
- package/esm/TextButton.js +9 -0
- package/esm/TextInput.d.ts +16 -0
- package/esm/TextInput.js +32 -0
- package/esm/Tooltip.d.ts +7 -0
- package/esm/Tooltip.js +58 -0
- package/esm/VSpacer.d.ts +22 -0
- package/esm/VSpacer.js +41 -0
- package/esm/VerticalTabsTOC.d.ts +14 -0
- package/esm/VerticalTabsTOC.js +68 -0
- package/esm/WizardLayout.d.ts +15 -0
- package/esm/WizardLayout.js +30 -0
- package/esm/WizardLayoutClose.d.ts +3 -0
- package/esm/WizardLayoutClose.js +4 -0
- package/esm/WizardStepper.d.ts +36 -0
- package/esm/WizardStepper.js +26 -0
- package/esm/_abstract/_AbstractCarousel.d.ts +29 -0
- package/esm/_abstract/_AbstractCarousel.js +108 -0
- package/esm/_abstract/_Blings.d.ts +11 -0
- package/esm/_abstract/_Blings.js +11 -0
- package/esm/_abstract/_Block.d.ts +21 -0
- package/esm/_abstract/_Block.js +23 -0
- package/esm/_abstract/_Button.d.ts +40 -0
- package/esm/_abstract/_Button.js +36 -0
- package/esm/_abstract/_CardList.d.ts +34 -0
- package/esm/_abstract/_CardList.js +37 -0
- package/esm/_abstract/_Image.d.ts +36 -0
- package/esm/_abstract/_Image.js +26 -0
- package/esm/_abstract/_Link.d.ts +60 -0
- package/esm/_abstract/_Link.js +64 -0
- package/esm/_abstract/_Quote.d.ts +11 -0
- package/esm/_abstract/_Quote.js +8 -0
- package/esm/_abstract/_TogglerGroup.d.ts +32 -0
- package/esm/_abstract/_TogglerGroup.js +28 -0
- package/esm/_abstract/_TogglerGroupField.d.ts +19 -0
- package/esm/_abstract/_TogglerGroupField.js +17 -0
- package/esm/_abstract/_TogglerInput.d.ts +23 -0
- package/esm/_abstract/_TogglerInput.js +23 -0
- package/esm/_abstract/breakOnNL.d.ts +1 -0
- package/esm/_abstract/breakOnNL.js +7 -0
- package/esm/assets.d.ts +42 -0
- package/esm/assets.js +58 -0
- package/esm/constants.d.ts +19 -0
- package/esm/constants.js +22 -0
- package/esm/focus-visible.d.ts +1 -0
- package/esm/focus-visible.js +3 -0
- package/esm/index.d.ts +97 -0
- package/esm/index.js +1 -0
- package/esm/package.json +1 -0
- package/esm/utils/HannaUIState.d.ts +8 -0
- package/esm/utils/HannaUIState.js +7 -0
- package/esm/utils/browserSide.d.ts +1 -0
- package/esm/utils/browserSide.js +1 -0
- package/esm/utils/config.d.ts +4 -0
- package/esm/utils/config.js +2 -0
- package/esm/utils/env.d.ts +1 -0
- package/esm/utils/env.js +8 -0
- package/esm/utils/seenEffect.d.ts +27 -0
- package/esm/utils/seenEffect.js +75 -0
- package/esm/utils/useDidChange.d.ts +37 -0
- package/esm/utils/useDidChange.js +43 -0
- package/esm/utils/useFormatMonitor.d.ts +38 -0
- package/esm/utils/useFormatMonitor.js +41 -0
- package/esm/utils/useGetSVGtext.d.ts +10 -0
- package/esm/utils/useGetSVGtext.js +23 -0
- package/esm/utils/useMenuToggling.d.ts +8 -0
- package/esm/utils/useMenuToggling.js +62 -0
- package/esm/utils/useMixedControlState.d.ts +137 -0
- package/esm/utils/useMixedControlState.js +101 -0
- package/esm/utils/useScrollbarWidthCSSVar.d.ts +17 -0
- package/esm/utils/useScrollbarWidthCSSVar.js +19 -0
- package/esm/utils.d.ts +8 -0
- package/esm/utils.js +8 -0
- package/package.json +390 -4
- package/utils/config.d.ts +2 -2
- package/utils/config.js +2 -2
- package/utils/useDidChange.d.ts +1 -1
- package/utils/useDidChange.js +1 -1
- package/utils/useMenuToggling.js +2 -2
- package/utils.d.ts +8 -8
- package/utils.js +8 -8
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { getEfnistaknUrl } from '@reykjavik/hanna-utils/assets';
|
|
4
|
+
import { Image } from './_abstract/_Image.js';
|
|
5
|
+
import { Link } from './_abstract/_Link.js';
|
|
6
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
7
|
+
import ButtonTertiary from './ButtonTertiary.js';
|
|
8
|
+
export const GridBlocks = (props) => {
|
|
9
|
+
const { blocks, twocol, startSeen } = props;
|
|
10
|
+
const [ref] = useSeenEffect(startSeen);
|
|
11
|
+
return (React.createElement("div", { className: getBemClass('GridBlocks', [twocol && 'twocol']), ref: ref }, blocks.map(({ title, summary, href, links = [], icon, image }, i) => {
|
|
12
|
+
const imageProps = icon ? { src: getEfnistaknUrl(icon) } : image;
|
|
13
|
+
return (React.createElement("div", { key: i, className: "GridBlocks__item" },
|
|
14
|
+
imageProps && React.createElement(Image, Object.assign({ className: "GridBlocks__illustration" }, imageProps)),
|
|
15
|
+
React.createElement("div", { className: "GridBlocks__textwrap" },
|
|
16
|
+
React.createElement("h3", { className: "GridBlocks__item__title" }, href != null ? (React.createElement(Link, { className: "GridBlocks__item__titlelink", href: href }, title)) : (title)),
|
|
17
|
+
React.createElement("div", { className: "GridBlocks__item__summary" }, summary),
|
|
18
|
+
React.createElement("ul", { className: "GridBlocks__links" }, links.map((link, i) => {
|
|
19
|
+
return (React.createElement("li", { key: i, className: "GridBlocks__link" },
|
|
20
|
+
React.createElement(ButtonTertiary, Object.assign({}, link))));
|
|
21
|
+
})))));
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
export default GridBlocks;
|
package/esm/Heading.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ComponentLayoutProps } from './constants.js';
|
|
3
|
+
declare const sizes: {
|
|
4
|
+
readonly small: "small";
|
|
5
|
+
/** Default value */
|
|
6
|
+
readonly normal: "";
|
|
7
|
+
readonly large: "large";
|
|
8
|
+
};
|
|
9
|
+
type HeadingSize = keyof typeof sizes;
|
|
10
|
+
export type HeadingProps = {
|
|
11
|
+
Tag?: 'h2' | 'h3';
|
|
12
|
+
size?: HeadingSize;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Make an exception and render a `<h1/>` element.
|
|
16
|
+
*
|
|
17
|
+
* This prop is ignore if the `Tag` prop is defined.
|
|
18
|
+
*/
|
|
19
|
+
forceH1?: boolean;
|
|
20
|
+
} & ComponentLayoutProps;
|
|
21
|
+
export declare const Heading: (props: HeadingProps) => JSX.Element;
|
|
22
|
+
export default Heading;
|
package/esm/Heading.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
const sizes = {
|
|
4
|
+
small: 'small',
|
|
5
|
+
/** Default value */
|
|
6
|
+
normal: '',
|
|
7
|
+
large: 'large',
|
|
8
|
+
};
|
|
9
|
+
export const Heading = (props) => {
|
|
10
|
+
const { size = 'normal', align, wide, children } = props;
|
|
11
|
+
const Tag = props.Tag || (props.forceH1 ? 'h1' : 'h2');
|
|
12
|
+
const suppressWarning = process.env.NODE_ENV !== 'production' && Tag === 'h1' ? true : undefined;
|
|
13
|
+
return (React.createElement(Tag, { "data-dev-forcedh1": suppressWarning, className: getBemClass('Heading', [
|
|
14
|
+
sizes[size],
|
|
15
|
+
align === 'right' && 'align--' + align,
|
|
16
|
+
!align && wide && 'wide',
|
|
17
|
+
]) }, children));
|
|
18
|
+
};
|
|
19
|
+
export default Heading;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Illustration } from '@reykjavik/hanna-utils/assets';
|
|
2
|
+
import { ButtonProps } from './_abstract/_Button.js';
|
|
3
|
+
import { ImageProps } from './_abstract/_Image.js';
|
|
4
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
5
|
+
type HeroBlockImageProps = {
|
|
6
|
+
illustration: Illustration;
|
|
7
|
+
image?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
image: ImageProps;
|
|
10
|
+
illustration?: undefined;
|
|
11
|
+
};
|
|
12
|
+
export type HeroBlockProps = {
|
|
13
|
+
title: string;
|
|
14
|
+
summary: string | JSX.Element;
|
|
15
|
+
primaryButton?: ButtonProps;
|
|
16
|
+
secondaryButton?: ButtonProps;
|
|
17
|
+
} & HeroBlockImageProps & SeenProp;
|
|
18
|
+
export declare const HeroBlock: (props: HeroBlockProps) => JSX.Element;
|
|
19
|
+
export default HeroBlock;
|
package/esm/HeroBlock.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getIllustrationUrl } from '@reykjavik/hanna-utils/assets';
|
|
3
|
+
import { Image } from './_abstract/_Image.js';
|
|
4
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
5
|
+
import ButtonPrimary from './ButtonPrimary.js';
|
|
6
|
+
import ButtonTertiary from './ButtonTertiary.js';
|
|
7
|
+
export const HeroBlock = (props) => {
|
|
8
|
+
const { title, summary, illustration, image, primaryButton, secondaryButton, startSeen, } = props;
|
|
9
|
+
const hasButtons = Boolean(primaryButton || secondaryButton);
|
|
10
|
+
const imgProps = illustration ? { src: getIllustrationUrl(illustration) } : image;
|
|
11
|
+
const [ref] = useSeenEffect(startSeen);
|
|
12
|
+
return (React.createElement("div", { className: "HeroBlock", ref: ref },
|
|
13
|
+
React.createElement("h1", { className: "HeroBlock__title" }, title),
|
|
14
|
+
React.createElement(Image, Object.assign({ className: "HeroBlock__image" }, imgProps)),
|
|
15
|
+
React.createElement("div", { className: "HeroBlock__summary" }, summary),
|
|
16
|
+
hasButtons && (React.createElement("div", { className: "HeroBlock__buttons" },
|
|
17
|
+
primaryButton && React.createElement(ButtonPrimary, Object.assign({}, primaryButton)),
|
|
18
|
+
' ',
|
|
19
|
+
secondaryButton && React.createElement(ButtonTertiary, Object.assign({}, secondaryButton))))));
|
|
20
|
+
};
|
|
21
|
+
export default HeroBlock;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
2
|
+
import { ResizerOptions } from 'iframe-resizer-react';
|
|
3
|
+
export type IframeBlockProps = {
|
|
4
|
+
src: string;
|
|
5
|
+
/** Accessible title attribute for the iframe (similar to alt="" on images) */
|
|
6
|
+
title: string;
|
|
7
|
+
framed?: boolean;
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
align?: 'right';
|
|
10
|
+
} & EitherObj<{
|
|
11
|
+
/** Default: `'auto'` ... which initializes "iframe-resizer" script */
|
|
12
|
+
height?: 'auto';
|
|
13
|
+
/** Default: `false` ... Set to `true` for same-site only, or provide array of allowed domain-names */
|
|
14
|
+
checkOrigin?: ResizerOptions['checkOrigin'];
|
|
15
|
+
}, {
|
|
16
|
+
height: number;
|
|
17
|
+
scrolling?: boolean | 'no' | 'yes';
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* When `height` is undefined or "auto", then Add the following code-snipped to the iframed page:
|
|
21
|
+
*
|
|
22
|
+
* ```js
|
|
23
|
+
* <script> window.iFrameResizer = { targetOrigin: '*' }; </script>
|
|
24
|
+
* <script src="https://styles.reykjavik.is/assets/scripts/iframeResizer.contentWindow@4.js"></script>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const IframeBlock: (props: IframeBlockProps) => JSX.Element;
|
|
28
|
+
export default IframeBlock;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import IframeResizer from 'iframe-resizer-react';
|
|
4
|
+
/**
|
|
5
|
+
* When `height` is undefined or "auto", then Add the following code-snipped to the iframed page:
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* <script> window.iFrameResizer = { targetOrigin: '*' }; </script>
|
|
9
|
+
* <script src="https://styles.reykjavik.is/assets/scripts/iframeResizer.contentWindow@4.js"></script>
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export const IframeBlock = (props) => {
|
|
13
|
+
const { title, src, framed, compact, scrolling, height = 'auto', align, checkOrigin = false, } = props;
|
|
14
|
+
const className = getBemClass('IframeBlock', [
|
|
15
|
+
framed && 'framed',
|
|
16
|
+
compact && 'compact',
|
|
17
|
+
align === 'right' && 'align--' + align,
|
|
18
|
+
]);
|
|
19
|
+
return height === 'auto' ? (React.createElement(IframeResizer, { className: className, title: title, src: src, checkOrigin: checkOrigin })) : (React.createElement("iframe", { className: className, title: title, src: src,
|
|
20
|
+
// hidden tiger: pass negative height to disable iframe-resizer but not set height explicitly
|
|
21
|
+
// (Silly hack, don't rely on this)
|
|
22
|
+
height: height < 0 ? undefined : height,
|
|
23
|
+
// allow undefined to suppress scrolling attribute
|
|
24
|
+
scrolling: scrolling === true ? 'yes' : scrolling === false ? 'no' : scrolling }));
|
|
25
|
+
};
|
|
26
|
+
export default IframeBlock;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
2
|
+
import { Illustration as IllustrationName } from '@reykjavik/hanna-utils/assets';
|
|
3
|
+
import { ImageProps } from './_abstract/_Image.js';
|
|
4
|
+
type IllustrationProps = EitherObj<{
|
|
5
|
+
type: IllustrationName;
|
|
6
|
+
}, {
|
|
7
|
+
image: ImageProps;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const Illustration: (props: IllustrationProps) => JSX.Element;
|
|
10
|
+
export default Illustration;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getIllustrationUrl, } from '@reykjavik/hanna-utils/assets';
|
|
3
|
+
import { Image } from './_abstract/_Image.js';
|
|
4
|
+
export const Illustration = (props) => {
|
|
5
|
+
const imgProps = props.type ? { src: getIllustrationUrl(props.type) } : props.image;
|
|
6
|
+
return React.createElement(Image, Object.assign({ className: "Illustration" }, imgProps));
|
|
7
|
+
};
|
|
8
|
+
export default Illustration;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CardListSummaryProps, ImageCardListProps, ImageCardProps as _ImageCardProps } from './_abstract/_CardList.js';
|
|
2
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
export type ImageCardsItemProps = _ImageCardProps;
|
|
4
|
+
/** @deprecated Use `ImageCardsItemProps` instead. (Will be removed in v0.11) */
|
|
5
|
+
export type ImageCardProps = ImageCardsItemProps;
|
|
6
|
+
export type ImageCardsProps = ImageCardListProps & CardListSummaryProps & {
|
|
7
|
+
background?: boolean;
|
|
8
|
+
} & SeenProp;
|
|
9
|
+
export declare const ImageCards: (props: ImageCardsProps) => JSX.Element;
|
|
10
|
+
export default ImageCards;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
4
|
+
import { CardList, } from './_abstract/_CardList.js';
|
|
5
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
6
|
+
export const ImageCards = (props) => {
|
|
7
|
+
const { background, startSeen } = props, cardListProps = __rest(props, ["background", "startSeen"]);
|
|
8
|
+
const [ref] = useSeenEffect(startSeen);
|
|
9
|
+
return (React.createElement("div", { className: getBemClass('ImageCards', background && 'background'), ref: ref },
|
|
10
|
+
React.createElement(CardList, Object.assign({}, cardListProps, { bemPrefix: "ImageCards", imgPlaceholder: props.imgPlaceholder || true }))));
|
|
11
|
+
};
|
|
12
|
+
export default ImageCards;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
2
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
export type InfoBlockProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
subtitle?: string | JSX.Element;
|
|
6
|
+
items: Array<string | JSX.Element>;
|
|
7
|
+
} & EitherObj<{
|
|
8
|
+
attention?: string | JSX.Element;
|
|
9
|
+
}, {
|
|
10
|
+
extraInfo?: string | JSX.Element;
|
|
11
|
+
}> & SeenProp;
|
|
12
|
+
export declare const InfoBlock: (props: InfoBlockProps) => JSX.Element;
|
|
13
|
+
export default InfoBlock;
|
package/esm/InfoBlock.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
3
|
+
export const InfoBlock = (props) => {
|
|
4
|
+
const { title, subtitle, items, startSeen } = props;
|
|
5
|
+
const [ref] = useSeenEffect(startSeen);
|
|
6
|
+
return (React.createElement("div", { className: "InfoBlock", ref: ref },
|
|
7
|
+
React.createElement("h2", { className: "InfoBlock__title" }, title),
|
|
8
|
+
subtitle && React.createElement("div", { className: "InfoBlock__subtitle" }, subtitle),
|
|
9
|
+
React.createElement("ul", { className: "InfoBlock__items" }, items.map((item, i) => (React.createElement("li", { key: i, className: "InfoBlock__item" }, item)))),
|
|
10
|
+
'extraInfo' in props && (React.createElement("div", { className: "InfoBlock__extrainfo" }, props.extraInfo)),
|
|
11
|
+
'attention' in props && (React.createElement("div", { className: "InfoBlock__attention" }, props.attention))));
|
|
12
|
+
};
|
|
13
|
+
export default InfoBlock;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ButtonProps } from './_abstract/_Button.js';
|
|
2
|
+
import { ImageProps } from './_abstract/_Image.js';
|
|
3
|
+
import { Alignment } from './constants.js';
|
|
4
|
+
type BlingOptions = 'waves' | 'sunny-waves' | 'triangles' | 'circles';
|
|
5
|
+
export type InfoHeroProps = {
|
|
6
|
+
title: string;
|
|
7
|
+
titleBlurb?: string | JSX.Element;
|
|
8
|
+
/** Inserts `<br/>`s on `\n`. Collapses multiple `\n`s. */
|
|
9
|
+
subTitle?: string;
|
|
10
|
+
blurb?: string | JSX.Element;
|
|
11
|
+
buttons?: Array<ButtonProps>;
|
|
12
|
+
footer?: string | JSX.Element;
|
|
13
|
+
align?: Alignment;
|
|
14
|
+
image?: ImageProps;
|
|
15
|
+
blingType?: BlingOptions;
|
|
16
|
+
};
|
|
17
|
+
export declare const InfoHero: (props: InfoHeroProps) => JSX.Element;
|
|
18
|
+
export default InfoHero;
|
package/esm/InfoHero.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { Blings } from './_abstract/_Blings.js';
|
|
4
|
+
import { Image } from './_abstract/_Image.js';
|
|
5
|
+
import { breakOnNL } from './_abstract/breakOnNL.js';
|
|
6
|
+
import ButtonTertiary from './ButtonTertiary.js';
|
|
7
|
+
import { aligns } from './constants.js';
|
|
8
|
+
const blingOptions = {
|
|
9
|
+
waves: [
|
|
10
|
+
{
|
|
11
|
+
type: 'waves-medium',
|
|
12
|
+
color: 'primary',
|
|
13
|
+
align: 'left',
|
|
14
|
+
vertical: 'up',
|
|
15
|
+
parent: 'bottom',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
'sunny-waves': [
|
|
19
|
+
{
|
|
20
|
+
type: 'waves-medium',
|
|
21
|
+
align: 'left',
|
|
22
|
+
parent: 'bottom',
|
|
23
|
+
vertical: 'up',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: 'circle-medium',
|
|
27
|
+
color: 'secondary',
|
|
28
|
+
align: 'right-center',
|
|
29
|
+
parent: 'top',
|
|
30
|
+
vertical: 'down-ish',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
triangles: [
|
|
34
|
+
{
|
|
35
|
+
type: 'triangle-large',
|
|
36
|
+
align: 'left-center',
|
|
37
|
+
parent: 'bottom',
|
|
38
|
+
vertical: 'up',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'triangle-small',
|
|
42
|
+
color: 'secondary',
|
|
43
|
+
align: 'right',
|
|
44
|
+
parent: 'top-ish',
|
|
45
|
+
vertical: 'down-ish',
|
|
46
|
+
overlay: true,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
circles: [
|
|
50
|
+
{
|
|
51
|
+
type: 'circle-large',
|
|
52
|
+
align: 'left',
|
|
53
|
+
parent: 'top',
|
|
54
|
+
vertical: 'down',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
type: 'circle-small',
|
|
58
|
+
color: 'secondary',
|
|
59
|
+
align: 'right',
|
|
60
|
+
parent: 'bottom-ish',
|
|
61
|
+
vertical: 'up-ish',
|
|
62
|
+
overlay: true,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
};
|
|
66
|
+
export const InfoHero = (props) => {
|
|
67
|
+
const { title, titleBlurb, subTitle, blurb, image, buttons = [], footer, align, blingType, } = props;
|
|
68
|
+
const showButtons = Boolean(buttons.length);
|
|
69
|
+
const alignment = align && aligns[align] ? align : 'right';
|
|
70
|
+
const blings = (blingType && blingOptions[blingType]) ||
|
|
71
|
+
blingOptions.waves; // default to `waves`
|
|
72
|
+
return (React.createElement("div", { className: getBemClass('InfoHero', 'align--' + alignment) },
|
|
73
|
+
React.createElement("div", { className: "InfoHero__content" },
|
|
74
|
+
React.createElement("h1", { className: "InfoHero__title" }, title),
|
|
75
|
+
titleBlurb && React.createElement("div", { className: "InfoHero__titleblurb" }, titleBlurb),
|
|
76
|
+
subTitle && React.createElement("div", { className: "InfoHero__subtitle" }, breakOnNL(subTitle)),
|
|
77
|
+
blurb && React.createElement("div", { className: "InfoHero__blurb" }, blurb),
|
|
78
|
+
showButtons && (React.createElement("div", { className: "InfoHero__buttons" }, buttons.map((buttonProps, i) => (React.createElement(ButtonTertiary, Object.assign({ key: i }, buttonProps)))))),
|
|
79
|
+
footer && React.createElement("div", { className: "InfoHero__footer" }, footer)),
|
|
80
|
+
React.createElement(Image, Object.assign({ className: "InfoHero__image", altText: title }, image, { placeholder: true })),
|
|
81
|
+
React.createElement(Blings, { blings: blings, mirror: alignment === 'right' })));
|
|
82
|
+
};
|
|
83
|
+
export default InfoHero;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Formheimur } from '@reykjavik/hanna-utils/assets';
|
|
2
|
+
import { BlockItem } from './_abstract/_Block.js';
|
|
3
|
+
import { ImageProps } from './_abstract/_Image.js';
|
|
4
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
5
|
+
import { Alignment } from './constants.js';
|
|
6
|
+
type IslandBaseBlockProps = {
|
|
7
|
+
align?: Alignment;
|
|
8
|
+
};
|
|
9
|
+
type IslandImageBlock = {
|
|
10
|
+
content: BlockItem;
|
|
11
|
+
} & ({
|
|
12
|
+
shapes: Formheimur;
|
|
13
|
+
image?: undefined;
|
|
14
|
+
} | {
|
|
15
|
+
image: ImageProps;
|
|
16
|
+
shapes?: undefined;
|
|
17
|
+
});
|
|
18
|
+
type IslandContentBlocks = {
|
|
19
|
+
content: Array<BlockItem>;
|
|
20
|
+
shapes?: undefined;
|
|
21
|
+
image?: undefined;
|
|
22
|
+
};
|
|
23
|
+
export type IslandBlockProps = IslandBaseBlockProps & (IslandContentBlocks | IslandImageBlock) & SeenProp;
|
|
24
|
+
export declare const IslandBlock: (props: IslandBlockProps) => JSX.Element;
|
|
25
|
+
export default IslandBlock;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getFormheimurUrl } from '@reykjavik/hanna-utils/assets';
|
|
3
|
+
import { Block } from './_abstract/_Block.js';
|
|
4
|
+
import { aligns } from './constants.js';
|
|
5
|
+
export const IslandBlock = (props) => {
|
|
6
|
+
const { align, content, shapes, image, startSeen } = props;
|
|
7
|
+
const alignment = align && aligns[align] ? align : 'right';
|
|
8
|
+
const blockProps = Array.isArray(content)
|
|
9
|
+
? { content }
|
|
10
|
+
: {
|
|
11
|
+
content,
|
|
12
|
+
image: shapes ? { src: getFormheimurUrl(shapes), inline: true } : image || {},
|
|
13
|
+
};
|
|
14
|
+
return (React.createElement(Block, Object.assign({ bem: "IslandBlock", modifier: 'align--' + alignment }, blockProps, { startSeen: startSeen })));
|
|
15
|
+
};
|
|
16
|
+
export default IslandBlock;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Illustration } from '@reykjavik/hanna-utils/assets';
|
|
2
|
+
import { BlockItem } from './_abstract/_Block.js';
|
|
3
|
+
import { ImageProps } from './_abstract/_Image.js';
|
|
4
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
5
|
+
import { Alignment } from './constants.js';
|
|
6
|
+
declare const backgrounds: {
|
|
7
|
+
none: undefined;
|
|
8
|
+
gray: string;
|
|
9
|
+
secondary: string;
|
|
10
|
+
};
|
|
11
|
+
type Background = keyof typeof backgrounds;
|
|
12
|
+
type IslandPageImageProps = {
|
|
13
|
+
illustration: Illustration;
|
|
14
|
+
image?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
illustration?: undefined;
|
|
17
|
+
image: ImageProps;
|
|
18
|
+
};
|
|
19
|
+
export type IslandPageBlockProps = BlockItem & IslandPageImageProps & {
|
|
20
|
+
align?: Alignment;
|
|
21
|
+
background?: Background;
|
|
22
|
+
} & SeenProp;
|
|
23
|
+
export declare const IslandPageBlock: (props: IslandPageBlockProps) => JSX.Element;
|
|
24
|
+
export default IslandPageBlock;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getIllustrationUrl } from '@reykjavik/hanna-utils/assets';
|
|
3
|
+
import { Block } from './_abstract/_Block.js';
|
|
4
|
+
import { aligns } from './constants.js';
|
|
5
|
+
const backgrounds = {
|
|
6
|
+
none: undefined,
|
|
7
|
+
gray: 'gray',
|
|
8
|
+
secondary: 'secondary',
|
|
9
|
+
};
|
|
10
|
+
export const IslandPageBlock = (props) => {
|
|
11
|
+
const { title, summary, buttons, illustration, image, align, background, startSeen } = props;
|
|
12
|
+
const alignment = align && aligns[align] ? align : 'right';
|
|
13
|
+
const bg = backgrounds[background || 'none'];
|
|
14
|
+
return (React.createElement(Block, { bem: "IslandPageBlock", modifier: ['align--' + alignment, bg && 'background--' + bg], content: { title, summary, buttons }, image: illustration ? { src: getIllustrationUrl(illustration) } : image || {}, startSeen: startSeen }));
|
|
15
|
+
};
|
|
16
|
+
export default IslandPageBlock;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonProps } from './_abstract/_Button.js';
|
|
3
|
+
import { SeenProp } from './utils/seenEffect.js';
|
|
4
|
+
export type LabeledTextBlockProps = {
|
|
5
|
+
label: string;
|
|
6
|
+
summary: string | ReactElement;
|
|
7
|
+
wide?: boolean;
|
|
8
|
+
buttons?: Array<ButtonProps>;
|
|
9
|
+
} & SeenProp;
|
|
10
|
+
export declare const LabeledTextBlock: (props: LabeledTextBlockProps) => JSX.Element;
|
|
11
|
+
export default LabeledTextBlock;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
|
+
import ButtonTertiary from './ButtonTertiary.js';
|
|
5
|
+
export const LabeledTextBlock = (props) => {
|
|
6
|
+
const { label, summary, wide, buttons = [], startSeen } = props;
|
|
7
|
+
const [ref] = useSeenEffect(startSeen);
|
|
8
|
+
return (React.createElement("div", { className: getBemClass('LabeledTextBlock', wide && 'wide'), ref: ref },
|
|
9
|
+
React.createElement("h2", { className: "LabeledTextBlock__label" }, label),
|
|
10
|
+
React.createElement("div", { className: "LabeledTextBlock__summary" },
|
|
11
|
+
summary,
|
|
12
|
+
buttons.map((button, i) => (React.createElement(ButtonTertiary, Object.assign({ key: i }, button)))))));
|
|
13
|
+
};
|
|
14
|
+
export default LabeledTextBlock;
|
package/esm/Layout.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
|
+
import type { HannaColorTheme } from '@reykjavik/hanna-css';
|
|
4
|
+
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
5
|
+
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
6
|
+
import { SSRSupport } from './utils.js';
|
|
7
|
+
export type LayoutI18n = {
|
|
8
|
+
lang?: string;
|
|
9
|
+
skipLinkLabel: string;
|
|
10
|
+
closeMenuLabel: string;
|
|
11
|
+
closeMenuLabelLong?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const defaultLayoutTexts: DefaultTexts<LayoutI18n>;
|
|
14
|
+
type LayoutProps = {
|
|
15
|
+
globalAlerts?: ReactNode;
|
|
16
|
+
mainChildren?: ReactNode;
|
|
17
|
+
navChildren?: ReactNode;
|
|
18
|
+
footerChildren?: ReactNode;
|
|
19
|
+
colorTheme?: HannaColorTheme;
|
|
20
|
+
logoLink?: string;
|
|
21
|
+
siteName?: string;
|
|
22
|
+
modifier?: BemPropsModifier['modifier'];
|
|
23
|
+
ssr?: SSRSupport;
|
|
24
|
+
texts?: LayoutI18n;
|
|
25
|
+
lang?: string;
|
|
26
|
+
} & EitherObj<{
|
|
27
|
+
mainChildren: ReactNode;
|
|
28
|
+
}, {
|
|
29
|
+
children: ReactNode;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const Layout: (props: LayoutProps) => JSX.Element;
|
|
32
|
+
export default Layout;
|
package/esm/Layout.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { getAssetUrl } from '@reykjavik/hanna-utils/assets';
|
|
4
|
+
import { getTexts } from '@reykjavik/hanna-utils/i18n';
|
|
5
|
+
import { Image } from './_abstract/_Image.js';
|
|
6
|
+
import { Link } from './_abstract/_Link.js';
|
|
7
|
+
import { HannaUIState } from './utils/HannaUIState.js';
|
|
8
|
+
import { useMenuToggling } from './utils/useMenuToggling.js';
|
|
9
|
+
import { useScrollbarWidthCSSVar } from './utils/useScrollbarWidthCSSVar.js';
|
|
10
|
+
import { useIsBrowserSide } from './utils.js';
|
|
11
|
+
export const defaultLayoutTexts = {
|
|
12
|
+
is: {
|
|
13
|
+
lang: 'is',
|
|
14
|
+
skipLinkLabel: 'Valmynd',
|
|
15
|
+
closeMenuLabel: 'Loka',
|
|
16
|
+
closeMenuLabelLong: 'Loka valmynd',
|
|
17
|
+
},
|
|
18
|
+
en: {
|
|
19
|
+
lang: 'en',
|
|
20
|
+
skipLinkLabel: 'Skip to navigation',
|
|
21
|
+
closeMenuLabel: 'Close',
|
|
22
|
+
closeMenuLabelLong: 'Close menu',
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
export const Layout = (props) => {
|
|
26
|
+
useScrollbarWidthCSSVar();
|
|
27
|
+
const { ssr, globalAlerts, mainChildren, navChildren, footerChildren, colorTheme, children, siteName = 'Reykjavík', logoLink = '/', } = props;
|
|
28
|
+
const { isMenuActive, isMenuOpen, closeMenu, toggleMenu } = useMenuToggling(ssr !== 'ssr-only');
|
|
29
|
+
const isBrowser = useIsBrowserSide( /* ssr */);
|
|
30
|
+
const txt = getTexts(props, defaultLayoutTexts);
|
|
31
|
+
return (React.createElement("div", { className: getBemClass('Layout', props.modifier), "data-sprinkled": isBrowser, "data-color-theme": colorTheme },
|
|
32
|
+
globalAlerts && (React.createElement("div", { className: "Layout__alerts", role: "alert" }, globalAlerts)),
|
|
33
|
+
React.createElement("div", { className: "Layout__content" },
|
|
34
|
+
React.createElement("div", { className: "Layout__header", role: "banner" },
|
|
35
|
+
React.createElement(Link, { className: "Layout__header__logo", href: logoLink },
|
|
36
|
+
' ',
|
|
37
|
+
React.createElement(Image, { className: undefined, inline: true, src: getAssetUrl('reykjavik-logo.svg') }),
|
|
38
|
+
' ',
|
|
39
|
+
siteName,
|
|
40
|
+
' '),
|
|
41
|
+
' ',
|
|
42
|
+
navChildren && (React.createElement(Link, { className: "Layout__header__skiplink", href: "#pagenav", onClick: isMenuActive &&
|
|
43
|
+
((e) => {
|
|
44
|
+
e.preventDefault();
|
|
45
|
+
toggleMenu();
|
|
46
|
+
}), "aria-label": txt.skipLinkLabel }, txt.skipLinkLabel))),
|
|
47
|
+
React.createElement("div", { className: "Layout__main", role: "main" }, mainChildren || children),
|
|
48
|
+
navChildren && (React.createElement("div", { className: "Layout__nav", id: "pagenav", role: "navigation" },
|
|
49
|
+
React.createElement(HannaUIState, { value: {
|
|
50
|
+
closeHamburgerMenu: closeMenu,
|
|
51
|
+
isHamburgerMenuOpen: isMenuOpen,
|
|
52
|
+
} }, navChildren),
|
|
53
|
+
isMenuActive && (React.createElement("button", { className: "Layout__nav__closebutton", onClick: closeMenu, "aria-label": txt.closeMenuLabelLong, type: "button" }, txt.closeMenuLabel)))),
|
|
54
|
+
React.createElement("div", { className: "Layout__footer", role: "complementary" }, footerChildren))));
|
|
55
|
+
};
|
|
56
|
+
export default Layout;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MegaMenuPanel } from './_PrimaryPanel.js';
|
|
2
|
+
export type AuxilaryPanelIllustration = 'hanna-veitiggi' | 'hanna-vandro' | 'hanna-hugsi' | 'hanna-hissa' | 'hanna-hahaha' | 'hanna-hae' | 'hanna-god_spurning' | 'hanna-gjuggiborg' | 'hanna-benda';
|
|
3
|
+
export type AuxiliaryPanelProps = MegaMenuPanel & {
|
|
4
|
+
image?: AuxilaryPanelIllustration;
|
|
5
|
+
};
|
|
6
|
+
export declare const AuxiliaryPanel: (props: AuxiliaryPanelProps) => JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { getIllustrationUrl } from '@reykjavik/hanna-utils/assets';
|
|
3
|
+
import { Link } from '../_abstract/_Link.js';
|
|
4
|
+
export const AuxiliaryPanel = (props) => {
|
|
5
|
+
const { title, id, items, image } = props;
|
|
6
|
+
const imageUrl = image ? getIllustrationUrl(image) : image;
|
|
7
|
+
return (React.createElement("li", { className: "AuxiliaryPanel", id: id, style: imageUrl
|
|
8
|
+
? { '--menu-auxiliary-image': `url(${imageUrl})` }
|
|
9
|
+
: undefined },
|
|
10
|
+
React.createElement("h3", { className: "AuxiliaryPanel__title" }, title),
|
|
11
|
+
React.createElement("ul", { className: "AuxiliaryPanel__items" }, items.map((item, i) => (React.createElement("li", { key: i, className: "AuxiliaryPanel__item", "aria-current": item.current || undefined },
|
|
12
|
+
React.createElement(Link, { className: "AuxiliaryPanel__link", href: item.href, target: item.target, lang: item.lang }, item.label)))))));
|
|
13
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type PrimaryPanelI18n = {
|
|
3
|
+
backToMenu: string;
|
|
4
|
+
backToMenuLong?: string;
|
|
5
|
+
};
|
|
6
|
+
export type MegaMenuItem = {
|
|
7
|
+
label: string;
|
|
8
|
+
summary?: string;
|
|
9
|
+
href: string;
|
|
10
|
+
lang?: string;
|
|
11
|
+
current?: boolean;
|
|
12
|
+
target?: string;
|
|
13
|
+
};
|
|
14
|
+
export type MegaMenuPanel = {
|
|
15
|
+
title: string;
|
|
16
|
+
items: Array<MegaMenuItem>;
|
|
17
|
+
id: string;
|
|
18
|
+
};
|
|
19
|
+
type PrimaryPanelProps = {
|
|
20
|
+
setActivePanel: (panel: MegaMenuPanel | undefined, setFocus?: boolean) => void;
|
|
21
|
+
isParent?: boolean;
|
|
22
|
+
isActive?: boolean;
|
|
23
|
+
panel: MegaMenuPanel;
|
|
24
|
+
texts: PrimaryPanelI18n;
|
|
25
|
+
activeRef: RefObject<HTMLLIElement>;
|
|
26
|
+
isBrowser: true | undefined;
|
|
27
|
+
};
|
|
28
|
+
export declare const PrimaryPanel: (props: PrimaryPanelProps) => JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
+
import { Link } from '../_abstract/_Link.js';
|
|
4
|
+
export const PrimaryPanel = (props) => {
|
|
5
|
+
const { setActivePanel, panel, isParent, isActive, isBrowser, texts } = props;
|
|
6
|
+
const { items } = panel;
|
|
7
|
+
return (React.createElement("li", { ref: isActive ? props.activeRef : undefined, className: getBemClass('PrimaryPanel', [
|
|
8
|
+
isParent && 'parent',
|
|
9
|
+
isActive && 'active',
|
|
10
|
+
items.length > 5 && 'twocol', // TODO: allow setting twocol manually?
|
|
11
|
+
]), id: panel.id },
|
|
12
|
+
React.createElement("h3", { className: "PrimaryPanel__title" },
|
|
13
|
+
' ',
|
|
14
|
+
isBrowser && !isActive ? (React.createElement("button", { className: "MainMenu__mega__title-toggler", "aria-controls": panel.id, onClick: () => setActivePanel(panel, false), "aria-pressed": isActive, type: "button" }, panel.title)) : (panel.title)),
|
|
15
|
+
React.createElement("ul", { className: "PrimaryPanel__items" }, items.map((item, i) => (React.createElement("li", { key: i, className: "PrimaryPanel__item", "aria-current": item.current || undefined },
|
|
16
|
+
React.createElement(Link, { className: "PrimaryPanel__link", href: item.href, target: item.target, lang: item.lang },
|
|
17
|
+
React.createElement("span", { className: "PrimaryPanel__linkTitle" }, item.label),
|
|
18
|
+
' ',
|
|
19
|
+
React.createElement("small", { className: "PrimaryPanel__summary" }, item.summary),
|
|
20
|
+
' '))))),
|
|
21
|
+
isBrowser && isActive && (React.createElement("button", { className: "MainMenu__megapanel__backtomenu", "aria-controls": panel.id, "aria-label": texts.backToMenuLong, onClick: () => setActivePanel(undefined), type: "button" }, texts.backToMenu))));
|
|
22
|
+
};
|