-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aad9a43
commit b611104
Showing
8 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Thumbnail.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Box from "@mui/material/Box"; | ||
import { useStore } from "pages/FlowEditor/lib/store"; | ||
import React from "react"; | ||
|
||
export const Thumbnail: React.FC<{ | ||
imageSource: string; | ||
imageAltText?: string; | ||
}> = ({ imageSource, imageAltText }) => { | ||
const showImages = useStore((state) => state.showImages); | ||
if (!showImages) return null; | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
maxWidth: "180px", | ||
maxHeight: "180px", | ||
}} | ||
component="img" | ||
src={imageSource} | ||
alt={imageAltText} | ||
/> | ||
); | ||
}; |
45 changes: 45 additions & 0 deletions
45
editor.planx.uk/src/pages/FlowEditor/components/FlowEditor/ToggleImagesButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import ImageOffIcon from "@mui/icons-material/HideImage"; | ||
import ImageIcon from "@mui/icons-material/Image"; | ||
import Box from "@mui/material/Box"; | ||
import IconButton from "@mui/material/IconButton"; | ||
import { useStore } from "pages/FlowEditor/lib/store"; | ||
import React from "react"; | ||
|
||
import { TooltipWrap } from "./ToggleTagsButton"; | ||
|
||
export const ToggleImagesButton: React.FC = () => { | ||
const [showImages, toggleShowImages] = useStore((state) => [ | ||
state.showImages, | ||
state.toggleShowImages, | ||
]); | ||
|
||
return ( | ||
<Box | ||
sx={(theme) => ({ | ||
position: "fixed", | ||
bottom: theme.spacing(2), | ||
left: theme.spacing(13), | ||
zIndex: theme.zIndex.appBar, | ||
border: `1px solid ${theme.palette.border.main}`, | ||
borderRadius: "3px", | ||
background: theme.palette.background.paper, | ||
})} | ||
> | ||
<TooltipWrap title="Toggle images"> | ||
<IconButton | ||
aria-label="Toggle images" | ||
onClick={toggleShowImages} | ||
size="large" | ||
sx={(theme) => ({ | ||
padding: theme.spacing(1), | ||
color: showImages | ||
? theme.palette.text.primary | ||
: theme.palette.text.disabled, | ||
})} | ||
> | ||
{showImages ? <ImageIcon /> : <ImageOffIcon />} | ||
</IconButton> | ||
</TooltipWrap> | ||
</Box> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters