- Remove code casuing expensive style recalculation

This commit is contained in:
Satish Gandham 2021-05-18 17:48:29 +05:30
parent 51b98eed2f
commit faeac974ca

View File

@ -16,7 +16,8 @@ const Wrapper = styled.span<{
background-color: ${(props) =>
props.theme.colors.codeMirror.background.hoverState};
position: absolute;
bottom: ${(props) => -props.bottomOffset}px;
bottom: ${(props) => props.bottomOffset}px;
transform: translateY(100%);
width: 100%;
line-height: 13px;
visibility: ${(props) => (props.visible ? "visible" : "hidden")};
@ -37,15 +38,9 @@ function BindingPrompt(props: {
editorTheme?: EditorTheme;
}): JSX.Element {
const promptRef = useRef<HTMLDivElement>(null);
let bottomOffset = 30;
const customMessage = !!props.promptMessage;
if (promptRef.current) {
const boundingRect = promptRef.current.getBoundingClientRect();
bottomOffset = boundingRect.height;
}
if (customMessage) {
bottomOffset = 36;
}
const bottomOffset = customMessage ? 6 : 0;
return (
<Wrapper
bottomOffset={bottomOffset}