Message / Web Page: Support click on text

This commit is contained in:
Alexander Zinchuk 2024-12-20 17:05:18 +01:00
parent 19f60cdb8a
commit 19a9ed3809
2 changed files with 19 additions and 1 deletions

View File

@ -50,6 +50,7 @@
&.interactive {
cursor: var(--custom-cursor, pointer);
&:active {
background-color: var(--background-active-color);
}
@ -90,6 +91,15 @@
flex-grow: 1;
align-items: flex-start;
position: relative;
&_interactive {
cursor: pointer;
transition: opacity 0.15s;
&:hover {
opacity: 0.75;
}
}
}
.media-inner {

View File

@ -95,6 +95,7 @@ const WebPage: FC<OwnProps> = ({
const handleMediaClick = useLastCallback(() => {
onMediaClick!();
});
const handleContainerClick = useLastCallback((e: React.MouseEvent) => {
onContainerClick?.(e);
});
@ -149,6 +150,10 @@ const WebPage: FC<OwnProps> = ({
}
const isMediaInteractive = (photo || video) && onMediaClick && !isSquarePhoto;
function handleTextClick() {
window.open(url, '_blank', 'noopener');
}
const className = buildClassName(
'WebPage',
inPreview && 'in-preview',
@ -193,7 +198,10 @@ const WebPage: FC<OwnProps> = ({
<BaseStory story={story} isProtected={isProtected} isConnected={isConnected} isPreview />
)}
{isArticle && (
<div className="WebPage-text">
<div
className={buildClassName('WebPage-text', !inPreview && 'WebPage-text_interactive')}
onClick={!inPreview ? handleTextClick : undefined}
>
<SafeLink className="site-name" url={url} text={siteName || displayUrl} />
{!inPreview && title && (
<p className="site-title">{renderText(title)}</p>