Message / Web Page: Support click on text
This commit is contained in:
parent
19f60cdb8a
commit
19a9ed3809
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
&.interactive {
|
&.interactive {
|
||||||
cursor: var(--custom-cursor, pointer);
|
cursor: var(--custom-cursor, pointer);
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
background-color: var(--background-active-color);
|
background-color: var(--background-active-color);
|
||||||
}
|
}
|
||||||
@ -90,6 +91,15 @@
|
|||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
|
&_interactive {
|
||||||
|
cursor: pointer;
|
||||||
|
transition: opacity 0.15s;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
opacity: 0.75;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.media-inner {
|
.media-inner {
|
||||||
|
|||||||
@ -95,6 +95,7 @@ const WebPage: FC<OwnProps> = ({
|
|||||||
const handleMediaClick = useLastCallback(() => {
|
const handleMediaClick = useLastCallback(() => {
|
||||||
onMediaClick!();
|
onMediaClick!();
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleContainerClick = useLastCallback((e: React.MouseEvent) => {
|
const handleContainerClick = useLastCallback((e: React.MouseEvent) => {
|
||||||
onContainerClick?.(e);
|
onContainerClick?.(e);
|
||||||
});
|
});
|
||||||
@ -149,6 +150,10 @@ const WebPage: FC<OwnProps> = ({
|
|||||||
}
|
}
|
||||||
const isMediaInteractive = (photo || video) && onMediaClick && !isSquarePhoto;
|
const isMediaInteractive = (photo || video) && onMediaClick && !isSquarePhoto;
|
||||||
|
|
||||||
|
function handleTextClick() {
|
||||||
|
window.open(url, '_blank', 'noopener');
|
||||||
|
}
|
||||||
|
|
||||||
const className = buildClassName(
|
const className = buildClassName(
|
||||||
'WebPage',
|
'WebPage',
|
||||||
inPreview && 'in-preview',
|
inPreview && 'in-preview',
|
||||||
@ -193,7 +198,10 @@ const WebPage: FC<OwnProps> = ({
|
|||||||
<BaseStory story={story} isProtected={isProtected} isConnected={isConnected} isPreview />
|
<BaseStory story={story} isProtected={isProtected} isConnected={isConnected} isPreview />
|
||||||
)}
|
)}
|
||||||
{isArticle && (
|
{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} />
|
<SafeLink className="site-name" url={url} text={siteName || displayUrl} />
|
||||||
{!inPreview && title && (
|
{!inPreview && title && (
|
||||||
<p className="site-title">{renderText(title)}</p>
|
<p className="site-title">{renderText(title)}</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user