[MM-41559] Dynamically size URL view to avoid overlapping bottom links (#1991)

This commit is contained in:
Devin Binnie
2022-02-04 11:05:06 -05:00
committed by GitHub
parent e4394caf97
commit 94cc15168c
5 changed files with 54 additions and 9 deletions

View File

@@ -1,12 +1,23 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import React, {useEffect} from 'react';
import {UPDATE_URL_VIEW_WIDTH} from 'common/communication';
export default function UrlDescription(props: {url: string}) {
const urlRef = React.createRef<HTMLDivElement>();
useEffect(() => {
window.postMessage({type: UPDATE_URL_VIEW_WIDTH, data: urlRef.current?.scrollWidth}, window.location.href);
}, []);
if (props.url) {
return (
<div className='HoveringURL HoveringURL-left'>
<div
ref={urlRef}
className='HoveringURL HoveringURL-left'
>
<p>{props.url}</p>
</div>
);