Skip to content

Commit

Permalink
VUU-33 use componentId for screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
vferraro-scottlogic committed Sep 6, 2023
1 parent 602b557 commit 82f0107
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ type RadioValue = typeof radioValues[number];
type SaveLayoutPanelProps = {
onCancel: () => void;
onSave: (layoutMetadata: Omit<LayoutMetadata, "id">) => void;
componentId?: string
};

export const SaveLayoutPanel = (props: SaveLayoutPanelProps) => {
const { onCancel, onSave } = props;
const { onCancel, onSave, componentId } = props;

const [layoutName, setLayoutName] = useState<string>("");
const [group, setGroup] = useState<string>("");
Expand All @@ -45,9 +46,11 @@ export const SaveLayoutPanel = (props: SaveLayoutPanelProps) => {
const [screenshot, setScreenshot] = useState<string | undefined>();

useEffect(() => {
takeScreenshot(document.getElementsByClassName("vuuShell-content")[0] as HTMLElement).then(screenshot =>
setScreenshot(screenshot)
)
if (componentId) {
takeScreenshot(document.getElementById(componentId) as HTMLElement).then(screenshot =>
setScreenshot(screenshot)
)
}
}, [])

const handleSubmit = () => {
Expand Down
1 change: 1 addition & 0 deletions vuu-ui/showcase/src/examples/Apps/NewTheme.examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const ShellWithNewTheme = () => {
<SaveLayoutPanel
onCancel={handleCloseDialog}
onSave={handleSave}
componentId={action.options.controlledComponentId}
/>
);
return true;
Expand Down

0 comments on commit 82f0107

Please sign in to comment.