Skip to content

Commit

Permalink
feat: add enlarge option for tableau
Browse files Browse the repository at this point in the history
  • Loading branch information
kreafox committed Nov 15, 2023
1 parent 4ae1623 commit 4af7c29
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/Blocks/EmbedTableauVisualization/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const View = (props) => {
with_more_info = true,
with_download = true,
with_share = true,
with_enlarge = true,
tableau_height = 700,
} = data;
const { figure_note = [], data_provenance = {}, tableau_visualization } =
Expand Down Expand Up @@ -51,6 +52,7 @@ const View = (props) => {
with_more_info,
with_download,
with_share,
with_enlarge,
tableau_height,
tableau_vis_url,
}}
Expand Down
6 changes: 6 additions & 0 deletions src/Blocks/EmbedTableauVisualization/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default () => {
'with_more_info',
'with_download',
'with_share',
'with_enlarge',
],
},
{
Expand Down Expand Up @@ -87,6 +88,11 @@ export default () => {
type: 'boolean',
defaultValue: true,
},
with_enlarge: {
title: 'Show enlarge button',
type: 'boolean',
defaultValue: true,
},
with_download: {
title: 'Show download button',
type: 'boolean',
Expand Down
9 changes: 8 additions & 1 deletion src/Blocks/TableauBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const View = React.forwardRef((props, ref) => {
with_sources = true,
with_download = true,
with_share = true,
with_enlarge = true,
sources,
} = data;

Expand Down Expand Up @@ -75,7 +76,13 @@ const View = React.forwardRef((props, ref) => {
ref={viz}
mode={mode}
block={block}
data={{ ...data, with_sources, with_download, with_share }}
data={{
...data,
with_sources,
with_download,
with_share,
with_enlarge,
}}
sources={sources}
extraFilters={extraFilters}
extraOptions={extraOptions}
Expand Down
6 changes: 6 additions & 0 deletions src/Blocks/TableauBlock/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default (config, viz, vizState) => {
'with_sources',
'with_download',
'with_share',
'with_enlarge',
],
},
{
Expand Down Expand Up @@ -147,6 +148,11 @@ export default (config, viz, vizState) => {
type: 'boolean',
defaultValue: true,
},
with_enlarge: {
title: 'Show enlarge button',
type: 'boolean',
defaultValue: true,
},
with_sources: {
title: 'Show sources',
type: 'boolean',
Expand Down
18 changes: 18 additions & 0 deletions src/Tableau/Tableau.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
Sources,
MoreInfo,
Share,
Enlarge,
} from '@eeacms/volto-embed/Toolbar';
import { useTableau } from '@eeacms/volto-tableau/hooks';
import { JsonCodeSnippet, Download } from '@eeacms/volto-tableau/Utils';
Expand Down Expand Up @@ -107,6 +108,7 @@ const Tableau = forwardRef((props, ref) => {
with_more_info = true,
with_download = true,
with_share = true,
with_enlarge = true,
tableau_height = 700,
} = data;
const device = useMemo(
Expand Down Expand Up @@ -444,6 +446,22 @@ const Tableau = forwardRef((props, ref) => {
{with_more_info && <MoreInfo href={tableau_vis_url || data.url} />}
</div>
<div className="right-col">
{with_enlarge && loaded && (
<Enlarge>
<Tableau
{...props}
data={{
...props.data,
with_notes: false,
with_sources: false,
with_more_info: false,
with_enlarge: false,
with_share: false,
with_download: false,
}}
/>
</Enlarge>
)}
{with_download && loaded && <Download viz={viz.current} />}
{with_share && loaded && (
<Share href={tableau_vis_url || data.url} />
Expand Down
1 change: 1 addition & 0 deletions src/Views/VisualizationView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const VisualizationView = (props) => {
with_sources: false,
with_more_info: false,
with_share: false,
with_enlarge: false,
with_download: true,
}}
breakpoints={
Expand Down
3 changes: 2 additions & 1 deletion src/Widgets/VisualizationViewWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ export default function VisualizationViewWidget(props) {
...value,
with_notes: false,
with_sources: false,
with_more_info: true,
with_more_info: false,
with_share: true,
with_enlarge: true,
with_download: true,
}}
breakpoints={
Expand Down
2 changes: 2 additions & 0 deletions src/Widgets/VisualizationWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const VisualizationWidget = (props) => {
with_sources: false,
with_more_info: false,
with_share: false,
with_enlarge: false,
with_download: false,
}}
mode="edit"
Expand Down Expand Up @@ -127,6 +128,7 @@ const VisualizationWidget = (props) => {
with_sources: false,
with_more_info: false,
with_share: false,
with_enlarge: false,
with_download: false,
}}
breakpoints={
Expand Down

0 comments on commit 4af7c29

Please sign in to comment.