Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Nov 29, 2024
1 parent bcf0e47 commit 7600c40
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import HelpTextIcon from "@mui/icons-material/SpeakerNotes";
import HelpTextOffIcon from "@mui/icons-material/SpeakerNotesOff";
import IconButton from "@mui/material/IconButton";
import Tooltip from "@mui/material/Tooltip";
import { useStore } from "pages/FlowEditor/lib/store";
import React from "react";

export const ToggleHelpTextButton: React.FC = () => {
const [showHelpText, toggleShowHelpText] = useStore((state) => [
state.showHelpText,
state.toggleShowHelpText,
]);

return (
<Tooltip title="Toggle help text" placement="right">
<IconButton
aria-label="Toggle help text"
onClick={toggleShowHelpText}
size="large"
sx={(theme) => ({
background: theme.palette.background.paper,
padding: theme.spacing(1),
color: showHelpText
? theme.palette.text.primary
: theme.palette.text.disabled,
"&:hover": {
background: theme.palette.common.white,
},
})}
>
{showHelpText ? <HelpTextIcon /> : <HelpTextOffIcon />}
</IconButton>
</Tooltip>
);
};
2 changes: 2 additions & 0 deletions editor.planx.uk/src/pages/FlowEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { rootFlowPath } from "routes/utils";

import Flow from "./components/Flow";
import { ToggleDataFieldsButton } from "./components/FlowEditor/ToggleDataFieldsButton";
import { ToggleHelpTextButton } from "./components/FlowEditor/ToggleHelpTextButton";
import { ToggleImagesButton } from "./components/FlowEditor/ToggleImagesButton";
import { ToggleTagsButton } from "./components/FlowEditor/ToggleTagsButton";
import Sidebar from "./components/Sidebar";
Expand Down Expand Up @@ -71,6 +72,7 @@ const FlowEditor = () => {
>
<ToggleImagesButton />
<ToggleDataFieldsButton />
<ToggleHelpTextButton />
<ToggleTagsButton />
</EditorVisualControls>
</Box>
Expand Down
6 changes: 6 additions & 0 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export interface EditorUIStore {
toggleShowImages: () => void;
showDataFields: boolean;
toggleShowDataFields: () => void;
showHelpText: boolean;
toggleShowHelpText: () => void;
previousURL?: string;
currentURL: string;
initURLTracking: () => void;
Expand Down Expand Up @@ -92,6 +94,10 @@ export const editorUIStore: StateCreator<

toggleShowDataFields: () => set({ showDataFields: !get().showDataFields }),

showHelpText: false,

toggleShowHelpText: () => set({ showHelpText: !get().showHelpText }),

previousURL: undefined,

currentURL: window.location.pathname,
Expand Down

0 comments on commit 7600c40

Please sign in to comment.