@innovaccer/design-system 2.7.0 → 2.9.0-0
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/.github/workflows/chromatic.yml +3 -1
- package/.github/workflows/docs_pull_request.yml +20 -0
- package/.github/workflows/main.yml +1 -1
- package/.github/workflows/manual.yml +1 -1
- package/.github/workflows/pull_request.yml +1 -1
- package/.github/workflows/test.yml +1 -1
- package/CHANGELOG.md +68 -0
- package/README.md +6 -0
- package/core/components/atoms/_chip/__tests__/__snapshots__/_chip.test.tsx.snap +8 -8
- package/core/components/atoms/_chip/index.tsx +1 -1
- package/core/components/atoms/avatar/__tests__/__snapshots__/Avatar.test.tsx.snap +20 -0
- package/core/components/atoms/avatarGroup/AvatarCount.tsx +29 -0
- package/core/components/atoms/avatarGroup/AvatarGroup.tsx +16 -62
- package/core/components/atoms/avatarGroup/AvatarPopperBody.tsx +37 -0
- package/core/components/atoms/avatarGroup/Avatars.tsx +23 -0
- package/core/components/atoms/avatarGroup/__stories__/index.story.tsx +41 -0
- package/core/components/atoms/avatarGroup/__tests__/AvatarGroup.test.tsx +1 -1
- package/core/components/atoms/avatarGroup/__tests__/__snapshots__/AvatarGroup.test.tsx.snap +8 -4
- package/core/components/atoms/button/Button.tsx +1 -2
- package/core/components/atoms/checkbox/__stories__/Group.story.tsx +1 -1
- package/core/components/atoms/checkbox/__stories__/Nested.story.tsx +2 -0
- package/core/components/atoms/chip/__tests__/__snapshots__/Chip.test.tsx.snap +11 -11
- package/core/components/atoms/chipGroup/__tests__/__snapshots__/chipGroup.test.tsx.snap +4 -4
- package/core/components/atoms/dropdown/DropdownButton.tsx +1 -1
- package/core/components/atoms/dropdown/DropdownList.tsx +56 -29
- package/core/components/atoms/dropdown/__tests__/__snapshots__/Dropdown.test.tsx.snap +29 -2
- package/core/components/atoms/popperWrapper/PopperWrapper.tsx +104 -12
- package/core/components/atoms/toast/__stories__/WithDescription.story.tsx +3 -1
- package/core/components/css-utilities/designTokens/Data.tsx +18 -0
- package/core/components/css-utilities/designTokens/Transitions.story.tsx +37 -0
- package/core/components/molecules/chipInput/__tests__/__snapshots__/ChipInput.test.tsx.snap +4 -4
- package/core/components/molecules/dialog/__tests__/__snapshots__/Dialog.test.tsx.snap +260 -195
- package/core/components/molecules/editableChipInput/__tests__/__snapshots__/EditableChipInput.test.tsx.snap +4 -4
- package/core/components/molecules/editableDropdown/__tests__/__snapshots__/EditableDropdown.test.tsx.snap +1 -0
- package/core/components/molecules/fullscreenModal/FullscreenModal.tsx +13 -12
- package/core/components/molecules/fullscreenModal/__tests__/Fullscreen.test.tsx +2 -5
- package/core/components/molecules/fullscreenModal/__tests__/__snapshots__/Fullscreen.test.tsx.snap +126 -96
- package/core/components/molecules/modal/Modal.tsx +11 -9
- package/core/components/molecules/modal/__tests__/__snapshots__/Modal.test.tsx.snap +240 -180
- package/core/components/molecules/popover/Popover.tsx +9 -0
- package/core/components/molecules/popover/__tests__/__snapshots__/Popover.test.tsx.snap +16 -8
- package/core/components/molecules/sidesheet/Sidesheet.tsx +23 -22
- package/core/components/molecules/sidesheet/__tests__/__snapshots__/Sidesheet.test.tsx.snap +40 -30
- package/core/components/molecules/tooltip/Tooltip.tsx +20 -1
- package/core/components/molecules/tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +8 -0
- package/core/components/organisms/calendar/__tests__/__snapshots__/Calendar.test.tsx.snap +8 -8
- package/core/components/organisms/datePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +14 -13
- package/core/components/organisms/dateRangePicker/__tests__/__snapshots__/DateRangePicker.test.tsx.snap +42 -30
- package/core/components/organisms/grid/GridBody.tsx +1 -2
- package/core/components/organisms/table/Table.tsx +0 -1
- package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.tsx +2 -2
- package/core/components/organisms/table/__tests__/__snapshots__/Table.test.tsx.snap +1544 -0
- package/core/components/organisms/verticalNav/MenuItem.tsx +6 -2
- package/core/components/organisms/verticalNav/VerticalNav.tsx +8 -2
- package/core/components/organisms/verticalNav/__stories__/CustomItemsRenderer.story.tsx +238 -0
- package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +168 -3
- package/css/dist/index.css +300 -62
- package/css/dist/index.css.map +1 -1
- package/css/src/components/ProgressBar.css +1 -1
- package/css/src/components/avatarGroup.css +0 -9
- package/css/src/components/button.css +4 -4
- package/css/src/components/chip.css +4 -0
- package/css/src/components/dropdown.css +5 -9
- package/css/src/components/dropdownButton.css +2 -0
- package/css/src/components/fullscreenModal.css +0 -5
- package/css/src/components/grid.css +0 -11
- package/css/src/components/overlay.css +0 -11
- package/css/src/components/popover.css +12 -0
- package/css/src/components/slider.css +1 -0
- package/css/src/components/tabs.css +1 -1
- package/css/src/components/textarea.css +0 -11
- package/css/src/components/tooltip.css +115 -0
- package/css/src/components/verticalNav.css +2 -0
- package/css/src/core/animation.css +8 -0
- package/css/src/core/utilities.css +11 -0
- package/css/src/utils/utility.css +4 -0
- package/css/src/variables/index.css +19 -0
- package/dist/core/components/atoms/avatarGroup/AvatarCount.d.ts +2 -0
- package/dist/core/components/atoms/avatarGroup/AvatarGroup.d.ts +2 -2
- package/dist/core/components/atoms/avatarGroup/AvatarPopperBody.d.ts +2 -0
- package/dist/core/components/atoms/avatarGroup/Avatars.d.ts +2 -0
- package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +61 -54
- package/dist/core/components/css-utilities/designTokens/Data.d.ts +8 -0
- package/dist/core/components/css-utilities/designTokens/Transitions.story.d.ts +12 -0
- package/dist/core/components/molecules/popover/Popover.d.ts +4 -0
- package/dist/core/components/molecules/sidesheet/Sidesheet.d.ts +1 -0
- package/dist/core/components/organisms/verticalNav/MenuItem.d.ts +1 -0
- package/dist/core/components/organisms/verticalNav/VerticalNav.d.ts +2 -0
- package/dist/index.esm.js +278 -142
- package/dist/index.js +282 -149
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.br +0 -0
- package/dist/index.umd.js.gz +0 -0
- package/docs/.eslintrc.json +1 -0
- package/docs/.unotes/templates/title_date.hbs +4 -0
- package/docs/.unotes/unotes_meta.json +302 -0
- package/docs/LICENSE +21 -0
- package/docs/README.md +31 -0
- package/docs/gatsby-browser.js +6 -0
- package/docs/gatsby-config.js +171 -0
- package/docs/gatsby-node.js +75 -0
- package/docs/index.js +1 -0
- package/docs/package.json +54 -0
- package/docs/src/components/Colors/Colors.css +19 -0
- package/docs/src/components/Colors/Colors.js +82 -0
- package/docs/src/components/Container/ComponentsContainer.js +75 -0
- package/docs/src/components/Container/Container.js +114 -0
- package/docs/src/components/Container/index.js +3 -0
- package/docs/src/components/Footer/Footer.css +7 -0
- package/docs/src/components/Footer/Footer.js +40 -0
- package/docs/src/components/Header/Header.css +32 -0
- package/docs/src/components/Header/Header.js +60 -0
- package/docs/src/components/Header/index.js +3 -0
- package/docs/src/components/LastModifiedDate/LastModifiedDate.js +24 -0
- package/docs/src/components/LastModifiedDate/index.js +3 -0
- package/docs/src/components/Layout.js +291 -0
- package/docs/src/components/LeftNav/LeftNav.js +101 -0
- package/docs/src/components/LeftNav/index.js +3 -0
- package/docs/src/components/Logos/Logos.css +29 -0
- package/docs/src/components/Logos/Logos.js +64 -0
- package/docs/src/components/Meta.js +101 -0
- package/docs/src/components/PropsTable/ArgJsDoc.tsx +102 -0
- package/docs/src/components/PropsTable/ArgRow.tsx +142 -0
- package/docs/src/components/PropsTable/ArgValue.tsx +182 -0
- package/docs/src/components/PropsTable/EmptyBlock.tsx +22 -0
- package/docs/src/components/PropsTable/SectionRow.tsx +126 -0
- package/docs/src/components/PropsTable/Shared.tsx +53 -0
- package/docs/src/components/PropsTable/Table.tsx +463 -0
- package/docs/src/components/PropsTable/card.css +7 -0
- package/docs/src/components/PropsTable/generateImports.tsx +20 -0
- package/docs/src/components/PropsTable/index.js +248 -0
- package/docs/src/components/PropsTable/prism.css +146 -0
- package/docs/src/components/PropsTable/sandbox.tsx +81 -0
- package/docs/src/components/PropsTable/theme.js +53 -0
- package/docs/src/components/PropsTable/types.tsx +44 -0
- package/docs/src/components/Rules/DONTs.js +13 -0
- package/docs/src/components/Rules/DOs.js +13 -0
- package/docs/src/components/Rules/IconWrapper.js +18 -0
- package/docs/src/components/Rules/InlineMessage.js +11 -0
- package/docs/src/components/Rules/Rules.css +17 -0
- package/docs/src/components/Rules/Rules.js +39 -0
- package/docs/src/components/TableOfContent/TableOfContent.css +37 -0
- package/docs/src/components/TableOfContent/TableOfContent.js +126 -0
- package/docs/src/components/css/global.css +15 -0
- package/docs/src/components/css/prism.css +38 -0
- package/docs/src/components/css/style.css +97 -0
- package/docs/src/components/templates/Default.js +24 -0
- package/docs/src/components/templates/Homepage.js +13 -0
- package/docs/src/data/components/images/Avatars.png +0 -0
- package/docs/src/data/components/images/Datepicker.png +0 -0
- package/docs/src/data/components/images/EditableChipInput.png +0 -0
- package/docs/src/data/components/images/Modal.png +0 -0
- package/docs/src/data/components/images/Sidesheet.png +0 -0
- package/docs/src/data/components/images/Table.png +0 -0
- package/docs/src/data/components/index.js +285 -0
- package/docs/src/data/footer-items.yaml +16 -0
- package/docs/src/data/header-items.yaml +20 -0
- package/docs/src/data/home-menu.yaml +23 -0
- package/docs/src/data/home-resources.yaml +14 -0
- package/docs/src/data/nav/components.yaml +45 -0
- package/docs/src/data/nav/content.yaml +25 -0
- package/docs/src/data/nav/default.yaml +11 -0
- package/docs/src/data/nav/foundations.yaml +22 -0
- package/docs/src/data/nav/guide-items.yaml +6 -0
- package/docs/src/data/nav/introduction.yaml +11 -0
- package/docs/src/data/storybook.json +345189 -0
- package/docs/src/pages/404.js +31 -0
- package/docs/src/pages/components/avatar/code.mdx +14 -0
- package/docs/src/pages/components/avatar/images/avatar-1.png +0 -0
- package/docs/src/pages/components/avatar/images/avatar-2.png +0 -0
- package/docs/src/pages/components/avatar/images/avatar-3.png +0 -0
- package/docs/src/pages/components/avatar/images/avatar-4.png +0 -0
- package/docs/src/pages/components/avatar/images/avatar-5.png +0 -0
- package/docs/src/pages/components/avatar/usage.mdx +53 -0
- package/docs/src/pages/components/badges/code.mdx +15 -0
- package/docs/src/pages/components/badges/images/badges-1.png +0 -0
- package/docs/src/pages/components/badges/images/badges-2.png +0 -0
- package/docs/src/pages/components/badges/usage.mdx +43 -0
- package/docs/src/pages/components/breadcrumbs/code.mdx +15 -0
- package/docs/src/pages/components/breadcrumbs/usage.mdx +30 -0
- package/docs/src/pages/components/button/code.mdx +18 -0
- package/docs/src/pages/components/button/content.mdx +652 -0
- package/docs/src/pages/components/button/images/buttons-1.png +0 -0
- package/docs/src/pages/components/button/images/buttons-2.png +0 -0
- package/docs/src/pages/components/button/usage.mdx +100 -0
- package/docs/src/pages/components/calendar/code.mdx +15 -0
- package/docs/src/pages/components/calendar/usage.mdx +9 -0
- package/docs/src/pages/components/card/code.mdx +15 -0
- package/docs/src/pages/components/card/usage.mdx +54 -0
- package/docs/src/pages/components/checkbox/code.mdx +16 -0
- package/docs/src/pages/components/checkbox/usage.mdx +49 -0
- package/docs/src/pages/components/chips/code.mdx +15 -0
- package/docs/src/pages/components/chips/usage.mdx +34 -0
- package/docs/src/pages/components/datePicker/code.mdx +7 -0
- package/docs/src/pages/components/datePicker/images/datePicker-1.png +0 -0
- package/docs/src/pages/components/datePicker/images/datePicker-2.png +0 -0
- package/docs/src/pages/components/datePicker/images/datePicker-3.png +0 -0
- package/docs/src/pages/components/datePicker/images/datePicker-4.png +0 -0
- package/docs/src/pages/components/datePicker/images/datePicker-5.png +0 -0
- package/docs/src/pages/components/datePicker/usage.mdx +58 -0
- package/docs/src/pages/components/index.mdx +7 -0
- package/docs/src/pages/components/message/code.mdx +16 -0
- package/docs/src/pages/components/message/usage.mdx +26 -0
- package/docs/src/pages/components/overview/index.mdx +6 -0
- package/docs/src/pages/components/overview/tabs/Overview.js +72 -0
- package/docs/src/pages/components/overview/tabs/all-components.mdx +10 -0
- package/docs/src/pages/components/overview/tabs/overview.css +30 -0
- package/docs/src/pages/components/overview/tabs/status.mdx +22 -0
- package/docs/src/pages/components/radio/code.mdx +17 -0
- package/docs/src/pages/components/radio/usage.mdx +126 -0
- package/docs/src/pages/components/sidesheet/code.mdx +8 -0
- package/docs/src/pages/components/sidesheet/interactions.mdx +8 -0
- package/docs/src/pages/components/sidesheet/usage.mdx +25 -0
- package/docs/src/pages/components/slider/code.mdx +15 -0
- package/docs/src/pages/components/slider/usage.mdx +49 -0
- package/docs/src/pages/components/statushint/code.mdx +15 -0
- package/docs/src/pages/components/statushint/usage.mdx +19 -0
- package/docs/src/pages/components/steppers/code.mdx +16 -0
- package/docs/src/pages/components/steppers/images/stepper-1.gif +0 -0
- package/docs/src/pages/components/steppers/images/stepper-2.png +0 -0
- package/docs/src/pages/components/steppers/images/stepper-3.png +0 -0
- package/docs/src/pages/components/steppers/images/stepper-4.png +0 -0
- package/docs/src/pages/components/steppers/images/stepper-5.png +0 -0
- package/docs/src/pages/components/steppers/images/stepper-6.png +0 -0
- package/docs/src/pages/components/steppers/interactions.mdx +28 -0
- package/docs/src/pages/components/steppers/usage.mdx +201 -0
- package/docs/src/pages/components/switch/code.mdx +16 -0
- package/docs/src/pages/components/switch/images/switch-1.gif +0 -0
- package/docs/src/pages/components/switch/images/switch-2.gif +0 -0
- package/docs/src/pages/components/switch/images/switch-3.png +0 -0
- package/docs/src/pages/components/switch/interactions.mdx +392 -0
- package/docs/src/pages/components/switch/usage.mdx +114 -0
- package/docs/src/pages/components/table/code.mdx +14 -0
- package/docs/src/pages/components/table/images/table-1.png +0 -0
- package/docs/src/pages/components/table/images/table-10.png +0 -0
- package/docs/src/pages/components/table/images/table-11.gif +0 -0
- package/docs/src/pages/components/table/images/table-12.png +0 -0
- package/docs/src/pages/components/table/images/table-13.png +0 -0
- package/docs/src/pages/components/table/images/table-14.png +0 -0
- package/docs/src/pages/components/table/images/table-15.png +0 -0
- package/docs/src/pages/components/table/images/table-16.png +0 -0
- package/docs/src/pages/components/table/images/table-17.png +0 -0
- package/docs/src/pages/components/table/images/table-18.png +0 -0
- package/docs/src/pages/components/table/images/table-19.png +0 -0
- package/docs/src/pages/components/table/images/table-2.png +0 -0
- package/docs/src/pages/components/table/images/table-20.png +0 -0
- package/docs/src/pages/components/table/images/table-21.png +0 -0
- package/docs/src/pages/components/table/images/table-22.png +0 -0
- package/docs/src/pages/components/table/images/table-23.png +0 -0
- package/docs/src/pages/components/table/images/table-24.png +0 -0
- package/docs/src/pages/components/table/images/table-25.png +0 -0
- package/docs/src/pages/components/table/images/table-26.png +0 -0
- package/docs/src/pages/components/table/images/table-27.png +0 -0
- package/docs/src/pages/components/table/images/table-28.png +0 -0
- package/docs/src/pages/components/table/images/table-29.png +0 -0
- package/docs/src/pages/components/table/images/table-3.png +0 -0
- package/docs/src/pages/components/table/images/table-30.png +0 -0
- package/docs/src/pages/components/table/images/table-4.png +0 -0
- package/docs/src/pages/components/table/images/table-5.png +0 -0
- package/docs/src/pages/components/table/images/table-6.png +0 -0
- package/docs/src/pages/components/table/images/table-7.png +0 -0
- package/docs/src/pages/components/table/images/table-8.png +0 -0
- package/docs/src/pages/components/table/images/table-9.png +0 -0
- package/docs/src/pages/components/table/interactions.mdx +97 -0
- package/docs/src/pages/components/table/usage.mdx +364 -0
- package/docs/src/pages/components/tabs/code.mdx +15 -0
- package/docs/src/pages/components/tabs/images/tabs-1.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-2.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-3.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-4.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-5.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-6.png +0 -0
- package/docs/src/pages/components/tabs/images/tabs-7.png +0 -0
- package/docs/src/pages/components/tabs/interactions.mdx +487 -0
- package/docs/src/pages/components/tabs/usage.mdx +164 -0
- package/docs/src/pages/components/toast/code.mdx +15 -0
- package/docs/src/pages/components/toast/images/toast-1.png +0 -0
- package/docs/src/pages/components/toast/images/toast-2.gif +0 -0
- package/docs/src/pages/components/toast/images/toast-3.gif +0 -0
- package/docs/src/pages/components/toast/images/toast-4.png +0 -0
- package/docs/src/pages/components/toast/images/toast-5.gif +0 -0
- package/docs/src/pages/components/toast/images/toast-6.gif +0 -0
- package/docs/src/pages/components/toast/interactions.mdx +218 -0
- package/docs/src/pages/components/toast/usage.mdx +156 -0
- package/docs/src/pages/components/tooltip/code.mdx +16 -0
- package/docs/src/pages/components/tooltip/images/Tooltip-1.png +0 -0
- package/docs/src/pages/components/tooltip/images/tooltip-2.gif +0 -0
- package/docs/src/pages/components/tooltip/images/tooltip-3.gif +0 -0
- package/docs/src/pages/components/tooltip/interactions.mdx +219 -0
- package/docs/src/pages/components/tooltip/usage.mdx +80 -0
- package/docs/src/pages/content/button-guidelines/index.mdx +7 -0
- package/docs/src/pages/content/button-guidelines/tabs/button-glossary.mdx +144 -0
- package/docs/src/pages/content/button-guidelines/tabs/confusing-buttons.mdx +184 -0
- package/docs/src/pages/content/email-guidelines.mdx +107 -0
- package/docs/src/pages/content/empty-states.mdx +8 -0
- package/docs/src/pages/content/error-messages.mdx +165 -0
- package/docs/src/pages/content/house-rules/tabs/basics.mdx +236 -0
- package/docs/src/pages/content/house-rules/tabs/date,-time-&-numbers.mdx +462 -0
- package/docs/src/pages/content/house-rules/tabs/grammer.mdx +744 -0
- package/docs/src/pages/content/house-rules/tabs/punctuations.mdx +666 -0
- package/docs/src/pages/content/placeholder-text.mdx +58 -0
- package/docs/src/pages/content/rules.mdx +136 -0
- package/docs/src/pages/content/voice-and-tone-guidelines/index.mdx +7 -0
- package/docs/src/pages/content/voice-and-tone-guidelines/tabs/usage.mdx +309 -0
- package/docs/src/pages/content/voice-and-tone-guidelines/tabs/voice-and-tone.mdx +38 -0
- package/docs/src/pages/contributions.mdx +16 -0
- package/docs/src/pages/foundations/colors.mdx +149 -0
- package/docs/src/pages/foundations/interactions.mdx +192 -0
- package/docs/src/pages/foundations/layout/images/baseline-grid.png +0 -0
- package/docs/src/pages/foundations/layout/images/grid-column.jpeg +0 -0
- package/docs/src/pages/foundations/layout/images/grid-layout.jpeg +0 -0
- package/docs/src/pages/foundations/layout/images/grid-margin.jpeg +0 -0
- package/docs/src/pages/foundations/layout/images/spacing.png +0 -0
- package/docs/src/pages/foundations/layout/images/typography.png +0 -0
- package/docs/src/pages/foundations/layout/index.mdx +151 -0
- package/docs/src/pages/foundations/logos.mdx +88 -0
- package/docs/src/pages/foundations/principles.mdx +60 -0
- package/docs/src/pages/foundations/response-time.mdx +124 -0
- package/docs/src/pages/foundations/typography.mdx +8 -0
- package/docs/src/pages/getting-started/index.mdx +9 -0
- package/docs/src/pages/guides/MDX.mdx +17 -0
- package/docs/src/pages/home/HomeBanner.png +0 -0
- package/docs/src/pages/home/homepage.css +23 -0
- package/docs/src/pages/index.js +241 -0
- package/docs/src/pages/introduction/get-started/designers.mdx +89 -0
- package/docs/src/pages/introduction/get-started/developers.mdx +128 -0
- package/docs/src/pages/introduction/what's-new.mdx +801 -0
- package/docs/src/pages/mobile/components/avatar/code.mdx +12 -0
- package/docs/src/pages/mobile/components/avatar/usage.mdx +20 -0
- package/docs/src/pages/mobile/components/badges/code.mdx +16 -0
- package/docs/src/pages/mobile/components/badges/usage.mdx +23 -0
- package/docs/src/pages/mobile/components/breadcrumbs/code.mdx +16 -0
- package/docs/src/pages/mobile/components/breadcrumbs/usage.mdx +34 -0
- package/docs/src/pages/mobile/components/button/code.mdx +12 -0
- package/docs/src/pages/mobile/components/button/content.mdx +1 -0
- package/docs/src/pages/mobile/components/button/usage.mdx +55 -0
- package/docs/src/pages/mobile/components/card/code.mdx +16 -0
- package/docs/src/pages/mobile/components/card/usage.mdx +23 -0
- package/docs/src/pages/mobile/components/checkbox/code.mdx +16 -0
- package/docs/src/pages/mobile/components/checkbox/usage.mdx +49 -0
- package/docs/src/pages/mobile/components/index.mdx +7 -0
- package/docs/src/pages/mobile/components/message/code.mdx +16 -0
- package/docs/src/pages/mobile/components/message/usage.mdx +26 -0
- package/docs/src/pages/mobile/components/overview/index.mdx +8 -0
- package/docs/src/pages/mobile/components/overview/tabs/all-components.mdx +8 -0
- package/docs/src/pages/mobile/components/overview/tabs/status.mdx +115 -0
- package/docs/src/pages/mobile/foundations/colors.mdx +149 -0
- package/docs/src/pages/mobile/foundations/interactions.mdx +192 -0
- package/docs/src/pages/mobile/foundations/layout/images/baseline-grid.png +0 -0
- package/docs/src/pages/mobile/foundations/layout/images/grid-column.jpeg +0 -0
- package/docs/src/pages/mobile/foundations/layout/images/grid-layout.jpeg +0 -0
- package/docs/src/pages/mobile/foundations/layout/images/grid-margin.jpeg +0 -0
- package/docs/src/pages/mobile/foundations/layout/images/spacing.png +0 -0
- package/docs/src/pages/mobile/foundations/layout/images/typography.png +0 -0
- package/docs/src/pages/mobile/foundations/layout/index.mdx +151 -0
- package/docs/src/pages/mobile/foundations/logos.mdx +88 -0
- package/docs/src/pages/mobile/foundations/principles.mdx +47 -0
- package/docs/src/pages/mobile/foundations/response-time.mdx +124 -0
- package/docs/src/pages/mobile/foundations/typography.mdx +8 -0
- package/docs/src/pages/patterns/index.mdx +7 -0
- package/docs/src/pages/resources/index.mdx +7 -0
- package/docs/src/util/FooterItems.js +21 -0
- package/docs/src/util/Frontmatter.js +35 -0
- package/docs/src/util/HeaderItems.js +21 -0
- package/docs/src/util/Helpers.js +7 -0
- package/docs/src/util/HomeMenu.js +24 -0
- package/docs/src/util/HomeResources.js +23 -0
- package/docs/src/util/InPageNavItems.js +36 -0
- package/docs/src/util/Logos.js +19 -0
- package/docs/src/util/MdsChangelog.js +55 -0
- package/docs/src/util/MediumBlogs.js +27 -0
- package/docs/src/util/NavItems.js +82 -0
- package/docs/src/util/StorybookData.js +24 -0
- package/docs/src/util/constants.js +7 -0
- package/docs/src/util/context/NavContext.js +54 -0
- package/docs/src/util/hooks/index.js +1 -0
- package/docs/src/util/hooks/useMetadata.js +21 -0
- package/docs/src/util/index.js +4 -0
- package/docs/static/icons/4691539_codesandbox_icon.svg +1 -0
- package/docs/static/icons/card-image.png +0 -0
- package/docs/static/icons/favicon_io/android-chrome-192x192.png +0 -0
- package/docs/static/icons/favicon_io/android-chrome-512x512.png +0 -0
- package/docs/static/icons/favicon_io/apple-touch-icon.png +0 -0
- package/docs/static/icons/favicon_io/favicon-16x16.png +0 -0
- package/docs/static/icons/favicon_io/favicon-32x32.png +0 -0
- package/docs/static/icons/favicon_io/favicon.ico +0 -0
- package/docs/static/images/P360.png +0 -0
- package/docs/static/images/dap.png +0 -0
- package/docs/static/images/default.png +0 -0
- package/docs/static/images/designtoken.png +0 -0
- package/docs/static/images/figma.png +0 -0
- package/docs/static/images/headerLogo.png +0 -0
- package/docs/static/images/inacademy.png +0 -0
- package/docs/static/images/inapi.png +0 -0
- package/docs/static/images/incare.png +0 -0
- package/docs/static/images/inconnect.png +0 -0
- package/docs/static/images/indata.png +0 -0
- package/docs/static/images/ingraph.png +0 -0
- package/docs/static/images/innote.png +0 -0
- package/docs/static/images/inoffice.png +0 -0
- package/docs/static/images/inreport.png +0 -0
- package/docs/static/images/storybook.png +0 -0
- package/docs/static/images/withoutType.png +0 -0
- package/docs/tools/build.sh +6 -0
- package/docs/tools/changelog.sh +1 -0
- package/docs/tools/changeloghead.md +14 -0
- package/docs/tools/develop.sh +5 -0
- package/docs/tools/extract.js +52 -0
- package/docs/tools/update-mds.sh +3 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -1
- package/tsconfig.type.json +2 -1
- package/docs/AppTutorial.md +0 -474
- package/docs/images/BasicLayout.png +0 -0
- package/docs/images/Breadcrumb.png +0 -0
- package/docs/images/Covid-App.png +0 -0
- package/docs/images/DrilledLayout.png +0 -0
- package/docs/images/DrilledPage.png +0 -0
- package/docs/images/Footer.png +0 -0
- package/docs/images/Graph1.png +0 -0
- package/docs/images/Graph2.png +0 -0
- package/docs/images/Header.png +0 -0
- package/docs/images/Map.png +0 -0
- package/docs/images/StaticComponent.png +0 -0
- package/docs/images/Summary.png +0 -0
- package/docs/images/Table.png +0 -0
package/docs/AppTutorial.md
DELETED
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
<h1 align="center">
|
|
2
|
-
Tutorial
|
|
3
|
-
</h1>
|
|
4
|
-
<h2 align="center">
|
|
5
|
-
Covid-19 Tracker App
|
|
6
|
-
</h2>
|
|
7
|
-
|
|
8
|
-
Welcome! <br/>
|
|
9
|
-
This tutorial will guide you in creating an awesome app with Innovaccer Design System. Here is a [preview](https://covid19-tracker.info/) of the app that we are going to build. This tutorial also has an accompanying [github repository](https://github.com/sandeshchoudhary/covid).
|
|
10
|
-
|
|
11
|
-
## Audience
|
|
12
|
-
This tutorial is intended for people with all amounts of web development experience. If you want to jump straight to code, you may want to skip this tutorial and go to the [developer guidelines](https://github.com/innovaccer/design-system/blob/master/CONTRIBUTING.md) page.
|
|
13
|
-
|
|
14
|
-
## Prerequisites
|
|
15
|
-
* Node JS
|
|
16
|
-
* Git
|
|
17
|
-
|
|
18
|
-
## Getting Started
|
|
19
|
-
Each step in this guideline illustrates a different aspect of developing web applications with Innovaccer design system. Refer the following sections below to get familiar with this project:
|
|
20
|
-
* [Initializing App](#APP_INIT)
|
|
21
|
-
* [Installing component Library](#COMPONENT_LIBRARY)
|
|
22
|
-
* [Creating page grid](#BUILDING_LANDING_PAGE)
|
|
23
|
-
* [Building Drilled Page](#BUILDING_DRILLED_PAGE)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## <a name="APP_INIT"></a>Initializing App
|
|
27
|
-
We will start with `Create React App`.
|
|
28
|
-
```jsx
|
|
29
|
-
npx create-react-app covid
|
|
30
|
-
cd covid
|
|
31
|
-
npm start
|
|
32
|
-
```
|
|
33
|
-
Next, you need to install Innovaccer design system in your project using the following command :
|
|
34
|
-
```bash
|
|
35
|
-
npm install @innovaccer/design-system
|
|
36
|
-
```
|
|
37
|
-
Follow [developer guidelines](https://github.com/innovaccer/design-system/blob/master/README.md) to install style.
|
|
38
|
-
|
|
39
|
-
## <a name="COMPONENT_LIBRARY"></a>Installing component Library
|
|
40
|
-
A preview of what you will build:
|
|
41
|
-
|
|
42
|
-

|
|
43
|
-
Lets begin by creating the basic Header and Footer components. We will be adding *Heading.js* and *Footer.js* in our src folder.
|
|
44
|
-
```jsx
|
|
45
|
-
src
|
|
46
|
-
├──Header.js
|
|
47
|
-
├──Footer.js
|
|
48
|
-
```
|
|
49
|
-
Here is a preview of Header component:
|
|
50
|
-
|
|
51
|
-

|
|
52
|
-
|
|
53
|
-
So, we will be needing *Heading* component from our design-system package.
|
|
54
|
-
```jsx
|
|
55
|
-
import { Heading } from 'design-system';
|
|
56
|
-
```
|
|
57
|
-
Heading component can be used in the following way:
|
|
58
|
-
```jsx
|
|
59
|
-
<header>
|
|
60
|
-
<Heading size="l" appearance="white">
|
|
61
|
-
Covid-19
|
|
62
|
-
</Heading>
|
|
63
|
-
</header>
|
|
64
|
-
```
|
|
65
|
-
Now we will create a Footer for our app. Here is a preview of Footer component:
|
|
66
|
-
|
|
67
|
-

|
|
68
|
-
|
|
69
|
-
For the footer, we are going to use *Heading* and *Text* component. In *Footer.js*, add these lines:
|
|
70
|
-
```jsx
|
|
71
|
-
import { Link, Text } from 'design-system';
|
|
72
|
-
```
|
|
73
|
-
We can use Text and Link inside footer element in the following way:
|
|
74
|
-
```jsx
|
|
75
|
-
<footer className="App-footer">
|
|
76
|
-
<Text appearance="white" weight="strong">
|
|
77
|
-
© Copyright {year} UI-Engine
|
|
78
|
-
</Text>
|
|
79
|
-
<Link onClick={() => history.push('/references')}>References</Link>
|
|
80
|
-
</footer>
|
|
81
|
-
```
|
|
82
|
-
### Add Routing
|
|
83
|
-
We’ve updated our app to render, but now we need to add routing functionality to handle our drilled states. To do this we first need to install react-router-dom.
|
|
84
|
-
```jsx
|
|
85
|
-
npm install --save react-router-dom
|
|
86
|
-
```
|
|
87
|
-
Now, we need to wrap our app in the Router component. In the root *index.js*, add the import:
|
|
88
|
-
```jsx
|
|
89
|
-
import { HashRouter as Router, Switch, Route } from 'react-router-dom';
|
|
90
|
-
```
|
|
91
|
-
Then, update the render() function to include the Router.
|
|
92
|
-
```jsx
|
|
93
|
-
<div>
|
|
94
|
-
<Header />
|
|
95
|
-
<Router basename={/}>
|
|
96
|
-
<Footer />
|
|
97
|
-
</Router>
|
|
98
|
-
</div>
|
|
99
|
-
```
|
|
100
|
-
## <a name="BUILDING_LANDING_PAGE"></a>Creating page grid
|
|
101
|
-
We are now going to build our `landing page`. Let's begin by adding grid to our page. So, create a React component called Home. In the src directory, create a Home directory. Create the following files inside *src/Home/index.js* and *src/Home/Home.css*:
|
|
102
|
-
```jsx
|
|
103
|
-
src/Home
|
|
104
|
-
├──index.js
|
|
105
|
-
├──Home.css
|
|
106
|
-
```
|
|
107
|
-
We will break our landing page into two rows. The first row looks like it has two columns of different widths and the second row has two columns of equal width. Now that we’re building the page with grid, we need to import grid from our *design-system* package to *Home/index.js*.
|
|
108
|
-
```jsx
|
|
109
|
-
import { Row, Column } from 'design-system';
|
|
110
|
-
```
|
|
111
|
-
We can continue to make rows by adding a *<Row>*, as well as make columns within those rows by adding *<Column>*.
|
|
112
|
-
```jsx
|
|
113
|
-
<div>
|
|
114
|
-
<Row>
|
|
115
|
-
<Column size={12} sizeXL={7}>...</Column>
|
|
116
|
-
<Column size={12} sizeXL={5}>...</Column>
|
|
117
|
-
</Row>
|
|
118
|
-
<Row>
|
|
119
|
-
<Column size={6} sizeM={12} sizeXS={12}>...</Column>
|
|
120
|
-
<Column size={6} sizeM={12} sizeXS={12}>...</Column>
|
|
121
|
-
</Row>
|
|
122
|
-
</div>
|
|
123
|
-
```
|
|
124
|
-
Now, we want to route this Home component, so add the following lines inside *Router* element in *index/js*:
|
|
125
|
-
```jsx
|
|
126
|
-
<Switch>
|
|
127
|
-
<Route exact path="/">
|
|
128
|
-
<Home />
|
|
129
|
-
</Route>
|
|
130
|
-
</Switch>
|
|
131
|
-
```
|
|
132
|
-
Coming back to our Home component, we want to maintain modularity in our app, so we can further divide the columns content into components. In the src directory, create Map, CovidInfo and Summary.
|
|
133
|
-
```jsx
|
|
134
|
-
src
|
|
135
|
-
├──Home
|
|
136
|
-
├──index.js
|
|
137
|
-
├──Home.css
|
|
138
|
-
├──Map
|
|
139
|
-
├──index.js
|
|
140
|
-
├──Map.css
|
|
141
|
-
├──Summary
|
|
142
|
-
├──index.js
|
|
143
|
-
├──Summary.css
|
|
144
|
-
├──CovidInfo
|
|
145
|
-
├──index.js
|
|
146
|
-
├──CovidInfo.css
|
|
147
|
-
```
|
|
148
|
-
Map and Summary components will be populated with data from API while CovidInfo would be a static component. We will now build a basic layout using `Cards` and `Heading` components. Here is the preview of what you will build:
|
|
149
|
-
|
|
150
|
-

|
|
151
|
-
|
|
152
|
-
First, let’s import the components we need. Because we’ll be importing several components for this page, we’ll import them directly from the *design-system* package instead of the direct path for each one. In our *Map/index.js*, *Summary/index.js* and *CovidInfo/index.js*, we need to add:
|
|
153
|
-
```jsx
|
|
154
|
-
import { Heading, Card } from 'design-system';
|
|
155
|
-
```
|
|
156
|
-
In *Map/index.js*, we can wrap *Heading* inside *Card* component like this:
|
|
157
|
-
```jsx
|
|
158
|
-
<Card
|
|
159
|
-
shadow="light"
|
|
160
|
-
style={{
|
|
161
|
-
backgroundColor: 'white'
|
|
162
|
-
}}
|
|
163
|
-
>
|
|
164
|
-
<Heading size="m"> Map </Heading>
|
|
165
|
-
</Card>
|
|
166
|
-
```
|
|
167
|
-
Now that Summary and CovidInfo components would have a similar pattern, we would set them up in the same way.
|
|
168
|
-
|
|
169
|
-
### Building Static Component
|
|
170
|
-
Now it’s time to build a static component CovidInfo. API call is not required at this step because the component will be populated by static data. Here is a preview of what you will build:
|
|
171
|
-
|
|
172
|
-

|
|
173
|
-
|
|
174
|
-
As we have already added the *Heading* component in previous steps, we will now be adding *Text* component. In *CovidInfo/index.js* :
|
|
175
|
-
```jsx
|
|
176
|
-
import { Text } from 'design-system';
|
|
177
|
-
```
|
|
178
|
-
We can use *Text* component like this:
|
|
179
|
-
```jsx
|
|
180
|
-
<div>
|
|
181
|
-
<Text>Use a medical face mask</Text>
|
|
182
|
-
<Text>Wash your hands with soap and water</Text>
|
|
183
|
-
</div>
|
|
184
|
-
```
|
|
185
|
-
Similarly, Symptoms can be added in the following way:
|
|
186
|
-
```jsx
|
|
187
|
-
<div>
|
|
188
|
-
<Heading>Symptoms</Heading>
|
|
189
|
-
<div>
|
|
190
|
-
<Text>Fever, Cough</Text>
|
|
191
|
-
<Text>Respiratoy Symptoms</Text>
|
|
192
|
-
</div>
|
|
193
|
-
</div>
|
|
194
|
-
```
|
|
195
|
-
You can style the CovidInfo component by adding CSS in *CovidInfo.css*
|
|
196
|
-
|
|
197
|
-
### Building Dynamic Components
|
|
198
|
-
This step takes our components and populates them with data from the GraphQL API – loading states and all. To do so, we’ll be using Apollo Client, the front-end component of the [Apollo Platform](https://www.apollographql.com/docs/intro/platform). Apollo Client is a sophisticated GraphQL client that manages data and state in an application.
|
|
199
|
-
You need to follow these steps to fetch data from API:
|
|
200
|
-
* ###### Install dependencies
|
|
201
|
-
|
|
202
|
-
We’ll need to install three new dependencies to incorporate Apollo into our application namely `apollo-boost`, `graphQl` and `react-apollo`
|
|
203
|
-
* ###### Connect to Apollo
|
|
204
|
-
Create a new directory src/api.
|
|
205
|
-
```jsx
|
|
206
|
-
src
|
|
207
|
-
├──api
|
|
208
|
-
├──index.js
|
|
209
|
-
```
|
|
210
|
-
Inside *api/index.js*, you can make your client by providing a URI :
|
|
211
|
-
```jsx
|
|
212
|
-
import ApolloClient from 'apollo-boost';
|
|
213
|
-
export const client = new ApolloClient({
|
|
214
|
-
uri: 'https://covid-tracker-news-graphql.now.sh/'
|
|
215
|
-
});
|
|
216
|
-
```
|
|
217
|
-
Now we need to wrap our application with ApolloProvider. So, inside *src/index.js* :
|
|
218
|
-
```jsx
|
|
219
|
-
import { ApolloProvider } from '@apollo/react-hooks';
|
|
220
|
-
import { client } from './api';
|
|
221
|
-
ReactDOM.render(
|
|
222
|
-
<ApolloProvider client={client}>
|
|
223
|
-
<Router>...</Router>
|
|
224
|
-
</ApolloProvider>
|
|
225
|
-
)
|
|
226
|
-
```
|
|
227
|
-
* ###### Fetch data
|
|
228
|
-
Next we’ll assemble our GraphQL using the gql helper. The gql helper lets you write GraphQL queries using interpolated strings (backticks) in JavaScript. In addition, we’ll be using the Query component from react-apollo which gives us some great information about our query’s loading state in addition to the data. [Click here](https://github.com/sandeshchoudhary/covid/blob/master/src/query.js) for more details.
|
|
229
|
-
|
|
230
|
-
Finally, you can get the data, loading and error states in your component using `useQuery` from `@apollo/react-hooks`. For example:
|
|
231
|
-
```jsx
|
|
232
|
-
const { loading, error, data } = useQuery(query.data);
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
### Building Visualization Components Using API Data
|
|
236
|
-
Now that we have fetched the required data, we can easily render them in our component. Now its time to build `Map component` using the fetched API data. Here is the preview of what you will build:
|
|
237
|
-
|
|
238
|
-

|
|
239
|
-
|
|
240
|
-
As we have already added *Card* inside Map component, our next task is to add layout in this component. The component looks like it has *heading*, *subheading* and *[ChoroplethMap](https://github.com/sandeshchoudhary/covid/blob/master/src/Map/choropleth.js)* in first column and info cards with *text* component in second column. So, inside *Map/index.js*, we need to add:
|
|
241
|
-
```jsx
|
|
242
|
-
import ChoroplethMap from './choropleth';
|
|
243
|
-
import { Row, Column, Heading, Subheading, Text } from 'design-system';
|
|
244
|
-
```
|
|
245
|
-
For the first column, we need to add:
|
|
246
|
-
```jsx
|
|
247
|
-
<Column>
|
|
248
|
-
<Heading size="m">India Map</Heading>
|
|
249
|
-
<Subheading appearance="subtle" size="s">
|
|
250
|
-
Hover for more details
|
|
251
|
-
</Subheading>
|
|
252
|
-
<ChoroplethMap
|
|
253
|
-
statistic={statistic}
|
|
254
|
-
mapMeta={currentMap}
|
|
255
|
-
mapData={currentMapData}
|
|
256
|
-
setHoveredRegion={setHoveredRegion}
|
|
257
|
-
changeMap={switchMapToState}
|
|
258
|
-
selectedRegion={selectedRegion}
|
|
259
|
-
setSelectedRegion={setSelectedRegion}
|
|
260
|
-
/>
|
|
261
|
-
</Column>
|
|
262
|
-
```
|
|
263
|
-
Note that we are fetching *currentMap*, *currentMapData* etc. from API. Now moving to our second column, we can add map info cards in the following way:
|
|
264
|
-
```jsx
|
|
265
|
-
<div className="Map-info-item">
|
|
266
|
-
<div>
|
|
267
|
-
<div className="InfoLegend"></div>
|
|
268
|
-
<Text>Confirmed</Text>
|
|
269
|
-
</div>
|
|
270
|
-
<div className="pt-3 pl-5">
|
|
271
|
-
<Text>
|
|
272
|
-
{formatNumber(currentHoveredRegion.confirmed)}
|
|
273
|
-
</Text>
|
|
274
|
-
</div>
|
|
275
|
-
```
|
|
276
|
-
Here *currentHoveredRegion* is fetched from API. We can make similar info cards for Active, Recovered, Deceased and Tested parameters. Also, styling for this column can be added in *Map.css*.
|
|
277
|
-
Moving on to next dynamic component i.e `Summary`, here is a preview of what you will build:
|
|
278
|
-
|
|
279
|
-

|
|
280
|
-
|
|
281
|
-
The two columns seems to have same layout but different statistics which can be handled through API in the following way:
|
|
282
|
-
```jsx
|
|
283
|
-
const { loading, error, data: indiaStats } = useQuery(query.indiaStats);
|
|
284
|
-
const { loading: worldLoading, error: worldError, data: worldData } = useQuery(query.world);
|
|
285
|
-
```
|
|
286
|
-
So, we will be making same component for both the columns and will handle the numbers through API data. So in *Home/index.js*:
|
|
287
|
-
```jsx
|
|
288
|
-
// For World Statistics
|
|
289
|
-
<Summary
|
|
290
|
-
entity="world"
|
|
291
|
-
showLink={true}
|
|
292
|
-
stats={worldData}
|
|
293
|
-
/>
|
|
294
|
-
// For India Statistics
|
|
295
|
-
<Summary
|
|
296
|
-
entity="india"
|
|
297
|
-
showLink={true}
|
|
298
|
-
stats={indiaStats}
|
|
299
|
-
/>
|
|
300
|
-
```
|
|
301
|
-
Moving on to Summary component, we have already wrapped *Card* inside Summary component in previous steps, so we will now add other components in the following way:
|
|
302
|
-
```jsx
|
|
303
|
-
import { Subheading, Row, Column, Legend, Icon, DonutChart } from 'design-system';
|
|
304
|
-
```
|
|
305
|
-
*Icon* in the header of Summary component corresponds to a drill state. So we will be adding a click handler to icon in the following way:
|
|
306
|
-
```jsx
|
|
307
|
-
<div className="Summary-heading">
|
|
308
|
-
<Heading size="m">India Statistics</Heading>
|
|
309
|
-
<Icon name="open_in_new" appearance="subtle" size="24" onClick={() => handleMore(entity)} />
|
|
310
|
-
</div>
|
|
311
|
-
```
|
|
312
|
-
Now, we will be adding *Legend* and *Donut Chart* components in different columns:
|
|
313
|
-
```jsx
|
|
314
|
-
<Column>
|
|
315
|
-
<div className="Summary-details">
|
|
316
|
-
<Legend labelWeight="medium" iconAppearance="primary" label="Active" />
|
|
317
|
-
<Legend labelWeight="medium" iconAppearance="alert" label="Deaths" />
|
|
318
|
-
</div>
|
|
319
|
-
</Column>
|
|
320
|
-
<Column>
|
|
321
|
-
<DonutChart
|
|
322
|
-
data={data}
|
|
323
|
-
withCenterText={false}
|
|
324
|
-
donutWidth={60}
|
|
325
|
-
colors={['primary', 'success', 'alert']}
|
|
326
|
-
/>
|
|
327
|
-
</Column>
|
|
328
|
-
```
|
|
329
|
-
## <a name="BUILDING_DRILLED_PAGE"></a>Building Drilled Page
|
|
330
|
-
Till now, we have updated our app to render our landing page, now its time to add drilled states. Lets make a new component IndiaStats inside our src directory.
|
|
331
|
-
```jsx
|
|
332
|
-
src/IndiaStats
|
|
333
|
-
├──index.js
|
|
334
|
-
├──Stats.css
|
|
335
|
-
```
|
|
336
|
-
Here is a preview of what you will build:
|
|
337
|
-
|
|
338
|
-

|
|
339
|
-
|
|
340
|
-
Lets add a basic grid.
|
|
341
|
-
```jsx
|
|
342
|
-
import {Row, Column} from 'design-system';
|
|
343
|
-
```
|
|
344
|
-
```jsx
|
|
345
|
-
<Row>
|
|
346
|
-
<Column>...</Column>
|
|
347
|
-
<Column>
|
|
348
|
-
<Row>
|
|
349
|
-
<Column>...</Column>
|
|
350
|
-
<Column>...</Column>
|
|
351
|
-
</Row>
|
|
352
|
-
</Column>
|
|
353
|
-
</Row>
|
|
354
|
-
```
|
|
355
|
-
Now, we need to add this component inside our Router. So, inside *src/index.js*, add another route like this:
|
|
356
|
-
```jsx
|
|
357
|
-
<Route path="/india">
|
|
358
|
-
<IndiaStats entity="india" queryType="india" />
|
|
359
|
-
</Route>
|
|
360
|
-
```
|
|
361
|
-
Coming back to our IndiaStats component, we will first build a header of our new page. Here is a preview of what you will build:
|
|
362
|
-
|
|
363
|
-

|
|
364
|
-
|
|
365
|
-
For building a header, we want *Breadcrumb* component from our design-system package. So, in *IndiaStats/index.js*, add these lines:
|
|
366
|
-
```jsx
|
|
367
|
-
import { Breadcrumb, BreadcrumbsWrapper } from 'design-system';
|
|
368
|
-
```
|
|
369
|
-
Inside render, add:
|
|
370
|
-
```jsx
|
|
371
|
-
<header>
|
|
372
|
-
<BreadcrumbsWrapper heading='India Statistics'>
|
|
373
|
-
<Breadcrumb>
|
|
374
|
-
<Link onClick={() => history.push('/')}>HOME</Link>
|
|
375
|
-
</Breadcrumb>
|
|
376
|
-
</BreadcrumbsWrapper>
|
|
377
|
-
</header>
|
|
378
|
-
```
|
|
379
|
-
After building header, its time to add Cards inside Column components. Here is a preview of what you will build now:
|
|
380
|
-
|
|
381
|
-

|
|
382
|
-
|
|
383
|
-
So inside *IndiaStats/index.js*, add these lines:
|
|
384
|
-
```jsx
|
|
385
|
-
import { Card, Heading } from 'design-system';
|
|
386
|
-
```
|
|
387
|
-
Now we will add Heading and Card inside individual column:
|
|
388
|
-
```jsx
|
|
389
|
-
<Card>
|
|
390
|
-
<Heading size="m">States and Uniton Territories</Heading>
|
|
391
|
-
</Card>
|
|
392
|
-
```
|
|
393
|
-
After building a basic layout, lets move on to our first column. Here is a preview of what you will build now:
|
|
394
|
-
|
|
395
|
-

|
|
396
|
-
|
|
397
|
-
So for our first column, we need Input, Table and Text. So, let's import these components inside *IndiaStats/index.js*:
|
|
398
|
-
```jsx
|
|
399
|
-
import { Input, Table, Text } from 'design-system':
|
|
400
|
-
```
|
|
401
|
-
Inside first column, add these lines:
|
|
402
|
-
```jsx
|
|
403
|
-
<Input
|
|
404
|
-
clearButton={true}
|
|
405
|
-
value={searchQuery}
|
|
406
|
-
icon="search"
|
|
407
|
-
name="input"
|
|
408
|
-
placeholder="Search"
|
|
409
|
-
onChange={(ev) => handleSearch(ev.target.value)}
|
|
410
|
-
onClear={() => handleSearch('')}
|
|
411
|
-
/>
|
|
412
|
-
<Text small={true}>Showing 37 States and UTs</Text>
|
|
413
|
-
<Table
|
|
414
|
-
loading={loading}
|
|
415
|
-
buffer={10}
|
|
416
|
-
schema={schema}
|
|
417
|
-
data={data}
|
|
418
|
-
/>
|
|
419
|
-
```
|
|
420
|
-
Note that searchQuery is the state of component and is updated by handleSearch function while loading and data is fetched from API. For the internal padding between individual components, you can wrap these components in a div and can add their styling in *Stats.css*.
|
|
421
|
-
Moving on to our next column, there are two cards corresponding to two graphs. Lets look at them individually. Here is a preview of what we will build:
|
|
422
|
-
|
|
423
|
-

|
|
424
|
-
|
|
425
|
-
For the above card, we need to add Heading, Icon and graph. As we have already added Heading in our previous steps, its time to add Icon and graph. We are using [recharts](https://recharts.org/en-US/) library to build the graphs. So, lets import the graphs and Icon in *IndiaStats/index.js* in the following way:
|
|
426
|
-
```jsx
|
|
427
|
-
import {
|
|
428
|
-
ComposedChart, LineChart, XAxis, YAxis, Tooltip,
|
|
429
|
-
Legend, CartesianGrid, Area, Bar, Line,
|
|
430
|
-
ResponsiveContainer
|
|
431
|
-
} from 'recharts';
|
|
432
|
-
import { Icon } from 'design-system':
|
|
433
|
-
```
|
|
434
|
-
To add Icon, add these lines:
|
|
435
|
-
```jsx
|
|
436
|
-
<div className="Stats-heading">
|
|
437
|
-
<Heading size="m">State-wise Statistics</Heading>
|
|
438
|
-
<Icon name="autorenew" appearance="subtle" size="24" />
|
|
439
|
-
</div>
|
|
440
|
-
```
|
|
441
|
-
To add Graph:
|
|
442
|
-
```jsx
|
|
443
|
-
<ResponsiveContainer width={'100%'} height={250}>
|
|
444
|
-
<ComposedChart data={getData(entity, data)}>
|
|
445
|
-
...
|
|
446
|
-
</ComposedChart>
|
|
447
|
-
</ResponsiveContainer>
|
|
448
|
-
```
|
|
449
|
-
Moving on to our next card, here is a preview of what you will build:
|
|
450
|
-
|
|
451
|
-

|
|
452
|
-
|
|
453
|
-
We need RangePicker and Line Chart to build this card. So lets import these components in *IndiaStats/index.js*:
|
|
454
|
-
```jsx
|
|
455
|
-
import { RangePicker } from design-system;
|
|
456
|
-
```
|
|
457
|
-
RangePicker and graph can be added like this:
|
|
458
|
-
```jsx
|
|
459
|
-
<RangePicker
|
|
460
|
-
withInput={true}
|
|
461
|
-
disabledBefore={disabledDate.before}
|
|
462
|
-
disabledAfter={disabledDate.after}
|
|
463
|
-
onRangeChange={onRangeChange}
|
|
464
|
-
/>
|
|
465
|
-
<ResponsiveContainer width={'100%'} height={250}>
|
|
466
|
-
<LineChart data={timeStampsData}>
|
|
467
|
-
...
|
|
468
|
-
</LineChart>
|
|
469
|
-
</ResponsiveContainer>
|
|
470
|
-
```
|
|
471
|
-
Here disabledDate is handled through state while onRangeChange is the callback function.
|
|
472
|
-
|
|
473
|
-
## Wrapping Up
|
|
474
|
-
Thanks for completing the tutorial and helping us improve it along the way.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/docs/images/Footer.png
DELETED
|
Binary file
|
package/docs/images/Graph1.png
DELETED
|
Binary file
|
package/docs/images/Graph2.png
DELETED
|
Binary file
|
package/docs/images/Header.png
DELETED
|
Binary file
|
package/docs/images/Map.png
DELETED
|
Binary file
|
|
Binary file
|
package/docs/images/Summary.png
DELETED
|
Binary file
|
package/docs/images/Table.png
DELETED
|
Binary file
|