design-react-kit 3.3.1 → 4.0.1
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/README.EN.md +35 -17
- package/README.md +34 -18
- package/package.json +152 -120
- package/src/Accordion/Accordion.tsx +30 -0
- package/src/Accordion/AccordionBody.tsx +127 -0
- package/src/Accordion/AccordionHeader.tsx +42 -0
- package/src/Alert/Alert.tsx +39 -0
- package/src/Avatar/AvatarContainer.tsx +22 -0
- package/src/Avatar/AvatarExtraText.tsx +19 -0
- package/src/Avatar/AvatarGroupContainer.tsx +23 -0
- package/src/Avatar/AvatarIcon.tsx +57 -0
- package/src/Avatar/AvatarPresence.tsx +24 -0
- package/src/Avatar/AvatarStatus.tsx +24 -0
- package/src/Avatar/AvatarWrapper.tsx +24 -0
- package/src/Badge/Badge.tsx +40 -0
- package/src/BottomNav/BottomNav.tsx +20 -0
- package/src/BottomNav/BottomNavItem.tsx +75 -0
- package/src/Breadcrumb/Breadcrumb.tsx +40 -0
- package/src/Button/Button.tsx +55 -0
- package/src/Callout/Callout.tsx +35 -0
- package/src/Callout/CalloutText.tsx +29 -0
- package/src/Callout/CalloutTitle.tsx +24 -0
- package/src/Card/Card.tsx +49 -0
- package/src/Card/CardBody.tsx +21 -0
- package/src/Card/CardCategory.tsx +48 -0
- package/src/Card/CardFooterCTA.tsx +19 -0
- package/src/Card/CardReadMore.tsx +35 -0
- package/src/Card/CardSignature.tsx +19 -0
- package/src/Card/CardTag.tsx +19 -0
- package/src/Card/CardTagsHeader.tsx +28 -0
- package/src/Card/CardText.tsx +19 -0
- package/src/Card/CardTitle.tsx +17 -0
- package/src/Chips/Chip.tsx +37 -0
- package/src/Chips/ChipLabel.tsx +19 -0
- package/src/Collapse/Collapse.tsx +100 -0
- package/src/CookieBar/CookieBar.tsx +19 -0
- package/src/CookieBar/CookieBarButton.tsx +27 -0
- package/src/CookieBar/CookieBarButtons.tsx +19 -0
- package/src/Dimmer/Dimmer.tsx +51 -0
- package/src/Dimmer/DimmerButtons.tsx +35 -0
- package/src/FontLoader/FontLoader.tsx +32 -0
- package/src/Forward/Forward.tsx +40 -0
- package/src/Grid/GridItem.tsx +23 -0
- package/src/Grid/GridItemText.tsx +20 -0
- package/src/Grid/GridItemTextWrapper.tsx +21 -0
- package/src/Grid/GridList.tsx +20 -0
- package/src/Grid/GridRow.tsx +20 -0
- package/src/Grid/index.ts +11 -0
- package/src/{components/Header/Header.js → Header/Header.tsx} +19 -24
- package/src/Header/HeaderBrand.tsx +90 -0
- package/src/Header/HeaderContent.tsx +42 -0
- package/src/Header/HeaderContext.tsx +9 -0
- package/src/Header/HeaderLinkZone.tsx +19 -0
- package/src/Header/HeaderRightZone.tsx +26 -0
- package/src/Header/HeaderSearch.tsx +33 -0
- package/src/Header/HeaderSocialsZone.tsx +26 -0
- package/src/Header/HeaderToggler.tsx +46 -0
- package/src/{components/Header/Headers.js → Header/Headers.tsx} +17 -22
- package/src/Hero/Hero.tsx +34 -0
- package/src/Hero/HeroBackground.tsx +25 -0
- package/src/Hero/HeroBody.tsx +21 -0
- package/src/Hero/HeroButton.tsx +19 -0
- package/src/Hero/HeroCategory.tsx +15 -0
- package/src/Hero/HeroTitle.tsx +16 -0
- package/src/Hero/index.ts +13 -0
- package/src/Icon/EmptyIcon.tsx +7 -0
- package/src/Icon/Icon.tsx +116 -0
- package/src/Icon/assets/ItArrowDown.tsx +9 -0
- package/src/Icon/assets/ItArrowDownCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowDownTriangle.tsx +9 -0
- package/src/Icon/assets/ItArrowLeft.tsx +9 -0
- package/src/Icon/assets/ItArrowLeftCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowLeftTriangle.tsx +9 -0
- package/src/Icon/assets/ItArrowRight.tsx +9 -0
- package/src/Icon/assets/ItArrowRightCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowRightTriangle.tsx +9 -0
- package/src/Icon/assets/ItArrowUp.tsx +9 -0
- package/src/Icon/assets/ItArrowUpCircle.tsx +9 -0
- package/src/Icon/assets/ItArrowUpTriangle.tsx +9 -0
- package/src/Icon/assets/ItBan.tsx +9 -0
- package/src/Icon/assets/ItBehance.tsx +9 -0
- package/src/Icon/assets/ItBookmark.tsx +9 -0
- package/src/Icon/assets/ItBox.tsx +12 -0
- package/src/Icon/assets/ItBurger.tsx +9 -0
- package/src/Icon/assets/ItCalendar.tsx +9 -0
- package/src/Icon/assets/ItCamera.tsx +9 -0
- package/src/Icon/assets/ItCard.tsx +9 -0
- package/src/Icon/assets/ItChartLine.tsx +12 -0
- package/src/Icon/assets/ItCheck.tsx +9 -0
- package/src/Icon/assets/ItCheckCircle.tsx +9 -0
- package/src/Icon/assets/ItChevronLeft.tsx +8 -0
- package/src/Icon/assets/ItChevronRight.tsx +8 -0
- package/src/Icon/assets/ItClip.tsx +9 -0
- package/src/Icon/assets/ItClock.tsx +9 -0
- package/src/Icon/assets/ItClose.tsx +9 -0
- package/src/Icon/assets/ItCloseBig.tsx +9 -0
- package/src/Icon/assets/ItCloseCircle.tsx +9 -0
- package/src/Icon/assets/ItCodeCircle.tsx +9 -0
- package/src/Icon/assets/ItCollapse.tsx +8 -0
- package/src/Icon/assets/ItComment.tsx +9 -0
- package/src/Icon/assets/ItCopy.tsx +9 -0
- package/src/Icon/assets/ItDelete.tsx +12 -0
- package/src/Icon/assets/ItDesignersItalia.tsx +9 -0
- package/src/Icon/assets/ItDownload.tsx +9 -0
- package/src/Icon/assets/ItError.tsx +9 -0
- package/src/Icon/assets/ItExchangeCircle.tsx +9 -0
- package/src/Icon/assets/ItExpand.tsx +8 -0
- package/src/Icon/assets/ItExternalLink.tsx +9 -0
- package/src/Icon/assets/ItFacebook.tsx +9 -0
- package/src/Icon/assets/ItFacebookSquare.tsx +9 -0
- package/src/Icon/assets/ItFile.tsx +9 -0
- package/src/Icon/assets/ItFiles.tsx +9 -0
- package/src/Icon/assets/ItFlag.tsx +9 -0
- package/src/Icon/assets/ItFlickr.tsx +10 -0
- package/src/Icon/assets/ItFlickrSquare.tsx +9 -0
- package/src/Icon/assets/ItFolder.tsx +9 -0
- package/src/Icon/assets/ItFullscreen.tsx +11 -0
- package/src/Icon/assets/ItFunnel.tsx +9 -0
- package/src/Icon/assets/ItGithub.tsx +9 -0
- package/src/Icon/assets/ItHearing.tsx +9 -0
- package/src/Icon/assets/ItHelp.tsx +9 -0
- package/src/Icon/assets/ItHelpCircle.tsx +9 -0
- package/src/Icon/assets/ItHorn.tsx +9 -0
- package/src/Icon/assets/ItInbox.tsx +12 -0
- package/src/Icon/assets/ItInfoCircle.tsx +9 -0
- package/src/Icon/assets/ItInstagram.tsx +9 -0
- package/src/Icon/assets/ItKey.tsx +9 -0
- package/src/Icon/assets/ItLessCircle.tsx +12 -0
- package/src/Icon/assets/ItLink.tsx +9 -0
- package/src/Icon/assets/ItLinkedin.tsx +9 -0
- package/src/Icon/assets/ItLinkedinSquare.tsx +9 -0
- package/src/Icon/assets/ItList.tsx +9 -0
- package/src/Icon/assets/ItLock.tsx +12 -0
- package/src/Icon/assets/ItLocked.tsx +9 -0
- package/src/Icon/assets/ItMail.tsx +9 -0
- package/src/Icon/assets/ItMapMarker.tsx +9 -0
- package/src/Icon/assets/ItMapMarkerCircle.tsx +12 -0
- package/src/Icon/assets/ItMapMarkerMinus.tsx +9 -0
- package/src/Icon/assets/ItMapMarkerPlus.tsx +12 -0
- package/src/Icon/assets/ItMaximize.tsx +11 -0
- package/src/Icon/assets/ItMaximizeAlt.tsx +11 -0
- package/src/Icon/assets/ItMedium.tsx +9 -0
- package/src/Icon/assets/ItMediumSquare.tsx +9 -0
- package/src/Icon/assets/ItMinimize.tsx +11 -0
- package/src/Icon/assets/ItMinus.tsx +9 -0
- package/src/Icon/assets/ItMinusCircle.tsx +9 -0
- package/src/Icon/assets/ItMoreActions.tsx +9 -0
- package/src/Icon/assets/ItMoreItems.tsx +9 -0
- package/src/Icon/assets/ItNote.tsx +9 -0
- package/src/Icon/assets/ItOpenSource.tsx +9 -0
- package/src/Icon/assets/ItPa.tsx +9 -0
- package/src/Icon/assets/ItPasswordInvisible.tsx +9 -0
- package/src/Icon/assets/ItPasswordVisible.tsx +9 -0
- package/src/Icon/assets/ItPencil.tsx +9 -0
- package/src/Icon/assets/ItPiattaforme.tsx +10 -0
- package/src/Icon/assets/ItPin.tsx +9 -0
- package/src/Icon/assets/ItPlug.tsx +9 -0
- package/src/Icon/assets/ItPlus.tsx +9 -0
- package/src/Icon/assets/ItPlusCircle.tsx +9 -0
- package/src/Icon/assets/ItPresentation.tsx +9 -0
- package/src/Icon/assets/ItPrint.tsx +9 -0
- package/src/Icon/assets/ItRefresh.tsx +9 -0
- package/src/Icon/assets/ItRestore.tsx +9 -0
- package/src/Icon/assets/ItRss.tsx +11 -0
- package/src/Icon/assets/ItRssSquare.tsx +9 -0
- package/src/Icon/assets/ItSearch.tsx +9 -0
- package/src/Icon/assets/ItSettings.tsx +9 -0
- package/src/Icon/assets/ItShare.tsx +9 -0
- package/src/Icon/assets/ItSoftware.tsx +10 -0
- package/src/Icon/assets/ItStarFull.tsx +9 -0
- package/src/Icon/assets/ItStarOutline.tsx +9 -0
- package/src/Icon/assets/ItTeamDigitale.tsx +8 -0
- package/src/Icon/assets/ItTelegram.tsx +11 -0
- package/src/Icon/assets/ItTelephone.tsx +9 -0
- package/src/Icon/assets/ItTool.tsx +9 -0
- package/src/Icon/assets/ItTwitter.tsx +9 -0
- package/src/Icon/assets/ItTwitterSquare.tsx +9 -0
- package/src/Icon/assets/ItUnlocked.tsx +9 -0
- package/src/Icon/assets/ItUpload.tsx +9 -0
- package/src/Icon/assets/ItUser.tsx +9 -0
- package/src/Icon/assets/ItVideo.tsx +9 -0
- package/src/Icon/assets/ItWarning.tsx +9 -0
- package/src/Icon/assets/ItWarningCircle.tsx +9 -0
- package/src/Icon/assets/ItWhatsapp.tsx +9 -0
- package/src/Icon/assets/ItWhatsappSquare.tsx +10 -0
- package/src/Icon/assets/ItWifi.tsx +12 -0
- package/src/Icon/assets/ItYoutube.tsx +9 -0
- package/src/Icon/assets/ItZoomIn.tsx +9 -0
- package/src/Icon/assets/ItZoomOut.tsx +9 -0
- package/src/Icon/assets/index.tsx +504 -0
- package/src/Input/Input.tsx +342 -0
- package/src/Input/InputContainer.tsx +34 -0
- package/src/Input/TextArea.tsx +184 -0
- package/src/Input/TimeInput.tsx +303 -0
- package/src/Input/utils.tsx +166 -0
- package/src/LinkList/LinkList.tsx +65 -0
- package/src/LinkList/LinkListItem.tsx +98 -0
- package/src/Megamenu/Megamenu.tsx +37 -0
- package/src/Megamenu/MegamenuFooter.tsx +20 -0
- package/src/Megamenu/MegamenuHighlightColumn.tsx +33 -0
- package/src/Megamenu/MegamenuItem.tsx +27 -0
- package/src/Modal/Modal.tsx +79 -0
- package/src/Modal/ModalBody.tsx +11 -0
- package/src/Modal/ModalFooter.tsx +11 -0
- package/src/Modal/ModalHeader.tsx +70 -0
- package/src/Nav/Nav.tsx +56 -0
- package/src/Notification/Notification.tsx +60 -0
- package/src/Notification/NotificationContent.tsx +135 -0
- package/src/Notification/NotificationManager.tsx +65 -0
- package/src/Notification/core.tsx +46 -0
- package/src/Notification/index.ts +9 -0
- package/src/Notification/types.ts +12 -0
- package/src/Notification/usePosition.tsx +11 -0
- package/src/Pager/Pager.tsx +48 -0
- package/src/PasswordInput/PasswordInput.tsx +43 -0
- package/src/Progress/Progress.tsx +94 -0
- package/src/Rating/Rating.tsx +130 -0
- package/src/ResponsiveImage/ResponsiveImage.tsx +25 -0
- package/src/Section/Section.tsx +86 -0
- package/src/Select/Select.tsx +97 -0
- package/src/Select/shared.tsx +45 -0
- package/src/Sidebar/Sidebar.tsx +46 -0
- package/src/Skiplink/Skiplink.tsx +20 -0
- package/src/Skiplink/SkiplinkItem.tsx +29 -0
- package/src/Spinner/Spinner.tsx +55 -0
- package/src/Stepper/StepperContainer.tsx +30 -0
- package/src/Stepper/StepperContent.tsx +51 -0
- package/src/Stepper/StepperDots.tsx +21 -0
- package/src/Stepper/StepperHeader.tsx +19 -0
- package/src/Stepper/StepperHeaderElement.tsx +77 -0
- package/src/Stepper/StepperNav.tsx +19 -0
- package/src/ThumbNav/ThumbNav.tsx +37 -0
- package/src/ThumbNav/ThumbNavItem.tsx +35 -0
- package/src/Timeline/TimelinePin.tsx +67 -0
- package/src/Timeline/TimelineWrapper.tsx +19 -0
- package/src/Toggle/Toggle.tsx +29 -0
- package/src/Toolbar/Toolbar.tsx +28 -0
- package/src/Toolbar/ToolbarDividerItem.tsx +5 -0
- package/src/Toolbar/ToolbarItem.tsx +95 -0
- package/src/assets.d.ts +4 -0
- package/src/index.tsx +350 -0
- package/src/utils.tsx +26 -0
- package/.editorconfig +0 -18
- package/.eslintrc +0 -65
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -32
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -24
- package/AUTHORS +0 -3
- package/CODE_OF_CONDUCT.EN.md +0 -77
- package/CODE_OF_CONDUCT.md +0 -69
- package/dist/design-react-kit.cjs.js +0 -3698
- package/dist/design-react-kit.cjs.js.map +0 -1
- package/dist/design-react-kit.d.ts +0 -1704
- package/dist/design-react-kit.es.js +0 -3188
- package/dist/design-react-kit.es.js.map +0 -1
- package/dist/design-react-kit.full.js +0 -17596
- package/dist/design-react-kit.full.js.map +0 -1
- package/dist/design-react-kit.full.min.js +0 -2
- package/dist/design-react-kit.full.min.js.map +0 -1
- package/dist/design-react-kit.js +0 -13394
- package/dist/design-react-kit.js.map +0 -1
- package/dist/design-react-kit.min.js +0 -2
- package/dist/design-react-kit.min.js.map +0 -1
- package/src/Storyshots.test.js +0 -9
- package/src/components/Accordion/Accordion.js +0 -22
- package/src/components/Accordion/AccordionBody.js +0 -118
- package/src/components/Accordion/AccordionHeader.js +0 -37
- package/src/components/Autocomplete/Autocomplete.js +0 -255
- package/src/components/Avatar/AvatarContainer.js +0 -24
- package/src/components/Avatar/AvatarExtraText.js +0 -22
- package/src/components/Avatar/AvatarGroupContainer.js +0 -23
- package/src/components/Avatar/AvatarIcon.js +0 -32
- package/src/components/Avatar/AvatarPresence.js +0 -25
- package/src/components/Avatar/AvatarStatus.js +0 -25
- package/src/components/Avatar/AvatarWrapper.js +0 -25
- package/src/components/Badge/Badge.js +0 -28
- package/src/components/BottomNav/BottomNav.js +0 -27
- package/src/components/BottomNav/BottomNavItem.js +0 -69
- package/src/components/Button/Button.js +0 -26
- package/src/components/Callout/Callout.js +0 -33
- package/src/components/Callout/CalloutText.js +0 -37
- package/src/components/Callout/CalloutTitle.js +0 -27
- package/src/components/Card/Card.js +0 -50
- package/src/components/Card/CardCategory.js +0 -43
- package/src/components/Card/CardFooterCTA.js +0 -17
- package/src/components/Card/CardReadMore.js +0 -45
- package/src/components/Card/CardSignature.js +0 -17
- package/src/components/Card/CardTag.js +0 -23
- package/src/components/Card/CardTagsHeader.js +0 -21
- package/src/components/Chips/Chip.js +0 -50
- package/src/components/Chips/ChipLabel.js +0 -25
- package/src/components/Collapse/Collapse.js +0 -66
- package/src/components/CookieBar/CookieBar.js +0 -22
- package/src/components/CookieBar/CookieBarButton.js +0 -25
- package/src/components/CookieBar/CookieBarButtons.js +0 -23
- package/src/components/Dimmer/Dimmer.js +0 -38
- package/src/components/Dimmer/DimmerButtons.js +0 -35
- package/src/components/FontLoader/FontLoader.js +0 -22
- package/src/components/FormGroup/FormGroup.js +0 -137
- package/src/components/Forward/Forward.js +0 -32
- package/src/components/Header/HeaderBrand.js +0 -86
- package/src/components/Header/HeaderContent.js +0 -49
- package/src/components/Header/HeaderContext.js +0 -14
- package/src/components/Header/HeaderLinkZone.js +0 -24
- package/src/components/Header/HeaderRightZone.js +0 -33
- package/src/components/Header/HeaderSearch.js +0 -36
- package/src/components/Header/HeaderSocialsZone.js +0 -30
- package/src/components/Header/HeaderToggler.js +0 -50
- package/src/components/Hero/Hero.js +0 -10
- package/src/components/Icon/Icon.js +0 -42
- package/src/components/Input/Input.js +0 -261
- package/src/components/Input/InputContainer.js +0 -39
- package/src/components/Input/utils.js +0 -126
- package/src/components/LinkList/LinkList.js +0 -65
- package/src/components/LinkList/LinkListItem.js +0 -88
- package/src/components/Nav/Nav.js +0 -37
- package/src/components/Notification/Notification.js +0 -78
- package/src/components/Offcanvas/Offcanvas.js +0 -101
- package/src/components/Pager/Pager.js +0 -32
- package/src/components/PagerList/PagerList.js +0 -28
- package/src/components/PasswordInput/PasswordInput.js +0 -41
- package/src/components/PasswordMeter/PasswordMeter.js +0 -80
- package/src/components/Progress/Progress.js +0 -88
- package/src/components/Rating/Rating.js +0 -130
- package/src/components/Section/Section.js +0 -49
- package/src/components/Separator/Separator.js +0 -34
- package/src/components/Sidebar/Sidebar.js +0 -53
- package/src/components/Skiplink/Skiplink.js +0 -25
- package/src/components/Skiplink/SkiplinkItem.js +0 -25
- package/src/components/Spinner/Spinner.js +0 -65
- package/src/components/Stepper/StepperContainer.js +0 -33
- package/src/components/Stepper/StepperContent.js +0 -54
- package/src/components/Stepper/StepperDots.js +0 -27
- package/src/components/Stepper/StepperHeader.js +0 -27
- package/src/components/Stepper/StepperHeaderElement.js +0 -45
- package/src/components/Stepper/StepperNav.js +0 -27
- package/src/components/Table/Table.js +0 -68
- package/src/components/Timeline/TimelinePin.js +0 -59
- package/src/components/Timeline/TimelineWrapper.js +0 -21
- package/src/components/Toggle/Toggle.js +0 -27
- package/src/components/utils.js +0 -1
- package/src/index.js +0 -144
- package/static/favicons/android-chrome-192x192.png +0 -0
- package/static/favicons/android-chrome-512x512.png +0 -0
- package/static/favicons/apple-touch-icon.png +0 -0
- package/static/favicons/browserconfig.xml +0 -9
- package/static/favicons/favicon-16x16.png +0 -0
- package/static/favicons/favicon-32x32.png +0 -0
- package/static/favicons/favicon.ico +0 -0
- package/static/favicons/manifest.webmanifest +0 -21
- package/static/favicons/mstile-150x150.png +0 -0
- package/static/favicons/safari-pinned-tab.svg +0 -23
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
const propTypes = {
|
|
6
|
-
color: PropTypes.string,
|
|
7
|
-
dark: PropTypes.string,
|
|
8
|
-
single: PropTypes.string,
|
|
9
|
-
className: PropTypes.string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const defaultProps = {
|
|
13
|
-
single: false,
|
|
14
|
-
dark: false
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const DimmerButtons = props => {
|
|
18
|
-
const { color, dark, className, single, ...attributes } = props
|
|
19
|
-
const { children, ...rest } = attributes
|
|
20
|
-
const classes = classNames('dimmer-buttons', className, {
|
|
21
|
-
'single-button': single,
|
|
22
|
-
'bg-dark': dark
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div className={classes} {...rest}>
|
|
27
|
-
{children}
|
|
28
|
-
</div>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
DimmerButtons.propTypes = propTypes
|
|
33
|
-
DimmerButtons.defaultProps = defaultProps
|
|
34
|
-
|
|
35
|
-
export default DimmerButtons
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Component } from 'react'
|
|
2
|
-
|
|
3
|
-
export default class ToolkitFontLoader extends Component {
|
|
4
|
-
componentDidMount() {
|
|
5
|
-
if (typeof window !== 'undefined') {
|
|
6
|
-
const WebFont = require('webfontloader')
|
|
7
|
-
WebFont.load({
|
|
8
|
-
custom: {
|
|
9
|
-
families: [
|
|
10
|
-
'Titillium Web:300,400,600,700:latin-ext',
|
|
11
|
-
'Lora:400,700:latin-ext',
|
|
12
|
-
'Roboto Mono:400,700:latin-ext'
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
render() {
|
|
20
|
-
return null
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react'
|
|
2
|
-
|
|
3
|
-
import { FormGroup as ReactStrapFormGroup, Input, Label } from 'reactstrap'
|
|
4
|
-
|
|
5
|
-
class FormGroup extends Component {
|
|
6
|
-
state = {
|
|
7
|
-
active: this.props.active || false,
|
|
8
|
-
value: null
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
onFocus = (callback, active = true) => {
|
|
12
|
-
this.setState(
|
|
13
|
-
{
|
|
14
|
-
active
|
|
15
|
-
},
|
|
16
|
-
() => {
|
|
17
|
-
if (callback) {
|
|
18
|
-
callback()
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
onBlur = (callback, active = false) => {
|
|
25
|
-
this.setState(
|
|
26
|
-
{
|
|
27
|
-
active
|
|
28
|
-
},
|
|
29
|
-
() => {
|
|
30
|
-
if (callback) {
|
|
31
|
-
callback()
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
onChange = (callback, event) => {
|
|
38
|
-
let value
|
|
39
|
-
let target
|
|
40
|
-
if (event && event.persist) {
|
|
41
|
-
// SyntheticEvent
|
|
42
|
-
event.persist()
|
|
43
|
-
target = { event }
|
|
44
|
-
value = { target }
|
|
45
|
-
} else if (event.label) {
|
|
46
|
-
// Autocomplete
|
|
47
|
-
value = event.label
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
this.setState(
|
|
51
|
-
{
|
|
52
|
-
value
|
|
53
|
-
},
|
|
54
|
-
() => {
|
|
55
|
-
if (callback) {
|
|
56
|
-
callback(event)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
render() {
|
|
63
|
-
const { active, value } = this.state
|
|
64
|
-
const { children, className, col, ...rest } = this.props
|
|
65
|
-
|
|
66
|
-
const hasValue = !!value
|
|
67
|
-
|
|
68
|
-
let classNames = [className, active ? 'active' : '', col ? 'col' : ''].join(
|
|
69
|
-
' '
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
return (
|
|
73
|
-
<ReactStrapFormGroup {...rest} className={classNames}>
|
|
74
|
-
{(() =>
|
|
75
|
-
React.Children.map(children, child => {
|
|
76
|
-
if (child === null) return
|
|
77
|
-
|
|
78
|
-
const { onFocus, onBlur, onChange, className } = child.props
|
|
79
|
-
|
|
80
|
-
switch (child.type) {
|
|
81
|
-
case Input:
|
|
82
|
-
const isLabelActive = null
|
|
83
|
-
|
|
84
|
-
return React.cloneElement(child, {
|
|
85
|
-
...child.props,
|
|
86
|
-
onFocus: () => {
|
|
87
|
-
this.onFocus(onFocus)
|
|
88
|
-
},
|
|
89
|
-
onBlur: () => {
|
|
90
|
-
this.onBlur(onBlur)
|
|
91
|
-
},
|
|
92
|
-
onChange: e => {
|
|
93
|
-
this.onChange(onChange, e)
|
|
94
|
-
},
|
|
95
|
-
...isLabelActive
|
|
96
|
-
})
|
|
97
|
-
case Label:
|
|
98
|
-
let hasChildValue = false
|
|
99
|
-
|
|
100
|
-
React.Children.toArray(children)
|
|
101
|
-
.filter(child => {
|
|
102
|
-
switch (child.type) {
|
|
103
|
-
case Input:
|
|
104
|
-
return true
|
|
105
|
-
default:
|
|
106
|
-
return false
|
|
107
|
-
}
|
|
108
|
-
})
|
|
109
|
-
.map(child => {
|
|
110
|
-
if (child.props.value) {
|
|
111
|
-
hasChildValue = true
|
|
112
|
-
}
|
|
113
|
-
return false
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
classNames =
|
|
117
|
-
hasValue || hasChildValue
|
|
118
|
-
? [className, 'active'].join(' ')
|
|
119
|
-
: className
|
|
120
|
-
|
|
121
|
-
return React.cloneElement(child, {
|
|
122
|
-
...child.props,
|
|
123
|
-
className: classNames
|
|
124
|
-
})
|
|
125
|
-
default:
|
|
126
|
-
return child
|
|
127
|
-
}
|
|
128
|
-
}))()}
|
|
129
|
-
</ReactStrapFormGroup>
|
|
130
|
-
)
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
FormGroup.defaultProps = ReactStrapFormGroup.defaultProps
|
|
135
|
-
FormGroup.propTypes = ReactStrapFormGroup.propTypes
|
|
136
|
-
|
|
137
|
-
export default FormGroup
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
// SSR does have no access to the Element global variable, so mock it
|
|
6
|
-
if (typeof window === 'undefined') {
|
|
7
|
-
global.Element = typeof Element === 'undefined' ? function() {} : Element
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const propTypes = {
|
|
11
|
-
className: PropTypes.string,
|
|
12
|
-
scrollToRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) })
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const Forward = ({ className, scrollToRef, ...attributes }) => {
|
|
16
|
-
const classes = classNames(className, 'forward')
|
|
17
|
-
return (
|
|
18
|
-
<a
|
|
19
|
-
className={classes}
|
|
20
|
-
onClick={() =>
|
|
21
|
-
scrollToRef.current.scrollIntoView({
|
|
22
|
-
behavior: 'smooth',
|
|
23
|
-
block: 'start'
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
{...attributes}
|
|
27
|
-
/>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
Forward.propTypes = propTypes
|
|
32
|
-
export default Forward
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import React, { PureComponent } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
import { NavbarBrand } from 'reactstrap'
|
|
5
|
-
import HeaderContext, { CENTER } from './HeaderContext'
|
|
6
|
-
import Icon from '../Icon/Icon'
|
|
7
|
-
|
|
8
|
-
const propTypes = {
|
|
9
|
-
/** Utilizzarlo in caso di utilizzo di componenti personalizzati */
|
|
10
|
-
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
11
|
-
/** Classi aggiuntive da usare per il componente HeaderBrand */
|
|
12
|
-
className: PropTypes.string,
|
|
13
|
-
/** Da usare per la sovrascrittura di classi predefinite */
|
|
14
|
-
cssModule: PropTypes.object,
|
|
15
|
-
/** Da usare con il componente Header Nav in versione "responsive" */
|
|
16
|
-
responsive: PropTypes.bool,
|
|
17
|
-
/** Da utilizzare per specificare URL risorsa esterna. */
|
|
18
|
-
href: PropTypes.string,
|
|
19
|
-
/** Icona da utilizzare nel componente. Utilizzata unicamente quando l'Header è di tipo Center. */
|
|
20
|
-
iconName: PropTypes.string,
|
|
21
|
-
/** Elementi React da renderizzare al proprio interno. */
|
|
22
|
-
children: PropTypes.oneOfType([
|
|
23
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
24
|
-
PropTypes.node
|
|
25
|
-
])
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const defaultProps = {
|
|
29
|
-
tag: 'a',
|
|
30
|
-
responsive: false
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default class HeaderBrand extends PureComponent {
|
|
34
|
-
static propTypes = propTypes
|
|
35
|
-
static defaultProps = defaultProps
|
|
36
|
-
static contextType = HeaderContext
|
|
37
|
-
|
|
38
|
-
addChildClasses(child, i) {
|
|
39
|
-
// convention here: first item is the main title, while others subtext
|
|
40
|
-
const className = classNames(
|
|
41
|
-
child.props.className,
|
|
42
|
-
'no_toc',
|
|
43
|
-
{ 'd-none d-md-block': i } // subtext is anything but first element
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
const props = {
|
|
47
|
-
className
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return React.cloneElement(child, props)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
render() {
|
|
54
|
-
const {
|
|
55
|
-
className,
|
|
56
|
-
href,
|
|
57
|
-
iconName,
|
|
58
|
-
children,
|
|
59
|
-
responsive,
|
|
60
|
-
...attributes
|
|
61
|
-
} = this.props
|
|
62
|
-
const { type } = this.context
|
|
63
|
-
if (type !== CENTER) {
|
|
64
|
-
const classes = classNames('d-lg-block', className, {
|
|
65
|
-
'd-none': !responsive
|
|
66
|
-
})
|
|
67
|
-
return (
|
|
68
|
-
<NavbarBrand className={classes} href={href} {...attributes}>
|
|
69
|
-
{children}
|
|
70
|
-
</NavbarBrand>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
return (
|
|
74
|
-
<div className="it-brand-wrapper">
|
|
75
|
-
<a href={href}>
|
|
76
|
-
{iconName && <Icon icon={iconName} />}
|
|
77
|
-
<div className="it-brand-text">
|
|
78
|
-
{React.Children.map(children, (child, i) =>
|
|
79
|
-
this.addChildClasses(child, i)
|
|
80
|
-
)}
|
|
81
|
-
</div>
|
|
82
|
-
</a>
|
|
83
|
-
</div>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React, { PureComponent } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
import { Navbar } from 'reactstrap'
|
|
5
|
-
|
|
6
|
-
import HeaderContext, { SLIM, CENTER, NAVBAR } from './HeaderContext'
|
|
7
|
-
|
|
8
|
-
const propTypes = {
|
|
9
|
-
/** Classi addizionali per il componente HeaderContent */
|
|
10
|
-
className: PropTypes.string,
|
|
11
|
-
/** Da utilizzare per indicare che all'interno dell'Header verrà utilizzato un Megamenu */
|
|
12
|
-
megamenu: PropTypes.bool,
|
|
13
|
-
/** Parametro per il controllo responsive del componente: valori Bootstrap standard sono "sm", "md", "lg", "xl" */
|
|
14
|
-
expand: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const defaultProps = {}
|
|
18
|
-
|
|
19
|
-
class HeaderContent extends PureComponent {
|
|
20
|
-
static propTypes = propTypes
|
|
21
|
-
static defaultProps = defaultProps
|
|
22
|
-
static contextType = HeaderContext
|
|
23
|
-
render() {
|
|
24
|
-
const { className, megamenu, ...attributes } = this.props
|
|
25
|
-
const { type } = this.context
|
|
26
|
-
const classes = classNames(className, {
|
|
27
|
-
'it-header-slim-wrapper-content': type === SLIM,
|
|
28
|
-
'it-header-center-content-wrapper': type === CENTER,
|
|
29
|
-
navbar: type === NAVBAR,
|
|
30
|
-
'has-megamenu': megamenu
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const Content =
|
|
34
|
-
type === NAVBAR ? (
|
|
35
|
-
<Navbar className={classes} {...attributes} />
|
|
36
|
-
) : (
|
|
37
|
-
<div className={classes} {...attributes} />
|
|
38
|
-
)
|
|
39
|
-
return (
|
|
40
|
-
<div className="container">
|
|
41
|
-
<div className="row">
|
|
42
|
-
<div className="col-12">{Content}</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default HeaderContent
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* HeaderContext
|
|
5
|
-
* {
|
|
6
|
-
* type: PropTypes.oneOf([SLIM, CENTER, NAVBAR]).isRequired
|
|
7
|
-
* }
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export default React.createContext({})
|
|
11
|
-
|
|
12
|
-
export const SLIM = 'slim'
|
|
13
|
-
export const CENTER = 'center'
|
|
14
|
-
export const NAVBAR = 'navbar'
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
const propTypes = {
|
|
6
|
-
/** Classi addizionali per il componente HeaderLinkZone, applicata all'element "nav" annidato */
|
|
7
|
-
className: PropTypes.string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const defaultProps = {}
|
|
11
|
-
|
|
12
|
-
const HeaderLinkZone = ({ className, ...attributes }) => {
|
|
13
|
-
const classes = classNames(className)
|
|
14
|
-
return (
|
|
15
|
-
<div className="nav-mobile">
|
|
16
|
-
<nav className={classes} {...attributes} />
|
|
17
|
-
</div>
|
|
18
|
-
)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
HeaderLinkZone.propTypes = propTypes
|
|
22
|
-
HeaderLinkZone.defaultProps = defaultProps
|
|
23
|
-
|
|
24
|
-
export default HeaderLinkZone
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { PureComponent } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
import HeaderContext, { SLIM } from './HeaderContext'
|
|
6
|
-
|
|
7
|
-
const propTypes = {
|
|
8
|
-
/** Classi addizionali per il componente HeaderRightZone */
|
|
9
|
-
className: PropTypes.string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const defaultProps = {}
|
|
13
|
-
|
|
14
|
-
class HeaderRightZone extends PureComponent {
|
|
15
|
-
static propTypes = propTypes
|
|
16
|
-
static defaultProps = defaultProps
|
|
17
|
-
static contextType = HeaderContext
|
|
18
|
-
|
|
19
|
-
render() {
|
|
20
|
-
const { className, ...attributes } = this.props
|
|
21
|
-
const { type } = this.context
|
|
22
|
-
const classes = classNames(className, {
|
|
23
|
-
// BI >= 1.3.6
|
|
24
|
-
'it-header-slim-right-zone': type === SLIM,
|
|
25
|
-
// BI < 1.3.6
|
|
26
|
-
'header-slim-right-zone': type === SLIM,
|
|
27
|
-
'it-right-zone': type !== SLIM
|
|
28
|
-
})
|
|
29
|
-
return <div className={classes} {...attributes} />
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default HeaderRightZone
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
import Icon from '../Icon/Icon'
|
|
6
|
-
|
|
7
|
-
const propTypes = {
|
|
8
|
-
/** Classi addizionali per il componente HeaderSearch */
|
|
9
|
-
className: PropTypes.string,
|
|
10
|
-
/** Etichetta di testo da applicare all'elemento. In caso di stringa vuota non verrà mostrato alcun testo */
|
|
11
|
-
label: PropTypes.string,
|
|
12
|
-
/** Nome dell'icona da utilizzare */
|
|
13
|
-
iconName: PropTypes.string,
|
|
14
|
-
/** Indirizzo di indirizzamento al click dell'icona */
|
|
15
|
-
href: PropTypes.string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const defaultProps = {
|
|
19
|
-
iconName: 'it-search'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const HeaderSearch = ({ className, label, href, iconName, ...attributes }) => {
|
|
23
|
-
const classes = classNames('it-search-wrapper', className)
|
|
24
|
-
return (
|
|
25
|
-
<div className={classes} {...attributes}>
|
|
26
|
-
{label && <span className="d-none d-md-block">{label}</span>}
|
|
27
|
-
<a className="search-link rounded-icon" aria-label={label} href={href}>
|
|
28
|
-
<Icon icon={iconName} />
|
|
29
|
-
</a>
|
|
30
|
-
</div>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
HeaderSearch.propTypes = propTypes
|
|
35
|
-
HeaderSearch.defaultProps = defaultProps
|
|
36
|
-
export default HeaderSearch
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
|
|
5
|
-
const propTypes = {
|
|
6
|
-
/** Classi addizionali per il componente HeaderSocialsZone, verrà applicato all'elemento wrapper più esterno. */
|
|
7
|
-
className: PropTypes.string,
|
|
8
|
-
/** Etichetta utilizzata per presentare i social presenti. In caso di stringa vuota non verrà mostrata alcuna etichetta */
|
|
9
|
-
label: PropTypes.string,
|
|
10
|
-
/** Utilizzato per elencare i social da mostrare */
|
|
11
|
-
children: PropTypes.oneOfType([
|
|
12
|
-
PropTypes.arrayOf(PropTypes.node),
|
|
13
|
-
PropTypes.node
|
|
14
|
-
])
|
|
15
|
-
}
|
|
16
|
-
const defaultProps = {}
|
|
17
|
-
|
|
18
|
-
const HeaderSocialsZone = ({ className, children, label, ...attributes }) => {
|
|
19
|
-
const classes = classNames('it-socials d-none d-md-flex', className)
|
|
20
|
-
return (
|
|
21
|
-
<div className={classes} {...attributes}>
|
|
22
|
-
{label && <span>{label}</span>}
|
|
23
|
-
{children}
|
|
24
|
-
</div>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
HeaderSocialsZone.propTypes = propTypes
|
|
29
|
-
HeaderSocialsZone.defaultProps = defaultProps
|
|
30
|
-
export default HeaderSocialsZone
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React, { PureComponent } from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
import { NavbarToggler } from 'reactstrap'
|
|
5
|
-
|
|
6
|
-
import HeaderContext, { SLIM, NAVBAR } from './HeaderContext'
|
|
7
|
-
|
|
8
|
-
const propTypes = {
|
|
9
|
-
/** Tipo di elemento DOM da utilizzare: di default "a" per Header Slim, "button" per altri tipi di Header.
|
|
10
|
-
* Se fornito questo sovrascriverà il valore di default.
|
|
11
|
-
*/
|
|
12
|
-
tag: PropTypes.string,
|
|
13
|
-
/** Indica l'attributo "type" sull'elemento DOM. Di default '' per Header Slim, "button" per altri tipi di Header.
|
|
14
|
-
* Se fornito questo sovrascriverà il valore di default.
|
|
15
|
-
*/
|
|
16
|
-
type: PropTypes.string,
|
|
17
|
-
/** Classi addizionali per il componente HeaderToggler */
|
|
18
|
-
className: PropTypes.string
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const defaultProps = {}
|
|
22
|
-
|
|
23
|
-
export default class HeaderToggler extends PureComponent {
|
|
24
|
-
static propTypes = propTypes
|
|
25
|
-
static defaultProps = defaultProps
|
|
26
|
-
static contextType = HeaderContext
|
|
27
|
-
render() {
|
|
28
|
-
const { className, tag, type, ...attributes } = this.props
|
|
29
|
-
const { type: HeaderType } = this.context
|
|
30
|
-
const BUTTON = 'button'
|
|
31
|
-
const defaultTag = HeaderType === SLIM ? 'a' : BUTTON
|
|
32
|
-
const defaultType = HeaderType === SLIM ? '' : BUTTON
|
|
33
|
-
const classes = classNames(
|
|
34
|
-
{
|
|
35
|
-
'it-opener d-lg-none': HeaderType === SLIM,
|
|
36
|
-
'custom-navbar-toggler': HeaderType === NAVBAR
|
|
37
|
-
},
|
|
38
|
-
className
|
|
39
|
-
)
|
|
40
|
-
return (
|
|
41
|
-
<NavbarToggler
|
|
42
|
-
className={classes}
|
|
43
|
-
{...attributes}
|
|
44
|
-
tag={tag || defaultTag}
|
|
45
|
-
type={type || defaultType}
|
|
46
|
-
href="#"
|
|
47
|
-
/>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Jumbotron } from 'reactstrap'
|
|
3
|
-
|
|
4
|
-
// We use this to override its display name (i.e. as shown into Storybook's info addon)
|
|
5
|
-
export default function Hero(props) {
|
|
6
|
-
return <Jumbotron {...props} />
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
Hero.defaultProps = Jumbotron.defaultProps
|
|
10
|
-
Hero.propTypes = Jumbotron.propTypes
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import classNames from 'classnames'
|
|
4
|
-
import iconSprite from 'bootstrap-italia/dist/svg/sprite.svg'
|
|
5
|
-
|
|
6
|
-
const propTypes = {
|
|
7
|
-
className: PropTypes.string,
|
|
8
|
-
color: PropTypes.string,
|
|
9
|
-
size: PropTypes.string,
|
|
10
|
-
icon: PropTypes.string,
|
|
11
|
-
padding: PropTypes.bool
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const defaultProps = {
|
|
15
|
-
color: '',
|
|
16
|
-
size: '',
|
|
17
|
-
icon: '',
|
|
18
|
-
padding: false
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Icon = ({ color, size, icon, className, padding, ...attributes }) => {
|
|
22
|
-
const classes = classNames(
|
|
23
|
-
'icon',
|
|
24
|
-
className,
|
|
25
|
-
{
|
|
26
|
-
[`icon-${color}`]: color,
|
|
27
|
-
[`icon-${size}`]: size,
|
|
28
|
-
'icon-padded': padding
|
|
29
|
-
},
|
|
30
|
-
size
|
|
31
|
-
)
|
|
32
|
-
return (
|
|
33
|
-
<svg className={classes} {...attributes}>
|
|
34
|
-
<use href={`${iconSprite}#${icon}`} />
|
|
35
|
-
</svg>
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
Icon.propTypes = propTypes
|
|
40
|
-
Icon.defaultProps = defaultProps
|
|
41
|
-
|
|
42
|
-
export default Icon
|