Skip to content

Commit

Permalink
fix: translate tooltip down
Browse files Browse the repository at this point in the history
There are still some issues:
1. the position differs between tooltip modes
2. when resizing the window down, the new bar chart does not resize itself thus causing x-overflow

Signed-off-by: Maxim Stykow <[email protected]>
  • Loading branch information
mstykow committed Sep 28, 2024
1 parent a247f35 commit 8932d9c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
12 changes: 7 additions & 5 deletions src/Frontend/Components/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { ReactElement } from 'react';
import { criticalityColor, OpossumColors } from '../../shared-styles';
import { ProgressBarData } from '../../types/types';
import {
getCriticalityBarTooltipText,
getProgressBarTooltipText,
CriticalityBarTooltip,
ProgressBarTooltip,
useOnProgressBarClick,
} from './ProgressBar.util';

Expand Down Expand Up @@ -106,9 +106,11 @@ export function ProgressBar(props: ProgressBarProps): ReactElement {
}
labelTextColor="black"
tooltip={() =>
props.showCriticalSignals
? getCriticalityBarTooltipText(props.progressBarData)
: getProgressBarTooltipText(props.progressBarData)
props.showCriticalSignals ? (
<CriticalityBarTooltip {...props.progressBarData} />
) : (
<ProgressBarTooltip {...props.progressBarData} />
)
}
onClick={
props.showCriticalSignals ? onCriticalityBarClick : onProgressBarClick
Expand Down
19 changes: 8 additions & 11 deletions src/Frontend/Components/ProgressBar/ProgressBar.util.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ const classes = {
fontSize: 12,
margin: 2,
fontWeight: 500,
position: 'relative',
top: '200',
transform: 'translate(0px, 168px)',
} as CSSProperties,
tooltipLine: { display: 'flex', 'align-items': 'center', padding: 4 },
tooltipLine: { display: 'flex', alignItems: 'center', padding: 4 },
colorBlock: {
display: 'block',
width: 12,
Expand All @@ -62,9 +61,9 @@ const classes = {
},
};

export function getProgressBarTooltipText(
progressBarData: ProgressBarData,
): React.ReactNode {
export const ProgressBarTooltip: React.FC<ProgressBarData> = (
progressBarData,
) => {
return (
<MuiBox aria-label={'tooltip'} style={classes.tooltip}>
Number of resources...
Expand Down Expand Up @@ -126,11 +125,9 @@ export function getProgressBarTooltipText(
</div>
</MuiBox>
);
}
};

export function getCriticalityBarTooltipText(
progressBarData: ProgressBarData,
): React.ReactNode {
export const CriticalityBarTooltip = (progressBarData: ProgressBarData) => {
const filesWithNonCriticalExternalAttributions =
progressBarData.filesWithOnlyExternalAttributionCount -
progressBarData.filesWithHighlyCriticalExternalAttributionsCount -
Expand Down Expand Up @@ -179,4 +176,4 @@ export function getCriticalityBarTooltipText(
</div>
</MuiBox>
);
}
};

0 comments on commit 8932d9c

Please sign in to comment.