design-react-kit 5.0.0-4 → 5.0.0-6

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/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "bugs": {
24
24
  "url": "https://github.com/italia/design-react-kit/issues"
25
25
  },
26
- "version": "5.0.0-4",
26
+ "version": "5.0.0-6",
27
27
  "license": "BSD-3",
28
28
  "module": "dist/esm/index.js",
29
29
  "main": "./src/index.tsx",
@@ -0,0 +1,39 @@
1
+ import React, { ReactChild } from 'react';
2
+ import { Icon } from '../Icon/Icon';
3
+ import classNames from 'classnames';
4
+ import { Button } from '../Button/Button';
5
+
6
+ export interface GoBackProps {
7
+ /**
8
+ * Optional classnames to pass to the element
9
+ */
10
+ className?: string;
11
+ /**
12
+ * Render the link variant of the go back button
13
+ */
14
+ link?: boolean;
15
+ /**
16
+ * Render the up variant of the go back button
17
+ */
18
+ up?: boolean;
19
+ children: ReactChild;
20
+ }
21
+
22
+ const goBack = () => {
23
+ window.history.back();
24
+ };
25
+
26
+ export const GoBack = ({ className, link = false, up = false, children }: GoBackProps) => {
27
+ const Tag = link ? 'a' : Button;
28
+
29
+ return (
30
+ <Tag className={classNames(className, 'go-back')} color='primary' onClick={goBack}>
31
+ <Icon
32
+ className={children ? 'me-2' : ''}
33
+ color={link ? 'primary' : 'white'}
34
+ icon={up ? 'it-arrow-up' : 'it-arrow-left'}
35
+ />
36
+ {children}
37
+ </Tag>
38
+ );
39
+ };
@@ -1,7 +1,7 @@
1
1
  import React, { FC, useState } from 'react';
2
2
  import { Navbar, NavbarBrand, NavbarProps, NavbarToggler } from 'reactstrap';
3
3
  import classNames from 'classnames';
4
- import { Collapse } from './Collapse';
4
+ import { Collapse } from '../Collapse/Collapse';
5
5
  import { Icon } from '../Icon/Icon';
6
6
  import { Nav } from '../Nav/Nav';
7
7
 
package/src/index.tsx CHANGED
@@ -87,6 +87,7 @@ export { CardTagsHeader } from './Card/CardTagsHeader';
87
87
  export { CardSignature } from './Card/CardSignature';
88
88
  export { CardFooterCTA } from './Card/CardFooterCTA';
89
89
  export { CardReadMore } from './Card/CardReadMore';
90
+ export { Collapse } from './Collapse/Collapse';
90
91
  export { GridItem, GridItemText, GridItemTextWrapper, GridList, GridRow } from './Grid/index';
91
92
  export { Header } from './Header/Header';
92
93
  export { Headers } from './Header/Headers';
@@ -102,6 +103,7 @@ export { Icon, iconsList as icons, preloadIcons, clearIconCache } from './Icon/I
102
103
  export { Input } from './Input/Input';
103
104
  export { InputContainer } from './Input/InputContainer';
104
105
  export { TextArea } from './Input/TextArea';
106
+ export { GoBack } from './GoBack/GoBack';
105
107
  export { LinkList } from './LinkList/LinkList';
106
108
  export { LinkListItem } from './LinkList/LinkListItem';
107
109
  export { Megamenu } from './Megamenu/Megamenu';
File without changes
File without changes