mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-05 04:55:50 +01:00
Clarify prop usage by renaming in more self-evident name
This commit is contained in:
@@ -31,7 +31,7 @@ import Tooltip from "../Tooltip";
|
|||||||
type Props = {
|
type Props = {
|
||||||
modalTitle: string;
|
modalTitle: string;
|
||||||
modalBody: ReactNode;
|
modalBody: ReactNode;
|
||||||
useTitleTooltip?: boolean; // not recommended
|
tooltipStyle?: "tooltipComponent" | "htmlTitle";
|
||||||
};
|
};
|
||||||
|
|
||||||
const Button = styled.a`
|
const Button = styled.a`
|
||||||
@@ -41,14 +41,18 @@ const Button = styled.a`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const OpenInFullscreenButton: FC<Props> = ({ modalTitle, modalBody, useTitleTooltip = false }) => {
|
const OpenInFullscreenButton: FC<Props> = ({ modalTitle, modalBody, tooltipStyle = "tooltipComponent" }) => {
|
||||||
const [t] = useTranslation("repos");
|
const [t] = useTranslation("repos");
|
||||||
const [showModal, setShowModal] = useState(false);
|
const [showModal, setShowModal] = useState(false);
|
||||||
|
|
||||||
const tooltip = t("diff.fullscreen.open");
|
const tooltip = t("diff.fullscreen.open");
|
||||||
const content = (
|
const content = (
|
||||||
<>
|
<>
|
||||||
<Button title={useTitleTooltip ? tooltip : undefined} className="button" onClick={() => setShowModal(true)}>
|
<Button
|
||||||
|
title={tooltipStyle === "htmlTitle" ? tooltip : undefined}
|
||||||
|
className="button"
|
||||||
|
onClick={() => setShowModal(true)}
|
||||||
|
>
|
||||||
<i className="fas fa-search-plus" />
|
<i className="fas fa-search-plus" />
|
||||||
</Button>
|
</Button>
|
||||||
{showModal && (
|
{showModal && (
|
||||||
@@ -62,7 +66,7 @@ const OpenInFullscreenButton: FC<Props> = ({ modalTitle, modalBody, useTitleTool
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (useTitleTooltip) {
|
if (tooltipStyle === "htmlTitle") {
|
||||||
return <>{content}</>;
|
return <>{content}</>;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class Content extends React.Component<Props, State> {
|
|||||||
<OpenInFullscreenButton
|
<OpenInFullscreenButton
|
||||||
modalTitle={file?.name}
|
modalTitle={file?.name}
|
||||||
modalBody={<BorderLessDiv className="panel">{content}</BorderLessDiv>}
|
modalBody={<BorderLessDiv className="panel">{content}</BorderLessDiv>}
|
||||||
useTitleTooltip={true}
|
tooltipStyle="htmlTitle"
|
||||||
/>
|
/>
|
||||||
<ExtensionPoint
|
<ExtensionPoint
|
||||||
name="repos.sources.content.actionbar"
|
name="repos.sources.content.actionbar"
|
||||||
|
|||||||
Reference in New Issue
Block a user