-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1704: Redesign panel sections in sidebar
- Loading branch information
Showing
31 changed files
with
424 additions
and
250 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 was deleted.
Oops, something went wrong.
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,42 @@ | ||
import React from "react"; | ||
import { useSelector } from "react-redux"; | ||
import { FaInfoCircle } from "react-icons/fa"; | ||
import {TitleAndIconContainer, StyledTooltip, HeaderIconContainer, HeaderTitle} from "./styles"; | ||
import { RootState } from "../../store"; | ||
|
||
/** Title to display for the control. */ | ||
export type Title = string; | ||
|
||
/** Informational tooltip element to display on hover. */ | ||
export type Tooltip = JSX.Element; | ||
|
||
type Props = { | ||
title: Title | ||
tooltip?: Tooltip | ||
} | ||
|
||
/** | ||
* A title and tooltip to be shown in a control header. | ||
* The tooltip is not shown on mobile. | ||
*/ | ||
export const AnnotatedTitle = ({title, tooltip=undefined}: Props) => { | ||
const mobile = useSelector((state: RootState) => state.general.mobileDisplay); | ||
|
||
return ( | ||
<TitleAndIconContainer> | ||
<HeaderTitle>{title}</HeaderTitle> | ||
{tooltip && !mobile && ( | ||
<> | ||
<HeaderIconContainer data-tip data-for={title} | ||
// Don't allow any parent onClick callbacks to run. | ||
onClick={(event) => event.stopPropagation()}> | ||
<FaInfoCircle/> | ||
</HeaderIconContainer> | ||
<StyledTooltip place="bottom" type="dark" effect="solid" id={title}> | ||
{tooltip} | ||
</StyledTooltip> | ||
</> | ||
)} | ||
</TitleAndIconContainer> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from "react"; | ||
import { HeaderContainer } from "./styles"; | ||
import { AnnotatedTitle, Title, Tooltip } from "./annotatedTitle"; | ||
|
||
type Props = { | ||
title: Title | ||
tooltip?: Tooltip | ||
} | ||
|
||
/** | ||
* A header used by all non-panel controls, containing an informative title. | ||
*/ | ||
export const ControlHeader = ({title, tooltip=undefined }: Props) => { | ||
return ( | ||
<HeaderContainer> | ||
<AnnotatedTitle | ||
title={title} | ||
tooltip={tooltip} /> | ||
</HeaderContainer> | ||
); | ||
}; |
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
Oops, something went wrong.