Skip to content

Commit 7009617

Browse files
committed
feat(devtools): enhance SERP preview layout with new styles
This commit introduces new styles for the SERP preview section, including a dedicated block for the preview and a label for better organization. The layout improvements enhance the visual presentation of the desktop preview, ensuring a clearer display of the site name, URL, title, and description.
1 parent e9caf21 commit 7009617

File tree

2 files changed

+44
-32
lines changed

2 files changed

+44
-32
lines changed

packages/devtools/src/styles/use-styles.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,15 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
231231
padding: 0 10px 8px 10px;
232232
font-size: 0.875rem;
233233
`,
234+
serpPreviewBlock: css`
235+
margin-bottom: 1.5rem;
236+
`,
237+
serpPreviewLabel: css`
238+
font-size: 0.875rem;
239+
font-weight: 600;
240+
margin-bottom: 0.5rem;
241+
color: ${t(colors.gray[700], colors.gray[300])};
242+
`,
234243
serpSnippet: css`
235244
border: 1px solid ${t(colors.gray[200], colors.gray[800])};
236245
border-radius: 8px;

packages/devtools/src/tabs/seo-tab/serp-preview.tsx

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -152,40 +152,43 @@ export function SerpPreviewSection() {
152152
See how your title tag and meta description may look in Google search
153153
results. Data is read from the current page.
154154
</SectionDescription>
155-
<div class={styles().serpSnippet}>
156-
<div class={styles().serpSnippetTopRow}>
157-
{data.favicon ? (
158-
<img
159-
src={data.favicon}
160-
alt=""
161-
class={styles().serpSnippetFavicon}
162-
/>
163-
) : (
164-
<div class={styles().serpSnippetDefaultFavicon} />
165-
)}
166-
<div class={styles().serpSnippetSiteColumn}>
167-
<span class={styles().serpSnippetSiteName}>
168-
{data.siteName || data.url}
169-
</span>
170-
<span class={styles().serpSnippetSiteUrl}>{data.url}</span>
155+
<div class={styles().serpPreviewBlock}>
156+
<div class={styles().serpPreviewLabel}>Desktop preview</div>
157+
<div class={styles().serpSnippet}>
158+
<div class={styles().serpSnippetTopRow}>
159+
{data.favicon ? (
160+
<img
161+
src={data.favicon}
162+
alt=""
163+
class={styles().serpSnippetFavicon}
164+
/>
165+
) : (
166+
<div class={styles().serpSnippetDefaultFavicon} />
167+
)}
168+
<div class={styles().serpSnippetSiteColumn}>
169+
<span class={styles().serpSnippetSiteName}>
170+
{data.siteName || data.url}
171+
</span>
172+
<span class={styles().serpSnippetSiteUrl}>{data.url}</span>
173+
</div>
171174
</div>
175+
<div class={styles().serpSnippetTitle}>
176+
{displayTitle() || data.title || 'No title'}
177+
</div>
178+
<div
179+
ref={setTitleMeasureEl}
180+
class={`${styles().serpSnippetTitle} ${styles().serpMeasureHidden}`}
181+
aria-hidden="true"
182+
/>
183+
<div class={styles().serpSnippetDesc}>
184+
{displayDescription() || data.description || 'No meta description.'}
185+
</div>
186+
<div
187+
ref={setDescMeasureEl}
188+
class={`${styles().serpSnippetDesc} ${styles().serpMeasureHidden}`}
189+
aria-hidden="true"
190+
/>
172191
</div>
173-
<div class={styles().serpSnippetTitle}>
174-
{displayTitle() || data.title || 'No title'}
175-
</div>
176-
<div
177-
ref={setTitleMeasureEl}
178-
class={`${styles().serpSnippetTitle} ${styles().serpMeasureHidden}`}
179-
aria-hidden="true"
180-
/>
181-
<div class={styles().serpSnippetDesc}>
182-
{displayDescription() || data.description || 'No meta description.'}
183-
</div>
184-
<div
185-
ref={setDescMeasureEl}
186-
class={`${styles().serpSnippetDesc} ${styles().serpMeasureHidden}`}
187-
aria-hidden="true"
188-
/>
189192
</div>
190193
{reports().length > 0 ? (
191194
<div class={styles().seoMissingTagsSection}>

0 commit comments

Comments
 (0)