diff --git a/src/components/controls/panel-toggle.tsx b/src/components/controls/panel-toggle.tsx index 58169ec89..7c2ba5ba3 100644 --- a/src/components/controls/panel-toggle.tsx +++ b/src/components/controls/panel-toggle.tsx @@ -1,9 +1,9 @@ -// A slider toggle to adjust the state of a panel via dispatch. +// A textual toggle to adjust the state of a panel via dispatch. import React from "react"; import { useDispatch } from "react-redux"; +import styled from 'styled-components'; -import Toggle from "./toggle"; import { togglePanelDisplay } from "../../actions/panelDisplay"; type Props = { @@ -11,21 +11,39 @@ type Props = { on: boolean } +const Text = styled.span` + font-size: 14px; + cursor: pointer; + padding: 0 3px; +`; + +const TextSelected = styled(Text)` + color: ${(props) => props.theme.selectedColor}; +`; + +const TextUnselected = styled(Text)` + color: ${(props) => props.theme.unselectedColor}; +`; + const PanelToggle = ({ panel, on }: Props) => { const dispatch = useDispatch(); - // There is no slider label since the title in the annotated header acts as a - // visual label. - // FIXME: Add a hidden label? - - return ( - dispatch(togglePanelDisplay(panel))} - label="" - /> - ); + if (on) { + return ( +
+ ON + dispatch(togglePanelDisplay(panel))}>OFF +
+ ) + } + else { + return ( +
+ dispatch(togglePanelDisplay(panel))}>ON + OFF +
+ ) + } }; export default PanelToggle;