-
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
bcf0e47
commit 7600c40
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
editor.planx.uk/src/pages/FlowEditor/components/FlowEditor/ToggleHelpTextButton.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,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> | ||
); | ||
}; |
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