@agilant/toga-blox 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badge/Badge.d.ts +4 -0
- package/dist/components/Badge/Badge.js +9 -0
- package/dist/components/Badge/Badge.stories.d.ts +7 -0
- package/dist/components/Badge/Badge.stories.js +196 -0
- package/dist/components/Badge/Badge.test.d.ts +1 -0
- package/dist/components/Badge/Badge.test.js +80 -0
- package/dist/components/Badge/Badge.types.d.ts +25 -0
- package/dist/components/Badge/Badge.types.js +1 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Card/Card.d.ts +4 -0
- package/dist/components/Card/Card.js +11 -0
- package/dist/components/Card/Card.stories.d.ts +12 -0
- package/dist/components/Card/Card.stories.js +173 -0
- package/dist/components/Card/Card.test.d.ts +1 -0
- package/dist/components/Card/Card.test.js +35 -0
- package/dist/components/Card/Card.types.d.ts +10 -0
- package/dist/components/Card/Card.types.js +1 -0
- package/dist/components/Card/DUMMYPRODUCTDATA.json +826 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/Card/templates/CategoryCardTemplate.d.ts +27 -0
- package/dist/components/Card/templates/CategoryCardTemplate.js +7 -0
- package/dist/components/Card/templates/CompassCardTemplate.d.ts +23 -0
- package/dist/components/Card/templates/CompassCardTemplate.js +7 -0
- package/dist/components/Card/templates/CounterContentCardTemplate.d.ts +53 -0
- package/dist/components/Card/templates/CounterContentCardTemplate.js +46 -0
- package/dist/components/Card/templates/HorizontalCardTemplate.d.ts +65 -0
- package/dist/components/Card/templates/HorizontalCardTemplate.js +13 -0
- package/dist/components/Card/templates/ItemCardTemplate.d.ts +61 -0
- package/dist/components/Card/templates/ItemCardTemplate.js +9 -0
- package/dist/components/Card/templates/KitContentCardTemplate.d.ts +53 -0
- package/dist/components/Card/templates/KitContentCardTemplate.js +9 -0
- package/dist/components/Card/templates/ShippingAddressCardTemplate.d.ts +15 -0
- package/dist/components/Card/templates/ShippingAddressCardTemplate.js +9 -0
- package/dist/components/Card/templates/VerticalCardTemplate.d.ts +61 -0
- package/dist/components/Card/templates/VerticalCardTemplate.js +9 -0
- package/dist/components/CounterButton/CounterButton.d.ts +4 -0
- package/dist/components/CounterButton/CounterButton.js +7 -0
- package/dist/components/CounterButton/CounterButton.stories.d.ts +4 -0
- package/dist/components/CounterButton/CounterButton.stories.js +69 -0
- package/dist/components/CounterButton/CounterButton.types.d.ts +10 -0
- package/dist/components/CounterButton/CounterButton.types.js +1 -0
- package/dist/components/Description/Description.d.ts +4 -0
- package/dist/components/Description/Description.js +5 -0
- package/dist/components/Description/Description.stories.d.ts +5 -0
- package/dist/components/Description/Description.stories.js +54 -0
- package/dist/components/Description/Description.types.d.ts +8 -0
- package/dist/components/Description/Description.types.js +1 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.d.ts +4 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.js +24 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.stories.d.ts +6 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.stories.js +145 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.test.d.ts +1 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.test.js +40 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.types.d.ts +20 -0
- package/dist/components/DropDownIconButton/DropDownIconButton.types.js +1 -0
- package/dist/components/DropDownIconButton/index.js +2 -0
- package/dist/components/Footer/ContactInfoItem.d.ts +7 -0
- package/dist/components/Footer/ContactInfoItem.js +4 -0
- package/dist/components/Footer/DUMMYFOOTERDATA.json +132 -0
- package/dist/components/Footer/Footer.d.ts +4 -0
- package/dist/components/Footer/Footer.js +12 -0
- package/dist/components/Footer/Footer.stories.d.ts +7 -0
- package/dist/components/Footer/Footer.stories.js +155 -0
- package/dist/components/Footer/Footer.test.d.ts +1 -0
- package/dist/components/Footer/Footer.test.js +48 -0
- package/dist/components/Footer/Footer.types.d.ts +42 -0
- package/dist/components/Footer/Footer.types.js +1 -0
- package/dist/components/FormButton/FormButton.d.ts +4 -0
- package/dist/components/FormButton/FormButton.js +49 -0
- package/dist/components/FormButton/FormButton.stories.d.ts +12 -0
- package/dist/components/FormButton/FormButton.stories.js +200 -0
- package/dist/components/FormButton/FormButton.test.d.ts +1 -0
- package/dist/components/FormButton/FormButton.test.js +27 -0
- package/dist/components/FormButton/FormButton.types.d.ts +24 -0
- package/dist/components/FormButton/FormButton.types.js +1 -0
- package/dist/components/FormButton/index.js +2 -0
- package/dist/components/GenericList/DUMMYLISTDATA.json +560 -0
- package/dist/components/GenericList/GenericList.d.ts +16 -0
- package/dist/components/GenericList/GenericList.js +50 -0
- package/dist/components/GenericList/GenericList.stories.d.ts +35 -0
- package/dist/components/GenericList/GenericList.stories.js +87 -0
- package/dist/components/GenericList/GenericList.test.d.ts +1 -0
- package/dist/components/GenericList/GenericList.test.js +24 -0
- package/dist/components/GenericList/templates/DummyDataList.d.ts +6 -0
- package/dist/components/GenericList/templates/DummyDataList.js +6 -0
- package/dist/components/GenericList/templates/DynamicIconList.d.ts +32 -0
- package/dist/components/GenericList/templates/DynamicIconList.js +7 -0
- package/dist/components/GetSupport/GetSupport.d.ts +4 -0
- package/dist/components/GetSupport/GetSupport.js +7 -0
- package/dist/components/GetSupport/GetSupport.stories.d.ts +5 -0
- package/dist/components/GetSupport/GetSupport.stories.js +70 -0
- package/dist/components/GetSupport/GetSupport.test.d.ts +1 -0
- package/dist/components/GetSupport/GetSupport.test.js +49 -0
- package/dist/components/GetSupport/GetSupport.types.d.ts +11 -0
- package/dist/components/GetSupport/GetSupport.types.js +1 -0
- package/dist/components/HamburgerButton/Hamburger.stories.d.ts +5 -0
- package/dist/components/HamburgerButton/Hamburger.stories.js +97 -0
- package/dist/components/HamburgerButton/HamburgerButton.d.ts +4 -0
- package/dist/components/HamburgerButton/HamburgerButton.js +15 -0
- package/dist/components/HamburgerButton/HamburgerButton.types.d.ts +7 -0
- package/dist/components/HamburgerButton/HamburgerButton.types.js +1 -0
- package/dist/components/HamburgerButton/index.js +2 -0
- package/dist/components/Header/DUMMYICONDATA.json +136 -0
- package/dist/components/Header/Header.d.ts +4 -0
- package/dist/components/Header/Header.js +62 -0
- package/dist/components/Header/Header.stories.d.ts +8 -0
- package/dist/components/Header/Header.stories.js +225 -0
- package/dist/components/Header/Header.test.d.ts +1 -0
- package/dist/components/Header/Header.test.js +107 -0
- package/dist/components/Header/Header.types.d.ts +40 -0
- package/dist/components/Header/Header.types.js +1 -0
- package/dist/components/Header/headerContext.d.ts +39 -0
- package/dist/components/Header/headerContext.js +44 -0
- package/dist/components/Header/index.js +2 -0
- package/dist/components/Hero/Hero.d.ts +4 -0
- package/dist/components/Hero/Hero.js +21 -0
- package/dist/components/Hero/Hero.stories.d.ts +13 -0
- package/dist/components/Hero/Hero.stories.js +46 -0
- package/dist/components/Hero/Hero.test.d.ts +1 -0
- package/dist/components/Hero/Hero.test.js +62 -0
- package/dist/components/Hero/Hero.types.d.ts +8 -0
- package/dist/components/Hero/Hero.types.js +1 -0
- package/dist/components/Hero/index.js +2 -0
- package/dist/components/IconButton/IconButton.d.ts +4 -0
- package/dist/components/IconButton/IconButton.js +18 -0
- package/dist/components/IconButton/IconButton.stories.d.ts +7 -0
- package/dist/components/IconButton/IconButton.stories.js +187 -0
- package/dist/components/IconButton/IconButton.test.d.ts +1 -0
- package/dist/components/IconButton/IconButton.test.js +28 -0
- package/dist/components/IconButton/IconButton.types.d.ts +27 -0
- package/dist/components/IconButton/IconButton.types.js +1 -0
- package/dist/components/IconButton/index.js +2 -0
- package/dist/components/Image/Image.d.ts +4 -0
- package/dist/components/Image/Image.js +19 -0
- package/dist/components/Image/Image.stories.d.ts +14 -0
- package/dist/components/Image/Image.stories.js +63 -0
- package/dist/components/Image/Image.test.d.ts +1 -0
- package/dist/components/Image/Image.test.js +47 -0
- package/dist/components/Image/Image.types.d.ts +12 -0
- package/dist/components/Image/Image.types.js +1 -0
- package/dist/components/Image/index.js +2 -0
- package/dist/components/Input/Input.d.ts +4 -0
- package/dist/components/Input/Input.js +51 -0
- package/dist/components/Input/Input.stories.d.ts +13 -0
- package/dist/components/Input/Input.stories.js +364 -0
- package/dist/components/Input/Input.test.d.ts +1 -0
- package/dist/components/Input/Input.test.js +45 -0
- package/dist/components/Input/Input.types.d.ts +36 -0
- package/dist/components/Input/Input.types.js +1 -0
- package/dist/components/Input/InputMemoTypes.d.ts +2 -0
- package/dist/components/Input/InputMemoTypes.js +28 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/MobileMenu/MobileMenu.d.ts +3 -0
- package/dist/components/MobileMenu/MobileMenu.js +7 -0
- package/dist/components/MobileMenu/MobileMenu.types.d.ts +20 -0
- package/dist/components/MobileMenu/MobileMenu.types.js +1 -0
- package/dist/components/MobileMenu/index.js +2 -0
- package/dist/components/Nav/DUMMYNAVDATA.json +234 -0
- package/dist/components/Nav/Nav.d.ts +4 -0
- package/dist/components/Nav/Nav.js +31 -0
- package/dist/components/Nav/Nav.stories.d.ts +6 -0
- package/dist/components/Nav/Nav.stories.js +164 -0
- package/dist/components/Nav/Nav.test.d.ts +1 -0
- package/dist/components/Nav/Nav.test.js +52 -0
- package/dist/components/Nav/Nav.types.d.ts +38 -0
- package/dist/components/Nav/Nav.types.js +1 -0
- package/dist/components/Nav/index.js +2 -0
- package/dist/components/Page/TableDataDummy.d.ts +3 -0
- package/dist/components/Page/TableDataDummy.js +5 -0
- package/dist/components/Page/ViewPageTemplate.d.ts +3 -0
- package/dist/components/Page/ViewPageTemplate.js +5 -0
- package/dist/components/Page/ViewPageTemplate.stories.d.ts +8 -0
- package/dist/components/Page/ViewPageTemplate.stories.js +73 -0
- package/dist/components/Page/ViewPageTemplate.test.d.ts +1 -0
- package/dist/components/Page/ViewPageTemplate.test.js +71 -0
- package/{src/components/Page/ViewPageTemplate.types.ts → dist/components/Page/ViewPageTemplate.types.d.ts} +2 -3
- package/dist/components/Page/ViewPageTemplate.types.js +1 -0
- package/dist/components/Page/index.js +2 -0
- package/dist/components/PageSection/PageSection.d.ts +4 -0
- package/dist/components/PageSection/PageSection.js +5 -0
- package/dist/components/PageSection/PageSection.stories.d.ts +6 -0
- package/dist/components/PageSection/PageSection.stories.js +40 -0
- package/{src/components/PageSection/PageSection.types.ts → dist/components/PageSection/PageSection.types.d.ts} +2 -3
- package/dist/components/PageSection/PageSection.types.js +1 -0
- package/dist/components/PageSection/PageSections.test.d.ts +1 -0
- package/dist/components/PageSection/PageSections.test.js +31 -0
- package/dist/components/PageSection/index.js +2 -0
- package/dist/components/SearchInput/SearchInput.d.ts +4 -0
- package/dist/components/SearchInput/SearchInput.js +17 -0
- package/dist/components/SearchInput/SearchInput.stories.d.ts +9 -0
- package/dist/components/SearchInput/SearchInput.stories.js +128 -0
- package/dist/components/SearchInput/SearchInput.types.d.ts +25 -0
- package/dist/components/SearchInput/SearchInput.types.js +1 -0
- package/dist/components/Slider/Slider.d.ts +4 -0
- package/dist/components/Slider/Slider.js +56 -0
- package/dist/components/Slider/Slider.stories.d.ts +6 -0
- package/dist/components/Slider/Slider.stories.js +82 -0
- package/dist/components/Slider/Slider.types.d.ts +21 -0
- package/dist/components/Slider/Slider.types.js +1 -0
- package/dist/components/Submenus/AdminSubmenu.d.ts +4 -0
- package/dist/components/Submenus/AdminSubmenu.js +5 -0
- package/dist/components/Submenus/AlertSubmenu.d.ts +4 -0
- package/dist/components/Submenus/AlertSubmenu.js +7 -0
- package/dist/components/Submenus/AlertSubmenuItem.d.ts +4 -0
- package/dist/components/Submenus/AlertSubmenuItem.js +5 -0
- package/dist/components/Submenus/types.d.ts +29 -0
- package/dist/components/Submenus/types.js +1 -0
- package/dist/components/Text/Text.d.ts +4 -0
- package/dist/components/Text/Text.js +12 -0
- package/dist/components/Text/Text.stories.d.ts +5 -0
- package/dist/components/Text/Text.stories.js +79 -0
- package/dist/components/Text/Text.test.d.ts +1 -0
- package/dist/components/Text/Text.test.js +31 -0
- package/{src/components/Text/Text.types.ts → dist/components/Text/Text.types.d.ts} +6 -8
- package/dist/components/Text/Text.types.js +1 -0
- package/dist/components/Text/index.js +2 -0
- package/dist/components/Toaster/Toaster.d.ts +4 -0
- package/dist/components/Toaster/Toaster.js +22 -0
- package/dist/components/Toaster/Toaster.stories.d.ts +23 -0
- package/dist/components/Toaster/Toaster.stories.js +102 -0
- package/dist/components/Toaster/Toaster.test.d.ts +1 -0
- package/dist/components/Toaster/Toaster.test.js +47 -0
- package/dist/components/Toaster/Toaster.types.d.ts +15 -0
- package/dist/components/Toaster/Toaster.types.js +1 -0
- package/dist/components/Toaster/index.js +2 -0
- package/dist/hoc/index.d.ts +1 -0
- package/dist/hoc/styling/withStoryBook.d.ts +6 -0
- package/dist/hoc/styling/withStoryBook.js +7 -0
- package/dist/main.css +1 -0
- package/dist/setupTests.js +1 -0
- package/dist/userHoc/index.js +1 -0
- package/dist/userHoc/withMemo.d.ts +5 -0
- package/dist/userHoc/withMemo.js +6 -0
- package/dist/utils/assertTagName.d.ts +3 -0
- package/dist/utils/assertTagName.js +6 -0
- package/dist/utils/generateAccordionItem.d.ts +15 -0
- package/dist/utils/generateAccordionItem.js +22 -0
- package/dist/utils/generateFooterContacts.d.ts +14 -0
- package/dist/utils/generateFooterContacts.js +19 -0
- package/dist/utils/generateNavMenu.d.ts +14 -0
- package/dist/utils/generateNavMenu.js +5 -0
- package/dist/utils/generateSocialList.d.ts +12 -0
- package/dist/utils/generateSocialList.js +4 -0
- package/dist/utils/getFontAwesomeIcon.d.ts +2 -0
- package/dist/utils/getFontAwesomeIcon.js +19 -0
- package/dist/utils/inputValidation.d.ts +6 -0
- package/dist/utils/inputValidation.js +12 -0
- package/package.json +9 -4
- package/.gitattributes +0 -5
- package/Dockerfile +0 -9
- package/assets/Logo.png +0 -0
- package/assets/cable.jpg +0 -0
- package/assets/card-1.jpg +0 -0
- package/assets/cat-logo.png +0 -0
- package/assets/compass-card-image-2.png +0 -0
- package/assets/compass-card-image-3.png +0 -0
- package/assets/compass-card-image-4.png +0 -0
- package/assets/compass-card-image.png +0 -0
- package/assets/compass-logo.png +0 -0
- package/assets/compass-tech-hero-bg.png +0 -0
- package/assets/contact-image.png +0 -0
- package/assets/green-laptop.png +0 -0
- package/assets/heroImage.png +0 -0
- package/assets/item.jpg +0 -0
- package/assets/map.png +0 -0
- package/assets/placeholder-no-image-available.png +0 -0
- package/assets/team.png +0 -0
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -953
- package/coverage/coverage-final.json +0 -74
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -551
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
- package/coverage/toga-blox-npm/index.html +0 -131
- package/coverage/toga-blox-npm/postcss.config.js.html +0 -103
- package/coverage/toga-blox-npm/src/components/Badge/Badge.stories.tsx.html +0 -793
- package/coverage/toga-blox-npm/src/components/Badge/Badge.tsx.html +0 -247
- package/coverage/toga-blox-npm/src/components/Badge/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Card/Card.stories.tsx.html +0 -787
- package/coverage/toga-blox-npm/src/components/Card/Card.tsx.html +0 -163
- package/coverage/toga-blox-npm/src/components/Card/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Card/templates/CategoryCardTemplate.tsx.html +0 -343
- package/coverage/toga-blox-npm/src/components/Card/templates/CompassCardTemplate.tsx.html +0 -259
- package/coverage/toga-blox-npm/src/components/Card/templates/CounterContentCardTemplate.tsx.html +0 -685
- package/coverage/toga-blox-npm/src/components/Card/templates/HorizontalCardTemplate.tsx.html +0 -637
- package/coverage/toga-blox-npm/src/components/Card/templates/ItemCardTemplate.tsx.html +0 -550
- package/coverage/toga-blox-npm/src/components/Card/templates/KitContentCardTemplate.tsx.html +0 -469
- package/coverage/toga-blox-npm/src/components/Card/templates/ShippingAddressCardTemplate.tsx.html +0 -418
- package/coverage/toga-blox-npm/src/components/Card/templates/VerticalCardTemplate.tsx.html +0 -592
- package/coverage/toga-blox-npm/src/components/Card/templates/index.html +0 -221
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.stories.tsx.html +0 -358
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.tsx.html +0 -385
- package/coverage/toga-blox-npm/src/components/CounterButton/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Description/Description.stories.tsx.html +0 -286
- package/coverage/toga-blox-npm/src/components/Description/Description.tsx.html +0 -124
- package/coverage/toga-blox-npm/src/components/Description/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.stories.tsx.html +0 -676
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.tsx.html +0 -346
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Footer/ContactInfoItem.tsx.html +0 -139
- package/coverage/toga-blox-npm/src/components/Footer/Footer.stories.tsx.html +0 -934
- package/coverage/toga-blox-npm/src/components/Footer/Footer.tsx.html +0 -373
- package/coverage/toga-blox-npm/src/components/Footer/index.html +0 -146
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.stories.tsx.html +0 -952
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.tsx.html +0 -343
- package/coverage/toga-blox-npm/src/components/FormButton/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.stories.tsx.html +0 -376
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.tsx.html +0 -520
- package/coverage/toga-blox-npm/src/components/GenericList/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DummyDataList.tsx.html +0 -154
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DynamicIconList.tsx.html +0 -250
- package/coverage/toga-blox-npm/src/components/GenericList/templates/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.stories.tsx.html +0 -325
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.tsx.html +0 -262
- package/coverage/toga-blox-npm/src/components/GetSupport/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/HamburgerButton/Hamburger.stories.tsx.html +0 -760
- package/coverage/toga-blox-npm/src/components/HamburgerButton/HamburgerButton.tsx.html +0 -232
- package/coverage/toga-blox-npm/src/components/HamburgerButton/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Header/Header.stories.tsx.html +0 -1633
- package/coverage/toga-blox-npm/src/components/Header/Header.tsx.html +0 -814
- package/coverage/toga-blox-npm/src/components/Header/headerContext.tsx.html +0 -460
- package/coverage/toga-blox-npm/src/components/Header/index.html +0 -146
- package/coverage/toga-blox-npm/src/components/Hero/Hero.stories.tsx.html +0 -289
- package/coverage/toga-blox-npm/src/components/Hero/Hero.tsx.html +0 -259
- package/coverage/toga-blox-npm/src/components/Hero/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.stories.tsx.html +0 -673
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.tsx.html +0 -313
- package/coverage/toga-blox-npm/src/components/IconButton/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Image/Image.stories.tsx.html +0 -322
- package/coverage/toga-blox-npm/src/components/Image/Image.tsx.html +0 -226
- package/coverage/toga-blox-npm/src/components/Image/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Input/Input.stories.tsx.html +0 -1621
- package/coverage/toga-blox-npm/src/components/Input/Input.tsx.html +0 -568
- package/coverage/toga-blox-npm/src/components/Input/InputMemoTypes.tsx.html +0 -181
- package/coverage/toga-blox-npm/src/components/Input/index.html +0 -146
- package/coverage/toga-blox-npm/src/components/MobileMenu/MobileMenu.tsx.html +0 -208
- package/coverage/toga-blox-npm/src/components/MobileMenu/index.html +0 -116
- package/coverage/toga-blox-npm/src/components/Nav/Nav.stories.tsx.html +0 -628
- package/coverage/toga-blox-npm/src/components/Nav/Nav.tsx.html +0 -622
- package/coverage/toga-blox-npm/src/components/Nav/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Page/TableDataDummy.tsx.html +0 -733
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.stories.tsx.html +0 -1714
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.tsx.html +0 -115
- package/coverage/toga-blox-npm/src/components/Page/index.html +0 -146
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.stories.tsx.html +0 -433
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.tsx.html +0 -121
- package/coverage/toga-blox-npm/src/components/PageSection/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.stories.tsx.html +0 -517
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.tsx.html +0 -325
- package/coverage/toga-blox-npm/src/components/SearchInput/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Slider/Slider.stories.tsx.html +0 -349
- package/coverage/toga-blox-npm/src/components/Slider/Slider.tsx.html +0 -502
- package/coverage/toga-blox-npm/src/components/Slider/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Submenus/AdminSubmenu.tsx.html +0 -136
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenu.tsx.html +0 -253
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenuItem.tsx.html +0 -202
- package/coverage/toga-blox-npm/src/components/Submenus/index.html +0 -146
- package/coverage/toga-blox-npm/src/components/Text/Text.stories.tsx.html +0 -235
- package/coverage/toga-blox-npm/src/components/Text/Text.tsx.html +0 -172
- package/coverage/toga-blox-npm/src/components/Text/index.html +0 -131
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.stories.tsx.html +0 -445
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.tsx.html +0 -301
- package/coverage/toga-blox-npm/src/components/Toaster/index.html +0 -131
- package/coverage/toga-blox-npm/src/hoc/styling/index.html +0 -116
- package/coverage/toga-blox-npm/src/hoc/styling/withStoryBook.tsx.html +0 -142
- package/coverage/toga-blox-npm/src/userHoc/index.html +0 -116
- package/coverage/toga-blox-npm/src/userHoc/withMemo.tsx.html +0 -145
- package/coverage/toga-blox-npm/src/utils/assertTagName.tsx.html +0 -106
- package/coverage/toga-blox-npm/src/utils/generateAccordionItem.tsx.html +0 -373
- package/coverage/toga-blox-npm/src/utils/generateFooterContacts.tsx.html +0 -295
- package/coverage/toga-blox-npm/src/utils/generateNavMenu.tsx.html +0 -247
- package/coverage/toga-blox-npm/src/utils/generateSocialList.tsx.html +0 -187
- package/coverage/toga-blox-npm/src/utils/getFontAwesomeIcon.tsx.html +0 -145
- package/coverage/toga-blox-npm/src/utils/index.html +0 -206
- package/coverage/toga-blox-npm/src/utils/inputValidation.tsx.html +0 -163
- package/coverage/toga-blox-npm/tailwind.config.js.html +0 -205
- package/declarations.d.ts +0 -4
- package/docker-compose.yml +0 -22
- package/global.css +0 -4
- package/index.js +0 -4
- package/nodemon.json +0 -5
- package/postcss.config.js +0 -6
- package/src/components/Badge/Badge.stories.tsx +0 -236
- package/src/components/Badge/Badge.test.tsx +0 -175
- package/src/components/Badge/Badge.tsx +0 -54
- package/src/components/Badge/Badge.types.tsx +0 -26
- package/src/components/Card/Card.stories.tsx +0 -235
- package/src/components/Card/Card.test.tsx +0 -53
- package/src/components/Card/Card.tsx +0 -26
- package/src/components/Card/Card.types.ts +0 -11
- package/src/components/Card/DUMMYPRODUCTDATA.json +0 -826
- package/src/components/Card/templates/CategoryCardTemplate.tsx +0 -86
- package/src/components/Card/templates/CompassCardTemplate.tsx +0 -58
- package/src/components/Card/templates/CounterContentCardTemplate.tsx +0 -200
- package/src/components/Card/templates/HorizontalCardTemplate.tsx +0 -184
- package/src/components/Card/templates/ItemCardTemplate.tsx +0 -155
- package/src/components/Card/templates/KitContentCardTemplate.tsx +0 -128
- package/src/components/Card/templates/ShippingAddressCardTemplate.tsx +0 -111
- package/src/components/Card/templates/VerticalCardTemplate.tsx +0 -169
- package/src/components/CounterButton/CounterButton.stories.tsx +0 -91
- package/src/components/CounterButton/CounterButton.tsx +0 -100
- package/src/components/CounterButton/CounterButton.types.ts +0 -12
- package/src/components/Description/Description.stories.tsx +0 -67
- package/src/components/Description/Description.tsx +0 -13
- package/src/components/Description/Description.types.ts +0 -9
- package/src/components/DropDownIconButton/DropDownIconButton.stories.tsx +0 -197
- package/src/components/DropDownIconButton/DropDownIconButton.test.tsx +0 -90
- package/src/components/DropDownIconButton/DropDownIconButton.tsx +0 -87
- package/src/components/DropDownIconButton/DropDownIconButton.types.ts +0 -21
- package/src/components/Footer/ContactInfoItem.tsx +0 -18
- package/src/components/Footer/DUMMYFOOTERDATA.json +0 -132
- package/src/components/Footer/Footer.stories.tsx +0 -283
- package/src/components/Footer/Footer.test.tsx +0 -90
- package/src/components/Footer/Footer.tsx +0 -96
- package/src/components/Footer/Footer.types.tsx +0 -61
- package/src/components/FormButton/FormButton.stories.tsx +0 -289
- package/src/components/FormButton/FormButton.test.tsx +0 -73
- package/src/components/FormButton/FormButton.tsx +0 -86
- package/src/components/FormButton/FormButton.types.ts +0 -27
- package/src/components/GenericList/DUMMYLISTDATA.json +0 -560
- package/src/components/GenericList/GenericList.stories.tsx +0 -97
- package/src/components/GenericList/GenericList.test.tsx +0 -29
- package/src/components/GenericList/GenericList.tsx +0 -145
- package/src/components/GenericList/templates/DummyDataList.tsx +0 -23
- package/src/components/GenericList/templates/DynamicIconList.tsx +0 -55
- package/src/components/GetSupport/GetSupport.stories.tsx +0 -80
- package/src/components/GetSupport/GetSupport.test.tsx +0 -62
- package/src/components/GetSupport/GetSupport.tsx +0 -59
- package/src/components/GetSupport/GetSupport.types.ts +0 -11
- package/src/components/HamburgerButton/Hamburger.stories.tsx +0 -225
- package/src/components/HamburgerButton/HamburgerButton.tsx +0 -49
- package/src/components/HamburgerButton/HamburgerButton.types.tsx +0 -7
- package/src/components/Header/DUMMYICONDATA.json +0 -136
- package/src/components/Header/Header.stories.tsx +0 -516
- package/src/components/Header/Header.test.tsx +0 -322
- package/src/components/Header/Header.tsx +0 -243
- package/src/components/Header/Header.types.ts +0 -52
- package/src/components/Header/headerContext.tsx +0 -125
- package/src/components/Hero/Hero.stories.tsx +0 -68
- package/src/components/Hero/Hero.test.tsx +0 -109
- package/src/components/Hero/Hero.tsx +0 -58
- package/src/components/Hero/Hero.types.ts +0 -9
- package/src/components/IconButton/IconButton.stories.tsx +0 -196
- package/src/components/IconButton/IconButton.test.tsx +0 -52
- package/src/components/IconButton/IconButton.tsx +0 -76
- package/src/components/IconButton/IconButton.types.ts +0 -28
- package/src/components/Image/Image.stories.tsx +0 -79
- package/src/components/Image/Image.test.tsx +0 -87
- package/src/components/Image/Image.tsx +0 -47
- package/src/components/Image/Image.types.ts +0 -11
- package/src/components/Image/declarations.d.ts +0 -24
- package/src/components/Input/Input.stories.tsx +0 -512
- package/src/components/Input/Input.test.tsx +0 -89
- package/src/components/Input/Input.tsx +0 -161
- package/src/components/Input/Input.types.ts +0 -52
- package/src/components/Input/InputMemoTypes.tsx +0 -32
- package/src/components/MobileMenu/MobileMenu.tsx +0 -41
- package/src/components/MobileMenu/MobileMenu.types.tsx +0 -28
- package/src/components/Nav/DUMMYNAVDATA.json +0 -234
- package/src/components/Nav/Nav.stories.tsx +0 -181
- package/src/components/Nav/Nav.test.tsx +0 -89
- package/src/components/Nav/Nav.tsx +0 -179
- package/src/components/Nav/Nav.types.tsx +0 -47
- package/src/components/Page/TableDataDummy.tsx +0 -216
- package/src/components/Page/ViewPageTemplate.stories.tsx +0 -543
- package/src/components/Page/ViewPageTemplate.test.tsx +0 -361
- package/src/components/Page/ViewPageTemplate.tsx +0 -10
- package/src/components/PageSection/PageSection.stories.tsx +0 -116
- package/src/components/PageSection/PageSection.tsx +0 -12
- package/src/components/PageSection/PageSections.test.tsx +0 -89
- package/src/components/SearchInput/SearchInput.stories.tsx +0 -144
- package/src/components/SearchInput/SearchInput.tsx +0 -81
- package/src/components/SearchInput/SearchInput.types.ts +0 -28
- package/src/components/Slider/Slider.stories.tsx +0 -88
- package/src/components/Slider/Slider.tsx +0 -139
- package/src/components/Slider/Slider.types.ts +0 -21
- package/src/components/Submenus/AdminSubmenu.tsx +0 -17
- package/src/components/Submenus/AlertSubmenu.tsx +0 -56
- package/src/components/Submenus/AlertSubmenuItem.tsx +0 -39
- package/src/components/Submenus/types.tsx +0 -32
- package/src/components/Text/Text.stories.tsx +0 -50
- package/src/components/Text/Text.test.tsx +0 -52
- package/src/components/Text/Text.tsx +0 -29
- package/src/components/Toaster/Toaster.stories.tsx +0 -120
- package/src/components/Toaster/Toaster.test.tsx +0 -60
- package/src/components/Toaster/Toaster.tsx +0 -72
- package/src/components/Toaster/Toaster.types.ts +0 -12
- package/src/hoc/styling/withStoryBook.tsx +0 -19
- package/src/main.css +0 -3
- package/src/userHoc/withMemo.tsx +0 -20
- package/src/utils/assertTagName.tsx +0 -7
- package/src/utils/generateAccordionItem.tsx +0 -96
- package/src/utils/generateFooterContacts.tsx +0 -70
- package/src/utils/generateNavMenu.tsx +0 -54
- package/src/utils/generateSocialList.tsx +0 -34
- package/src/utils/getFontAwesomeIcon.tsx +0 -20
- package/src/utils/inputValidation.tsx +0 -26
- package/tailwind.config.js +0 -40
- package/tsconfig.json +0 -25
- package/vite.config.ts +0 -33
- /package/{src/components/Badge/index.ts → dist/components/Badge/index.d.ts} +0 -0
- /package/{src/components/Card/index.ts → dist/components/Card/index.js} +0 -0
- /package/{src/components/DropDownIconButton/index.ts → dist/components/DropDownIconButton/index.d.ts} +0 -0
- /package/{src/components/FormButton/index.ts → dist/components/FormButton/index.d.ts} +0 -0
- /package/{src/components/HamburgerButton/index.ts → dist/components/HamburgerButton/index.d.ts} +0 -0
- /package/{src/components/Header/index.ts → dist/components/Header/index.d.ts} +0 -0
- /package/{src/components/Hero/index.ts → dist/components/Hero/index.d.ts} +0 -0
- /package/{src/components/IconButton/index.ts → dist/components/IconButton/index.d.ts} +0 -0
- /package/{src/components/Image/index.ts → dist/components/Image/index.d.ts} +0 -0
- /package/{src/components/Input/index.ts → dist/components/Input/index.d.ts} +0 -0
- /package/{src/components/MobileMenu/index.ts → dist/components/MobileMenu/index.d.ts} +0 -0
- /package/{src/components/Nav/index.ts → dist/components/Nav/index.d.ts} +0 -0
- /package/{src/components/Page/index.ts → dist/components/Page/index.d.ts} +0 -0
- /package/{src/components/PageSection/index.ts → dist/components/PageSection/index.d.ts} +0 -0
- /package/{src/components/Text/index.ts → dist/components/Text/index.d.ts} +0 -0
- /package/{src/components/Toaster/index.ts → dist/components/Toaster/index.d.ts} +0 -0
- /package/{src/hoc/index.ts → dist/hoc/index.js} +0 -0
- /package/{src/setupTests.ts → dist/setupTests.d.ts} +0 -0
- /package/{src/userHoc/index.ts → dist/userHoc/index.d.ts} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { motion, AnimatePresence, MotionConfig } from "framer-motion";
|
|
4
|
+
import MobileMenu from "../MobileMenu/MobileMenu";
|
|
5
|
+
import { HeaderProvider } from "./headerContext";
|
|
6
|
+
import HamburgerButton from "../HamburgerButton/HamburgerButton";
|
|
7
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
8
|
+
const justifyMap = {
|
|
9
|
+
start: "justify-start",
|
|
10
|
+
center: "justify-center",
|
|
11
|
+
end: "justify-end",
|
|
12
|
+
between: "justify-between",
|
|
13
|
+
around: "justify-around",
|
|
14
|
+
};
|
|
15
|
+
const Header = ({ logo, badge, nav, input, icons, backgroundColor = "bg-white", bottomBorderColor = "border-b-2", hasGlass = false, logoBorderRadius = "rounded-md", logoHoverColor = "hover:bg-gray-200", hasAnimatedHamburgerButton = false, hasMobileMenu, mobileLeft = true, mobileRight = false, mobileMenuBackground = "bg-white", iconsData, hasIcons = false, hasNavItems = false, hasBadge = false, hasSearchBar = false, hasMobileIcons = true, hasMobileNavItems = true, hasMobileBadge = true, hasMobileSearchBar = true, justifyNav = "center", justifyInput = "center", justifyBadge = "center", justifyIcons = "center", logoOrder = 1, navOrder = 2, inputOrder = 3, badgeOrder = 4, iconsOrder = 5, }) => {
|
|
16
|
+
const [navSideMenuVisibility, setNavSideMenuVisibility] = useState(false);
|
|
17
|
+
const handleNav = () => {
|
|
18
|
+
setNavSideMenuVisibility(!navSideMenuVisibility);
|
|
19
|
+
};
|
|
20
|
+
const burgerAriaLabel = navSideMenuVisibility
|
|
21
|
+
? "Select to close menu"
|
|
22
|
+
: "Select to open menu";
|
|
23
|
+
const burgerExpandedAlert = navSideMenuVisibility ? "True" : "False";
|
|
24
|
+
const logoClasses = `${logoBorderRadius} ${logoHoverColor}`;
|
|
25
|
+
const headerClasses = `${backgroundColor} ${bottomBorderColor}`;
|
|
26
|
+
const mobileMenuClasses = mobileMenuBackground;
|
|
27
|
+
const justifyNavClass = justifyMap[justifyNav];
|
|
28
|
+
const justifyInputClass = justifyMap[justifyInput];
|
|
29
|
+
const justifyBadgeClass = justifyMap[justifyBadge];
|
|
30
|
+
const justifyIconsClass = justifyMap[justifyIcons];
|
|
31
|
+
return (_jsx(HeaderProvider, { hasMobileIcons: hasMobileIcons, hasMobileNavItems: hasMobileNavItems, hasMobileBadge: hasMobileBadge, hasMobileSearchBar: hasMobileSearchBar, iconsData: iconsData, hasIcons: hasIcons, hasNavItems: hasNavItems, hasBadge: hasBadge, hasSearchBar: hasSearchBar, mobileCloseIcon: getFontAwesomeIcon("X"), children: _jsx("header", { "data-testid": "header", className: `border-b-2 h-20 z-[1000] top-0 w-full px-2 ${headerClasses} ${hasGlass ? "glass" : ""}`, children: _jsxs("div", { className: "flex min-h-20", children: [hasMobileMenu && mobileLeft && (_jsx("div", { className: "pl-2 mx-auto my-auto hidden max-xl:flex", "data-testid": "header-left-mobile-open-icon", children: hasAnimatedHamburgerButton ? (_jsx(HamburgerButton, { burgerAriaLabel: burgerAriaLabel, burgerExpandedAlert: burgerExpandedAlert, animateBoolean: navSideMenuVisibility, handleNav: handleNav, containerClasses: "" })) : (_jsx("button", { "aria-label": burgerAriaLabel, "aria-expanded": burgerExpandedAlert === "True"
|
|
32
|
+
? true
|
|
33
|
+
: false, "data-testid": "hamburger-button", onClick: handleNav, className: "flex flex-col space-y-1 relative z-10 p-2", children: burgerExpandedAlert === "True"
|
|
34
|
+
? getFontAwesomeIcon("X")
|
|
35
|
+
: getFontAwesomeIcon("hamburger") })) })), _jsx("div", { className: `flex flex-auto items-center pl-1 order-${logoOrder}`, children: _jsx("a", { className: logoClasses, href: "", "data-testid": "header-logo", children: logo }) }), _jsx("div", { className: `flex flex-auto ${justifyNavClass} max-xl:hidden order-${navOrder}`, children: hasNavItems && nav }), hasSearchBar && (_jsx("div", { className: `flex flex-auto items-center ${justifyInputClass} max-xl:hidden order-${inputOrder}`, "data-testid": "header-placeholder-input", children: _jsx("div", { className: "2xl:flex w-full [&:has(:focus-visible)]:ring-2", children: input }) })), hasBadge && (_jsx("div", { className: `flex flex-auto items-center ${justifyBadgeClass} max-xl:justify-end order-${badgeOrder}`, "data-testid": "header-badge", children: _jsx("div", { className: "w-fit", children: badge }) })), hasIcons && (_jsx("div", { className: `flex flex-auto items-center ${justifyIconsClass} max-xl:hidden order-${iconsOrder}`, "data-testid": "header-icons", children: icons })), hasMobileMenu && mobileRight && (_jsx("div", { className: "pr-2 mx-auto my-auto hidden max-xl:flex", "data-testid": "header-right-mobile-open-icon", children: hasAnimatedHamburgerButton ? (_jsx(HamburgerButton, { burgerAriaLabel: burgerAriaLabel, burgerExpandedAlert: burgerExpandedAlert, animateBoolean: navSideMenuVisibility, handleNav: handleNav, containerClasses: "" })) : (_jsx("button", { "aria-label": burgerAriaLabel, "aria-expanded": burgerExpandedAlert === "True"
|
|
36
|
+
? true
|
|
37
|
+
: false, "data-testid": "hamburger-button", onClick: handleNav, className: "flex flex-col space-y-1 relative z-10 p-2", children: burgerExpandedAlert === "True"
|
|
38
|
+
? getFontAwesomeIcon("X")
|
|
39
|
+
: getFontAwesomeIcon("hamburger") })) })), _jsx(AnimatePresence, { children: hasMobileMenu && navSideMenuVisibility && (_jsx("div", { children: _jsx(MotionConfig, { transition: { type: "spring", bounce: 0.1 }, children: _jsx(motion.div, { variants: {
|
|
40
|
+
hide: {
|
|
41
|
+
x: mobileRight
|
|
42
|
+
? "100%"
|
|
43
|
+
: "-100%",
|
|
44
|
+
transition: {
|
|
45
|
+
type: "spring",
|
|
46
|
+
bounce: 0.1,
|
|
47
|
+
when: "afterChildren",
|
|
48
|
+
staggerChildren: 0.25,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
show: {
|
|
52
|
+
x: "0%",
|
|
53
|
+
transition: {
|
|
54
|
+
type: "spring",
|
|
55
|
+
bounce: 0.1,
|
|
56
|
+
when: "beforeChildren",
|
|
57
|
+
staggerChildren: 0.25,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
}, initial: "hide", animate: "show", exit: "hide", className: "fixed inset-0 flex flex-col justify-center space-y-10", children: _jsx(MobileMenu, { handleNav: handleNav, badge: badge, nav: nav, input: input, icons: icons, mobileMenuClasses: mobileMenuClasses }) }, "mobile-nav") }) })) })] }) }) }));
|
|
61
|
+
};
|
|
62
|
+
export default Header;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta } from "@storybook/react";
|
|
2
|
+
import { HeaderTypes } from "./Header.types";
|
|
3
|
+
declare const _default: Meta<HeaderTypes>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Default: any;
|
|
6
|
+
export declare const TogaSupply: any;
|
|
7
|
+
export declare const Compass: any;
|
|
8
|
+
export declare const NoSearchOrBadge: any;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Header from "./Header";
|
|
3
|
+
import Nav from "../Nav/Nav";
|
|
4
|
+
import Image from "../Image/Image";
|
|
5
|
+
import Badge from "../Badge/Badge";
|
|
6
|
+
import Text from "../Text/Text";
|
|
7
|
+
import Input from "../Input/Input";
|
|
8
|
+
import FormButton from "../FormButton/FormButton";
|
|
9
|
+
import { DUMMYCOMPASSNAVDATA, DUMMYNAVDATA } from "../Nav/DUMMYNAVDATA.json";
|
|
10
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
11
|
+
export default {
|
|
12
|
+
title: "Headers/Header",
|
|
13
|
+
argTypes: {
|
|
14
|
+
iconsData: {
|
|
15
|
+
table: {
|
|
16
|
+
disable: true,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
nav: {
|
|
20
|
+
table: {
|
|
21
|
+
disable: true,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
input: {
|
|
25
|
+
table: {
|
|
26
|
+
disable: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
logo: {
|
|
30
|
+
table: {
|
|
31
|
+
disable: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
badge: {
|
|
35
|
+
table: {
|
|
36
|
+
disable: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
icons: {
|
|
40
|
+
table: {
|
|
41
|
+
disable: true,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
mobileCloseIcon: {
|
|
45
|
+
table: {
|
|
46
|
+
disable: true,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
mobileOpenIcon: {
|
|
50
|
+
table: {
|
|
51
|
+
disable: true,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
hasAnimatedHamburgerButton: {
|
|
55
|
+
control: "boolean",
|
|
56
|
+
description: "Whether the hamburger menu button is animated .",
|
|
57
|
+
},
|
|
58
|
+
logoBorderRadius: {
|
|
59
|
+
control: "boolean",
|
|
60
|
+
description: "Whether the logo has a border radius.",
|
|
61
|
+
},
|
|
62
|
+
logoHoverColor: {
|
|
63
|
+
control: "select",
|
|
64
|
+
options: ["red", "green", "blue", "none"],
|
|
65
|
+
description: "Whether the logo has a background color on hover.",
|
|
66
|
+
},
|
|
67
|
+
backgroundColor: {
|
|
68
|
+
control: "select",
|
|
69
|
+
options: ["red", "green", "gray", "none"],
|
|
70
|
+
description: "Whether the header has a background color.",
|
|
71
|
+
},
|
|
72
|
+
bottomBorderColor: {
|
|
73
|
+
control: "select",
|
|
74
|
+
options: ["green", "blue", "black", "none"],
|
|
75
|
+
description: "Whether the header has a background color.",
|
|
76
|
+
},
|
|
77
|
+
hasNavItems: {
|
|
78
|
+
control: "boolean",
|
|
79
|
+
description: "Whether the header has navigation items.",
|
|
80
|
+
},
|
|
81
|
+
hasSearchBar: {
|
|
82
|
+
control: "boolean",
|
|
83
|
+
description: "Whether the header has a search bar.",
|
|
84
|
+
},
|
|
85
|
+
mobileRight: {
|
|
86
|
+
control: "boolean",
|
|
87
|
+
description: "Whether the mobile menu is on the right.",
|
|
88
|
+
},
|
|
89
|
+
mobileLeft: {
|
|
90
|
+
control: "boolean",
|
|
91
|
+
description: "Whether the mobile menu is on the left.",
|
|
92
|
+
},
|
|
93
|
+
logoOrder: {
|
|
94
|
+
control: false,
|
|
95
|
+
description: "This prop will change the order of the logo section. It is set internally and should not be modified.",
|
|
96
|
+
},
|
|
97
|
+
navOrder: {
|
|
98
|
+
control: false,
|
|
99
|
+
description: "This prop will change the order of the navigation section. It is set internally and should not be modified.",
|
|
100
|
+
},
|
|
101
|
+
inputOrder: {
|
|
102
|
+
control: false,
|
|
103
|
+
description: "This prop will change the order of the input section. It is set internally and should not be modified.",
|
|
104
|
+
},
|
|
105
|
+
badgeOrder: {
|
|
106
|
+
control: false,
|
|
107
|
+
description: "This prop will change the order of the badge section. It is set internally and should not be modified.",
|
|
108
|
+
},
|
|
109
|
+
iconsOrder: {
|
|
110
|
+
control: false,
|
|
111
|
+
description: "This prop will change the order of the icons section. It is set internally and should not be modified.",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
tags: ["autodocs"],
|
|
115
|
+
};
|
|
116
|
+
const Template = (args) => _jsx(Header, { ...args });
|
|
117
|
+
export const Default = Template.bind({});
|
|
118
|
+
Default.args = {
|
|
119
|
+
mobileMenuBackground: "gray",
|
|
120
|
+
hasAnimatedHamburgerButton: true,
|
|
121
|
+
logo: (_jsx(Image, { src: "../../../assets/Logo.png", alt: "Generic Company Logo.", background: false, additionalClasses: " w-40 p-2" })),
|
|
122
|
+
icons: (_jsx(_Fragment, {})
|
|
123
|
+
// <GenericList
|
|
124
|
+
// hasVirtualization={false}
|
|
125
|
+
// listDirection="horizontal"
|
|
126
|
+
// containerClasses=""
|
|
127
|
+
// listType="unordered"
|
|
128
|
+
// data={DUMMYICONDATA.DUMMYICONTOGADATA}
|
|
129
|
+
// renderItem={(item) => <DynamicIconList item={item} />}
|
|
130
|
+
// />
|
|
131
|
+
),
|
|
132
|
+
badge: (_jsx(Badge, { type: "href", to: "#", hoverColor: "blue", borderColor: "none", mobileIcon: getFontAwesomeIcon("square-phone"), mobileIconLabel: "Contact Us", onClick: () => alert("Redirect to Contact Us page"), image: _jsx(Image, { src: "../../../assets/contact-image.png", alt: "", background: false, additionalClasses: "flex justify-center w-8 h-8 max-md:hidden" }), text: _jsxs(_Fragment, { children: [_jsx(Text, { size: "text-sm", color: "text-black", fontFamily: "font-serif", text: "Contact Us", tag: "h2", additionalClasses: "pl-2 pb-0 font-bold" }), _jsx(Text, { size: "text-xs", color: "text-black", fontFamily: "font-serif", text: "1-800-800-8000", tag: "p", additionalClasses: "pl-2 pt-0" })] }) })),
|
|
133
|
+
nav: (_jsx(Nav, { navData: DUMMYNAVDATA, navBackgroundColor: "#FFFFF", parentHoverBackground: "blue", parentHoverFontColor: "white", parentHoverUnderline: true, parentHoverBorderColor: "none", parentShape: "cornered", parentBackground: "none", parentBorderColor: "none", submenuBackgroundColor: "blue", submenuHoverBackground: "white", submenuHoverBorderStyle: "bottom", submenuHoverBorderColor: "black", mobileBreakpoint: "extraLarge", accordionParentStyle: "cornered p-2 w-full border-b-2 border-b-blue-700 text-black", accordionExpandedStyle: "pl-2 py-3" })),
|
|
134
|
+
input: (_jsx(Input, { labelVisible: false, label: undefined, inputType: "text", inputName: "search", hasPlaceholder: true, placeholder: "Search", borderColor: "gray", hasButton: true, backgroundColor: "white", additionalClasses: "bg-blue-500", button: _jsx(FormButton, { icon: getFontAwesomeIcon("search"), backgroundColor: "blue", hoverBackground: "black", hoverFontColor: "white", additionalClasses: "h-full w-8 justify-center", shape: "none" }), inputWidth: "w-full" })),
|
|
135
|
+
logoBorderRadius: true,
|
|
136
|
+
logoHoverColor: "blue",
|
|
137
|
+
hasIcons: false,
|
|
138
|
+
hasSearchBar: true,
|
|
139
|
+
hasBadge: false,
|
|
140
|
+
hasNavItems: true,
|
|
141
|
+
hasMobileMenu: true,
|
|
142
|
+
backgroundColor: "gray",
|
|
143
|
+
mobileLeft: true,
|
|
144
|
+
mobileRight: false,
|
|
145
|
+
bottomBorderColor: "blue",
|
|
146
|
+
mobileOpenIcon: getFontAwesomeIcon("hamburger"),
|
|
147
|
+
mobileCloseIcon: getFontAwesomeIcon("x"),
|
|
148
|
+
hasMobileIcons: false,
|
|
149
|
+
hasMobileNavItems: true,
|
|
150
|
+
hasMobileBadge: true,
|
|
151
|
+
hasMobileSearchBar: true,
|
|
152
|
+
};
|
|
153
|
+
export const TogaSupply = Template.bind({});
|
|
154
|
+
TogaSupply.args = {
|
|
155
|
+
hasIcons: true,
|
|
156
|
+
logoBorderRadius: true,
|
|
157
|
+
logoHoverColor: "blue",
|
|
158
|
+
backgroundColor: "gray",
|
|
159
|
+
bottomBorderColor: "blue",
|
|
160
|
+
hasMobileMenu: false,
|
|
161
|
+
logo: (_jsx(Image, { src: "../../../assets/Logo.png", alt: "Generic Company Logo.", background: false, additionalClasses: " w-40 p-2" })),
|
|
162
|
+
hasMobileIcons: false,
|
|
163
|
+
hasMobileNavItems: false,
|
|
164
|
+
hasMobileBadge: false,
|
|
165
|
+
hasMobileSearchBar: false,
|
|
166
|
+
hasAnimatedHamburgerButton: true,
|
|
167
|
+
};
|
|
168
|
+
export const Compass = Template.bind({});
|
|
169
|
+
Compass.args = {
|
|
170
|
+
icons: _jsx(_Fragment, {}),
|
|
171
|
+
hasIcons: true,
|
|
172
|
+
hasSearchBar: true,
|
|
173
|
+
hasBadge: true,
|
|
174
|
+
hasNavItems: true,
|
|
175
|
+
hasMobileMenu: true,
|
|
176
|
+
hasAnimatedHamburgerButton: true,
|
|
177
|
+
logoBorderRadius: true,
|
|
178
|
+
logoHoverColor: "green",
|
|
179
|
+
backgroundColor: "gray",
|
|
180
|
+
bottomBorderColor: "green",
|
|
181
|
+
mobileOpenIcon: getFontAwesomeIcon("hamburger"),
|
|
182
|
+
mobileCloseIcon: getFontAwesomeIcon("x"),
|
|
183
|
+
mobileMenuBackground: "green",
|
|
184
|
+
hasMobileIcons: true,
|
|
185
|
+
hasMobileNavItems: true,
|
|
186
|
+
hasMobileBadge: false,
|
|
187
|
+
hasMobileSearchBar: true,
|
|
188
|
+
badge: (_jsx(Badge, { type: "href", to: "#", hoverColor: "green", borderColor: "none", mobileIcon: getFontAwesomeIcon("square-phone"), mobileIconLabel: "Contact Us", onClick: () => alert("Redirect to Contact Us page"), image: _jsx(Image, { src: "../../../assets/contact-image.png", alt: "", background: false, additionalClasses: "flex justify-center w-8 h-8 max-md:hidden" }), text: _jsxs(_Fragment, { children: [_jsx(Text, { size: "text-sm", color: "text-teal-700", fontFamily: "font-serif", text: "Contact Us", tag: "h2", additionalClasses: "pl-2 pb-0 font-bold" }), _jsx(Text, { size: "text-xs", color: "text-teal-700", fontFamily: "font-serif", text: "1-800-800-8000", tag: "p", additionalClasses: "pl-2 pt-0" })] }) })),
|
|
189
|
+
logo: (_jsx(Image, { src: "../../../assets/compass-logo.png", alt: "Generic Company Logo.", background: false, additionalClasses: " w-40 p-2" })),
|
|
190
|
+
nav: (_jsx(Nav, { navData: DUMMYCOMPASSNAVDATA, navBackgroundColor: "#FFFFF", parentHoverBackground: "none", parentHoverFontColor: "black", parentHoverUnderline: true, parentHoverBorderColor: "none", parentShape: "cornered", parentBackground: "none", parentBorderColor: "none", submenuBackgroundColor: "white", submenuHoverBackground: "green", submenuHoverBorderStyle: "top-bottom", submenuHoverBorderColor: "green", includeSubmenuImages: true, mobileBreakpoint: "extraLarge", accordionParentStyle: "cornered p-2 w-full border-b-2 border-b-teal-700 text-black", accordionExpandedStyle: "pl-2 py-3" })),
|
|
191
|
+
input: (_jsx(Input, { labelVisible: false, label: undefined, inputType: "text", inputName: "search", borderColor: "gray", hasPlaceholder: true, placeholder: "Search", hasButton: true, backgroundColor: "white", additionalClasses: "bg-blue-500", button: _jsx(FormButton, { icon: getFontAwesomeIcon("search"), backgroundColor: "green", hoverBackground: "black", hoverFontColor: "white", additionalClasses: "h-full w-8 justify-center", shape: "none" }), inputWidth: "w-full" })),
|
|
192
|
+
};
|
|
193
|
+
export const NoSearchOrBadge = Template.bind({});
|
|
194
|
+
NoSearchOrBadge.args = {
|
|
195
|
+
icons: (_jsx(_Fragment, {})
|
|
196
|
+
// <GenericList
|
|
197
|
+
// hasVirtualization={false}
|
|
198
|
+
// listDirection="horizontal"
|
|
199
|
+
// containerClasses=""
|
|
200
|
+
// listType="unordered"
|
|
201
|
+
// data={DUMMYICONDATA.DUMMYICONCOMPASSDATA}
|
|
202
|
+
// renderItem={(item) => <DynamicIconList item={item} />}
|
|
203
|
+
// />
|
|
204
|
+
),
|
|
205
|
+
hasIcons: true,
|
|
206
|
+
hasSearchBar: false,
|
|
207
|
+
hasBadge: false,
|
|
208
|
+
hasNavItems: true,
|
|
209
|
+
hasMobileMenu: true,
|
|
210
|
+
mobileRight: true,
|
|
211
|
+
mobileLeft: false,
|
|
212
|
+
logoBorderRadius: true,
|
|
213
|
+
logoHoverColor: "green",
|
|
214
|
+
backgroundColor: "gray",
|
|
215
|
+
bottomBorderColor: "green",
|
|
216
|
+
mobileMenuBackground: "green",
|
|
217
|
+
hasAnimatedHamburgerButton: true,
|
|
218
|
+
hasMobileIcons: true,
|
|
219
|
+
hasMobileNavItems: true,
|
|
220
|
+
hasMobileBadge: false,
|
|
221
|
+
hasMobileSearchBar: true,
|
|
222
|
+
badge: (_jsx(Badge, { type: "href", to: "#", hoverColor: "green", borderColor: "none", mobileIcon: getFontAwesomeIcon("square-phone"), mobileIconLabel: "Contact Us", onClick: () => alert("Redirect to Contact Us page"), image: _jsx(Image, { src: "../../../assets/contact-image.png", alt: "", background: false, additionalClasses: "flex justify-center w-8 h-8 max-md:hidden" }), text: _jsxs(_Fragment, { children: [_jsx(Text, { size: "text-sm", color: "text-black", fontFamily: "font-serif", text: "Contact Us", tag: "h2", additionalClasses: "pl-2 pb-0 font-bold" }), _jsx(Text, { size: "text-xs", color: "text-black", fontFamily: "font-serif", text: "1-800-800-8000", tag: "p", additionalClasses: "pl-2 pt-0" })] }) })),
|
|
223
|
+
logo: (_jsx(Image, { src: "../../../assets/compass-logo.png", alt: "Generic Company Logo.", background: false, additionalClasses: " w-40 p-2" })),
|
|
224
|
+
nav: (_jsx(Nav, { navData: DUMMYNAVDATA, navBackgroundColor: "#FFFFF", parentHoverBackground: "none", parentHoverFontColor: "black", parentHoverUnderline: true, parentHoverBorderColor: "none", parentShape: "cornered", parentBackground: "none", parentBorderColor: "none", submenuBackgroundColor: "white", submenuHoverBackground: "green", submenuHoverBorderStyle: "top-bottom", submenuHoverBorderColor: "green", includeSubmenuImages: true, mobileBreakpoint: "extraLarge", accordionParentStyle: "cornered p-2 w-full border-b-2 border-b-teal-700 text-black", accordionExpandedStyle: "pl-2 py-3" })),
|
|
225
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../dist/main.css";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "../../../dist/main.css";
|
|
3
|
+
import { render, screen } from "@testing-library/react";
|
|
4
|
+
import { describe, test, expect, beforeEach } from "vitest";
|
|
5
|
+
import Header from "./Header";
|
|
6
|
+
import Image from "../Image/Image";
|
|
7
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
8
|
+
import { DUMMYNAVDATA } from "../Nav/DUMMYNAVDATA.json";
|
|
9
|
+
import Badge from "../Badge";
|
|
10
|
+
import Text from "../Text/Text";
|
|
11
|
+
import Nav from "../Nav";
|
|
12
|
+
describe("<Header /> with all props (badge, icons, input, logo)", () => {
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
render(_jsx(Header, { nav: _jsx(Nav, { navData: DUMMYNAVDATA, navBackgroundColor: "#FFFFF", parentHoverBackground: "blue", parentHoverFontColor: "white", parentHoverUnderline: true, parentHoverBorderColor: "none", parentShape: "cornered", parentBackground: "none", parentBorderColor: "none", submenuBackgroundColor: "blue", submenuHoverBackground: "white", submenuHoverBorderStyle: "bottom", submenuHoverBorderColor: "black", mobileBreakpoint: "extraLarge", accordionParentStyle: "cornered p-2 w-full border-b-2 border-b-blue-700 text-black", accordionExpandedStyle: "pl-2 py-3" }), logo: _jsx(Image, { src: "../../../assets/Logo.png", alt: "Generic Company Logo.", background: false, additionalClasses: " w-40 " }), badge: _jsx(Badge, { type: "href", to: "#", hoverColor: "green", borderColor: "none", mobileIcon: getFontAwesomeIcon("phone"), mobileIconLabel: "Contact Us", onClick: () => alert("Redirect to Contact Us page"), image: _jsx(Image, { src: "../../../assets/contact-image.png", alt: "", background: false, additionalClasses: "flex justify-center w-8 h-8 max-md:hidden" }), text: _jsxs(_Fragment, { children: [_jsx(Text, { size: "sm", color: "primary", fontFamily: "serif", text: "Contact Us", tag: "h2", additionalClasses: "pl-2 pb-0 font-bold" }), _jsx(Text, { size: "xs", color: "primary", fontFamily: "serif", text: "1-800-800-8000", tag: "p", additionalClasses: "pl-2 pt-0" })] }) }), backgroundColor: "gray", mobileOpenIcon: getFontAwesomeIcon("hamburger"), mobileCloseIcon: getFontAwesomeIcon("X"), mobileLeft: true, mobileRight: false, logoHoverColor: "blue", logoBorderRadius: true, hasIcons: true, icons: _jsx(_Fragment, {}), hasSearchBar: true, hasNavItems: true, hasBadge: true }));
|
|
15
|
+
});
|
|
16
|
+
test("renders Header component", () => {
|
|
17
|
+
expect(screen.getByTestId("header")).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
test("renders correct background color class", () => {
|
|
20
|
+
const header = screen.getByTestId("header");
|
|
21
|
+
expect(header).toHaveClass("bg-slate-200");
|
|
22
|
+
});
|
|
23
|
+
test("contains correct logo from Image component", () => {
|
|
24
|
+
const headerLogo = screen.getByTestId("header-logo");
|
|
25
|
+
const logoImage = headerLogo.querySelector("img");
|
|
26
|
+
expect(logoImage).toHaveAttribute("src", "../../../assets/Logo.png");
|
|
27
|
+
});
|
|
28
|
+
test("contains correct alt text from Image component", () => {
|
|
29
|
+
const headerLogo = screen.getByTestId("header-logo");
|
|
30
|
+
const logoImage = headerLogo.querySelector("img");
|
|
31
|
+
expect(logoImage).toHaveAttribute("alt", "Generic Company Logo.");
|
|
32
|
+
});
|
|
33
|
+
// TODO: refactor/expand test when nav is created
|
|
34
|
+
test("contains correct placeholder nav menus", () => {
|
|
35
|
+
expect(screen.getByTestId("nav")).toBeInTheDocument();
|
|
36
|
+
});
|
|
37
|
+
// TODO: refactor/expand test when input is added
|
|
38
|
+
test("contains correct placeholder input", () => {
|
|
39
|
+
expect(screen.getByTestId("header-placeholder-input")).toBeInTheDocument();
|
|
40
|
+
});
|
|
41
|
+
test("contains correct badge", () => {
|
|
42
|
+
expect(screen.getByTestId("header-badge")).toBeInTheDocument();
|
|
43
|
+
const badge = screen.getByTestId("header-badge");
|
|
44
|
+
expect(badge).toHaveTextContent("Contact Us");
|
|
45
|
+
expect(badge).toHaveTextContent("1-800-800-8000");
|
|
46
|
+
});
|
|
47
|
+
test("contains correct icon images", () => {
|
|
48
|
+
expect(screen.getByTestId("user")).toBeInTheDocument();
|
|
49
|
+
expect(screen.getByTestId("circle-info")).toBeInTheDocument();
|
|
50
|
+
expect(screen.getByTestId("bell")).toBeInTheDocument();
|
|
51
|
+
expect(screen.getByTestId("cart-shopping")).toBeInTheDocument();
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe("<Header /> with logo and one icon", () => {
|
|
55
|
+
beforeEach(() => {
|
|
56
|
+
render(_jsx(Header, { logo: _jsx(Image, { src: "../../../assets/Logo.png", alt: "Another Generic Company Logo.", background: false, additionalClasses: " w-40 " }), hasMobileMenu: true, backgroundColor: "gray", mobileOpenIcon: getFontAwesomeIcon("hamburger"), mobileCloseIcon: getFontAwesomeIcon("X"), mobileLeft: false, mobileRight: true, logoHoverColor: "blue", logoBorderRadius: true, hasIcons: true, icons: _jsx(_Fragment, {}), hasSearchBar: false, hasNavItems: false, hasBadge: false }));
|
|
57
|
+
});
|
|
58
|
+
test("renders Header component", () => {
|
|
59
|
+
expect(screen.getByTestId("header")).toBeInTheDocument();
|
|
60
|
+
});
|
|
61
|
+
test("renders correct background color class", () => {
|
|
62
|
+
const header = screen.getByTestId("header");
|
|
63
|
+
expect(header).toHaveClass("bg-slate-200");
|
|
64
|
+
});
|
|
65
|
+
test("contains correct logo from Image component", () => {
|
|
66
|
+
const headerLogo = screen.getByTestId("header-logo");
|
|
67
|
+
const logoImage = headerLogo.querySelector("img");
|
|
68
|
+
expect(logoImage).toHaveAttribute("src", "../../../assets/Logo.png");
|
|
69
|
+
});
|
|
70
|
+
test("contains correct alt text from Image component", () => {
|
|
71
|
+
const headerLogo = screen.getByTestId("header-logo");
|
|
72
|
+
const logoImage = headerLogo.querySelector("img");
|
|
73
|
+
expect(logoImage).toHaveAttribute("alt", "Another Generic Company Logo.");
|
|
74
|
+
});
|
|
75
|
+
test("does not contain badge", () => {
|
|
76
|
+
expect(document.querySelector('[data-testid="header-badge"]')).toBeNull();
|
|
77
|
+
});
|
|
78
|
+
test("contains correct icon images", () => {
|
|
79
|
+
const info = document.querySelector('[data-testid="circle-info"]');
|
|
80
|
+
expect(info).toBeInTheDocument();
|
|
81
|
+
const notifications = document.querySelector('[data-testid="bell"]');
|
|
82
|
+
expect(notifications).toBeInTheDocument();
|
|
83
|
+
const cart = document.querySelector('[data-testid="cart-shopping"]');
|
|
84
|
+
expect(cart).toBeInTheDocument();
|
|
85
|
+
});
|
|
86
|
+
test("does not contain placeholder input", () => {
|
|
87
|
+
expect(document.querySelector('[data-testid="header-placeholder-input"]')).toBeNull();
|
|
88
|
+
});
|
|
89
|
+
test("does not contain nav items", () => {
|
|
90
|
+
expect(document.querySelector('[data-testid="nav"]')).toBeNull();
|
|
91
|
+
});
|
|
92
|
+
test("contains mobile open icon on right, not present on left", () => {
|
|
93
|
+
const rightMobileOpenIcon = document.querySelector('[data-testid="header-right-mobile-open-icon"]');
|
|
94
|
+
expect(rightMobileOpenIcon).not.toBeNull();
|
|
95
|
+
const leftMobileOpenIcon = document.querySelector('[data-testid="header-left-mobile-open-icon"]');
|
|
96
|
+
expect(leftMobileOpenIcon).toBeNull();
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe("<Header /> with both mobileLeft and mobileRight set to true, mobileRight is default", () => {
|
|
100
|
+
beforeEach(() => {
|
|
101
|
+
render(_jsx(Header, { logo: _jsx(Image, { src: "../../../assets/Logo.png", alt: "Another Generic Company Logo.", background: false, additionalClasses: " w-40 " }), hasMobileMenu: true, backgroundColor: "red", mobileOpenIcon: getFontAwesomeIcon("hamburger"), mobileCloseIcon: getFontAwesomeIcon("X"), mobileLeft: true, mobileRight: true, logoHoverColor: "blue", logoBorderRadius: true, hasIcons: true, icons: _jsx(_Fragment, {}), hasSearchBar: false, hasNavItems: false, hasBadge: false }));
|
|
102
|
+
});
|
|
103
|
+
test("defaults to mobile open icon on right, not present on left", () => {
|
|
104
|
+
expect(document.querySelector('[data-testid="header-right-mobile-open-icon"]')).not.toBeNull();
|
|
105
|
+
expect(document.querySelector('[data-testid="header-left-mobile-open-icon"]')).toBeNull();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DUMMYICONCOMPASSDATA, DUMMYICONTOGADATA } from "./DUMMYICONDATA.json";
|
|
2
|
+
export interface HeaderTypes {
|
|
3
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void;
|
|
4
|
+
nav?: React.ReactNode;
|
|
5
|
+
logo?: React.ReactNode;
|
|
6
|
+
badge?: React.ReactNode;
|
|
7
|
+
icons?: React.ReactNode;
|
|
8
|
+
input?: React.ReactNode;
|
|
9
|
+
children?: React.ReactNode;
|
|
10
|
+
logoHoverColor?: string;
|
|
11
|
+
logoBorderRadius?: boolean;
|
|
12
|
+
backgroundColor?: string;
|
|
13
|
+
bottomBorderColor?: string;
|
|
14
|
+
hasGlass?: boolean;
|
|
15
|
+
hasAnimatedHamburgerButton?: boolean;
|
|
16
|
+
mobileOpenIcon?: JSX.Element | undefined | null;
|
|
17
|
+
mobileCloseIcon?: JSX.Element | null;
|
|
18
|
+
mobileLeft?: boolean;
|
|
19
|
+
mobileRight?: boolean;
|
|
20
|
+
mobileMenuBackground?: string;
|
|
21
|
+
iconsData?: typeof DUMMYICONCOMPASSDATA | typeof DUMMYICONTOGADATA;
|
|
22
|
+
hasIcons?: boolean;
|
|
23
|
+
hasSearchBar?: boolean;
|
|
24
|
+
hasNavItems?: boolean;
|
|
25
|
+
hasBadge?: boolean;
|
|
26
|
+
hasMobileMenu?: boolean;
|
|
27
|
+
hasMobileIcons?: boolean;
|
|
28
|
+
hasMobileNavItems?: boolean;
|
|
29
|
+
hasMobileBadge?: boolean;
|
|
30
|
+
hasMobileSearchBar?: boolean;
|
|
31
|
+
justifyNav?: string;
|
|
32
|
+
justifyInput?: string;
|
|
33
|
+
justifyBadge?: string;
|
|
34
|
+
justifyIcons?: string;
|
|
35
|
+
logoOrder?: number;
|
|
36
|
+
navOrder?: number;
|
|
37
|
+
inputOrder?: number;
|
|
38
|
+
badgeOrder?: number;
|
|
39
|
+
iconsOrder?: number;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { HeaderTypes } from "./Header.types";
|
|
2
|
+
type ContextValue = {
|
|
3
|
+
iconsData: HeaderTypes["iconsData"];
|
|
4
|
+
setIconsData: (iconsData: HeaderTypes["iconsData"]) => void;
|
|
5
|
+
mobileCloseIcon: JSX.Element | null;
|
|
6
|
+
setMobileCloseIcon: (mobileCloseIcon: JSX.Element) => void;
|
|
7
|
+
hasIcons: boolean;
|
|
8
|
+
setHasIcons: (hasNavItems: boolean) => void;
|
|
9
|
+
hasNavItems: boolean;
|
|
10
|
+
setHasNavItems: (hasNavItems: boolean) => void;
|
|
11
|
+
hasBadge: boolean;
|
|
12
|
+
setHasBadge: (hasBadge: boolean) => void;
|
|
13
|
+
hasSearchBar: boolean;
|
|
14
|
+
setHasSearchBar: (hasSearchBar: boolean) => void;
|
|
15
|
+
hasMobileIcons: boolean;
|
|
16
|
+
setHasMobileIcons: (hasMobileIcons: boolean) => void;
|
|
17
|
+
hasMobileNavItems: boolean;
|
|
18
|
+
setHasMobileNavItems: (hasMobileNavItems: boolean) => void;
|
|
19
|
+
hasMobileBadge: boolean;
|
|
20
|
+
setHasMobileBadge: (hasMobileBadge: boolean) => void;
|
|
21
|
+
hasMobileSearchBar: boolean;
|
|
22
|
+
setHasMobileSearchBar: (hasMobileSearchBar: boolean) => void;
|
|
23
|
+
};
|
|
24
|
+
type HeaderProviderProps = {
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
hasIcons: boolean;
|
|
27
|
+
hasNavItems: boolean;
|
|
28
|
+
hasBadge: boolean;
|
|
29
|
+
hasSearchBar: boolean;
|
|
30
|
+
hasMobileIcons: boolean;
|
|
31
|
+
hasMobileNavItems: boolean;
|
|
32
|
+
hasMobileBadge: boolean;
|
|
33
|
+
hasMobileSearchBar: boolean;
|
|
34
|
+
iconsData: HeaderTypes["iconsData"];
|
|
35
|
+
mobileCloseIcon: JSX.Element | null;
|
|
36
|
+
};
|
|
37
|
+
export declare const HeaderProvider: ({ children, hasIcons, hasNavItems, hasBadge, hasSearchBar, hasMobileIcons, hasMobileNavItems, hasMobileBadge, hasMobileSearchBar, iconsData, mobileCloseIcon, }: HeaderProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function useHeaderContext(): ContextValue;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useState } from "react";
|
|
3
|
+
const HeaderContext = createContext(undefined);
|
|
4
|
+
export const HeaderProvider = ({ children, hasIcons, hasNavItems, hasBadge, hasSearchBar, hasMobileIcons, hasMobileNavItems, hasMobileBadge, hasMobileSearchBar, iconsData, mobileCloseIcon, }) => {
|
|
5
|
+
const [hasIconsState, setHasIcons] = useState(hasIcons);
|
|
6
|
+
const [hasNavItemsState, setHasNavItems] = useState(hasNavItems);
|
|
7
|
+
const [hasBadgeState, setHasBadge] = useState(hasBadge);
|
|
8
|
+
const [hasSearchBarState, setHasSearchBar] = useState(hasSearchBar);
|
|
9
|
+
const [hasMobileIconsState, setHasMobileIcons] = useState(hasMobileIcons);
|
|
10
|
+
const [hasMobileNavItemsState, setHasMobileNavItems] = useState(hasMobileNavItems);
|
|
11
|
+
const [hasMobileBadgeState, setHasMobileBadge] = useState(hasMobileBadge);
|
|
12
|
+
const [hasMobileSearchBarState, setHasMobileSearchBar] = useState(hasMobileSearchBar);
|
|
13
|
+
const [iconsDataState, setIconsData] = useState(iconsData);
|
|
14
|
+
const [mobileCloseIconState, setMobileCloseIcon] = useState(mobileCloseIcon);
|
|
15
|
+
return (_jsx(HeaderContext.Provider, { value: {
|
|
16
|
+
hasIcons: hasIconsState,
|
|
17
|
+
setHasIcons,
|
|
18
|
+
hasNavItems: hasNavItemsState,
|
|
19
|
+
setHasNavItems,
|
|
20
|
+
hasBadge: hasBadgeState,
|
|
21
|
+
setHasBadge,
|
|
22
|
+
hasSearchBar: hasSearchBarState,
|
|
23
|
+
setHasSearchBar,
|
|
24
|
+
hasMobileIcons: hasMobileIconsState,
|
|
25
|
+
setHasMobileIcons,
|
|
26
|
+
hasMobileNavItems: hasMobileNavItemsState,
|
|
27
|
+
setHasMobileNavItems,
|
|
28
|
+
hasMobileBadge: hasMobileBadgeState,
|
|
29
|
+
setHasMobileBadge,
|
|
30
|
+
hasMobileSearchBar: hasMobileSearchBarState,
|
|
31
|
+
setHasMobileSearchBar,
|
|
32
|
+
iconsData: iconsDataState,
|
|
33
|
+
setIconsData,
|
|
34
|
+
mobileCloseIcon: mobileCloseIconState,
|
|
35
|
+
setMobileCloseIcon,
|
|
36
|
+
}, children: children }));
|
|
37
|
+
};
|
|
38
|
+
export function useHeaderContext() {
|
|
39
|
+
const context = useContext(HeaderContext);
|
|
40
|
+
if (!context) {
|
|
41
|
+
throw new Error("useHeaderContext must be used within a HeaderProvider");
|
|
42
|
+
}
|
|
43
|
+
return context;
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Text from "../Text/Text";
|
|
3
|
+
import Image from "../Image/Image";
|
|
4
|
+
const alignmentClassesMap = {
|
|
5
|
+
left: "justify-start text-left",
|
|
6
|
+
right: "justify-end text-right",
|
|
7
|
+
center: "justify-center text-center",
|
|
8
|
+
};
|
|
9
|
+
const backgroundClassesMap = {
|
|
10
|
+
color: "bg-blue-800",
|
|
11
|
+
gradient: "bg-gradient-to-r from-cyan-700 to-blue-900",
|
|
12
|
+
};
|
|
13
|
+
const Hero = ({ src = "../../../assets/heroImage.png", text = (_jsx(Text, { size: "text-xl", color: "text-white", fontFamily: "font-serif", text: "This is a test heading!", tag: "h1" })), textAlignment, background = "color", textVerticalAxis = "items-center", }) => {
|
|
14
|
+
let heroAlignment = alignmentClassesMap[textAlignment];
|
|
15
|
+
const heroBackground = backgroundClassesMap[background] || "";
|
|
16
|
+
if (background === "image") {
|
|
17
|
+
heroAlignment = `flex ${alignmentClassesMap[textAlignment]} ${textVerticalAxis}`;
|
|
18
|
+
}
|
|
19
|
+
return background === "image" ? (_jsx(Image, { src: src, alt: "", background: true, additionalClasses: heroAlignment, children: _jsx("span", { className: "text-white", children: text }) })) : (_jsx("div", { "data-testid": "hero", className: `w-full min-h-72 p-4 flex ${heroAlignment} ${heroBackground} ${textVerticalAxis} text-white `, children: text }));
|
|
20
|
+
};
|
|
21
|
+
export default Hero;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Meta } from "@storybook/react";
|
|
3
|
+
import { HeroTypes } from ".";
|
|
4
|
+
interface HeroStoryTypes extends HeroTypes {
|
|
5
|
+
position: "left" | "right" | "center";
|
|
6
|
+
background: string;
|
|
7
|
+
text: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Meta<HeroStoryTypes>;
|
|
10
|
+
export default _default;
|
|
11
|
+
export declare const HeroColor: any;
|
|
12
|
+
export declare const HeroGradient: any;
|
|
13
|
+
export declare const HeroDecorativeImage: any;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import Hero from ".";
|
|
3
|
+
import { withStoryBook } from "../../hoc";
|
|
4
|
+
const StorybookHero = withStoryBook(Hero);
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/Hero",
|
|
7
|
+
argTypes: {
|
|
8
|
+
textAlignment: {
|
|
9
|
+
control: "select",
|
|
10
|
+
options: ["left", "right", "center"],
|
|
11
|
+
description: "The position of the text in relation to the background horizontally.",
|
|
12
|
+
},
|
|
13
|
+
textVerticalAxis: {
|
|
14
|
+
control: "select",
|
|
15
|
+
options: ["items-start", "items-end", "items-center"],
|
|
16
|
+
description: "The position of the text in relation to the background vertically.",
|
|
17
|
+
},
|
|
18
|
+
background: {
|
|
19
|
+
control: "color",
|
|
20
|
+
description: "The background color. Set by Tailwind CSS in Applications",
|
|
21
|
+
},
|
|
22
|
+
text: {
|
|
23
|
+
control: "text",
|
|
24
|
+
description: "The text displayed.",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
tags: ["autodocs"],
|
|
28
|
+
};
|
|
29
|
+
const Template = (args) => (_jsx(StorybookHero, { ...args, storybookStyle: {
|
|
30
|
+
backgroundColor: args.background,
|
|
31
|
+
} }));
|
|
32
|
+
export const HeroColor = Template.bind({});
|
|
33
|
+
HeroColor.args = {
|
|
34
|
+
textAlignment: "right",
|
|
35
|
+
background: "color",
|
|
36
|
+
};
|
|
37
|
+
export const HeroGradient = Template.bind({});
|
|
38
|
+
HeroGradient.args = {
|
|
39
|
+
textAlignment: "right",
|
|
40
|
+
background: "gradient",
|
|
41
|
+
};
|
|
42
|
+
export const HeroDecorativeImage = Template.bind({});
|
|
43
|
+
HeroDecorativeImage.args = {
|
|
44
|
+
textAlignment: "right",
|
|
45
|
+
background: "image",
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../dist/main.css";
|