@eeacms/volto-tableau 6.0.0 → 6.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.
@@ -1,67 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import { Popup } from 'semantic-ui-react';
4
- import { UniversalLink } from '@plone/volto/components';
5
-
6
- const Link = ({ children, ...props }) => {
7
- if (props.href) {
8
- return <UniversalLink {...props}>{children}</UniversalLink>;
9
- }
10
- return <span {...props}>{children}</span>;
11
- };
12
-
13
- const Source = ({ source }) => {
14
- return (
15
- <>
16
- <Link className="embed-sources-param-title" href={source.link}>
17
- {source.title}
18
- </Link>
19
- ,
20
- <span className="embed-sources-param-description">
21
- {source.organisation}
22
- </span>
23
- </>
24
- );
25
- };
26
-
27
- const SourcesWidget = ({ sources }) => {
28
- const [expanded, setExpanded] = React.useState(false);
29
-
30
- return (
31
- <div className="tableau-sources-container">
32
- <Popup
33
- content={
34
- sources?.length ? (
35
- <ol className="sources-list">
36
- {sources?.map((source, index) => {
37
- return (
38
- <li key={index}>
39
- <Source source={source} />
40
- </li>
41
- );
42
- })}
43
- </ol>
44
- ) : (
45
- <p>Data provenance is not set for this visualization.</p>
46
- )
47
- }
48
- position="bottom left"
49
- popper={{ id: 'tableau-sources-popup' }}
50
- trigger={
51
- <button className={cx('tableau-sources-button', { expanded })}>
52
- Sources
53
- </button>
54
- }
55
- on="click"
56
- onClose={() => {
57
- setExpanded(false);
58
- }}
59
- onOpen={() => {
60
- setExpanded(true);
61
- }}
62
- />
63
- </div>
64
- );
65
- };
66
-
67
- export default SourcesWidget;