MCPcopy Create free account
hub / github.com/TanStack/devtools / SocialPreview

Function SocialPreview

packages/devtools/src/tabs/seo-tab/social-previews.tsx:93–141  ·  view source on GitHub ↗
(props: {
  meta: SocialMeta
  color: string
  network: string
})

Source from the content-addressed store, hash-verified

91}
92
93function SocialPreview(props: {
94 meta: SocialMeta
95 color: string
96 network: string
97}) {
98 const styles = createStyles()
99
100 return (
101 <div class={styles().seoPreviewCard}>
102 <div
103 class={styles().seoPreviewHeader}
104 data-testid="social-preview-heading"
105 >
106 <span
107 aria-hidden="true"
108 class={styles().seoPreviewNetworkDot}
109 style={{ background: props.color }}
110 />
111 {props.network} Preview
112 </div>
113 {props.meta.image ? (
114 <img
115 src={props.meta.image}
116 alt="Preview"
117 class={styles().seoPreviewImage}
118 />
119 ) : (
120 <div
121 class={`${styles().seoPreviewImage} ${styles().seoPreviewImagePlaceholder}`}
122 >
123 No image
124 </div>
125 )}
126 <div class={styles().seoPreviewTitle} data-testid="social-preview-title">
127 {props.meta.title || 'No Title'}
128 </div>
129 <div class={styles().seoPreviewDesc}>
130 {props.meta.description || 'No Description'}
131 </div>
132 <div class={styles().seoPreviewUrl}>
133 {props.meta.url || window.location.href}
134 </div>
135 </div>
136 )
137}
138
139export function SocialPreviewsSection() {
140 const [reports, setReports] = createSignal<Array<SocialReport>>(analyzeHead())
141 const styles = createStyles()
142
143 function analyzeHead(): Array<SocialReport> {
144 const metaTags = Array.from(document.head.querySelectorAll('meta'))

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected