1
- import { useEffect } from "react" ;
2
1
import { Typography , Box , Stack } from "@mui/material" ;
3
2
import { ImageRounded } from "@mui/icons-material" ;
4
3
import { useLocation , useParams } from "react-router" ;
5
4
import { useSelector } from "react-redux" ;
6
5
7
6
import { useDomain } from "../../../../../../../../shell/hooks/use-domain" ;
8
7
import { AppState } from "../../../../../../../../shell/store/types" ;
9
- import { useImageURL } from "./useImageURL" ;
10
8
11
- type LinkedInPreviewProps = { } ;
12
- export const LinkedInPreview = ( { } : LinkedInPreviewProps ) => {
13
- const [ imageURL , setImageDimensions ] = useImageURL ( ) ;
9
+ type LinkedInPreviewProps = {
10
+ imageURL : string ;
11
+ } ;
12
+ export const LinkedInPreview = ( { imageURL } : LinkedInPreviewProps ) => {
14
13
const { itemZUID, modelZUID } = useParams < {
15
14
itemZUID : string ;
16
15
modelZUID : string ;
@@ -23,10 +22,6 @@ export const LinkedInPreview = ({}: LinkedInPreviewProps) => {
23
22
state . content [ isCreateItemPage ? `new:${ modelZUID } ` : itemZUID ]
24
23
) ;
25
24
26
- useEffect ( ( ) => {
27
- setImageDimensions ( { height : 290 , type : "fit" } ) ;
28
- } , [ ] ) ;
29
-
30
25
return (
31
26
< Stack bgcolor = "grey.100" >
32
27
{ ! ! imageURL ? (
@@ -39,7 +34,7 @@ export const LinkedInPreview = ({}: LinkedInPreviewProps) => {
39
34
} }
40
35
height = { 290 }
41
36
width = "100%"
42
- src = { imageURL }
37
+ src = { ` ${ imageURL } ?width=500&height=290&fit=cover` }
43
38
flexShrink = { 0 }
44
39
/>
45
40
) : (
@@ -57,7 +52,11 @@ export const LinkedInPreview = ({}: LinkedInPreviewProps) => {
57
52
< Typography
58
53
variant = "h6"
59
54
fontWeight = { 600 }
60
- color = { item ?. web ?. metaTitle ? "text.primary" : "grey.500" }
55
+ color = {
56
+ ! ! item ?. data ?. og_title || ! ! item ?. web ?. metaTitle
57
+ ? "text.primary"
58
+ : "grey.500"
59
+ }
61
60
sx = { {
62
61
display : "-webkit-box" ,
63
62
"-webkit-line-clamp" : "1" ,
@@ -69,7 +68,7 @@ export const LinkedInPreview = ({}: LinkedInPreviewProps) => {
69
68
textOverflow : "ellipsis" ,
70
69
} }
71
70
>
72
- { item ?. web ?. metaTitle || "Meta Title" }
71
+ { item ?. data ?. og_title || item ?. web ?. metaTitle || "Meta Title" }
73
72
</ Typography >
74
73
< Typography color = "text.secondary" >
75
74
{ domain . replace ( / h t t p : \/ \/ | h t t p s : \/ \/ / gm, "" ) }
0 commit comments