File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -119,6 +119,32 @@ const stylesFactory = (theme: DevtoolsStore['settings']['theme']) => {
119119 margin- botto m: 2rem;
120120 bor der- radius: 0.75rem;
121121 ` ,
122+ seoSubNav : css `
123+ dis play: flex;
124+ flex- direction: row;
125+ gap: 0;
126+ margin- botto m: 1rem;
127+ bor der- botto m: 1px solid ${ t ( colors . gray [ 200 ] , colors . gray [ 800 ] ) } ;
128+ ` ,
129+ seoSubNavLabel : css `
130+ padding: 0.5rem 1rem;
131+ font- size: 0.875rem;
132+ font- weight: 500;
133+ color : ${ t ( colors . gray [ 600 ] , colors . gray [ 400 ] ) } ;
134+ background: none;
135+ bor der: none;
136+ bor der- botto m: 2px solid transparent;
137+ margin- botto m: -1px;
138+ cursor : pointer;
139+ font- family: inherit;
140+ & : hover {
141+ color : ${ t ( colors . gray [ 800 ] , colors . gray [ 200 ] ) } ;
142+ }
143+ ` ,
144+ seoSubNavLabelActive : css `
145+ color : ${ t ( colors . gray [ 900 ] , colors . gray [ 100 ] ) } ;
146+ border-bottom-color : ${ t ( colors . gray [ 900 ] , colors . gray [ 100 ] ) } ;
147+ ` ,
122148 seoPreviewSection : css `
123149 display : flex;
124150 flex-direction : row;
Original file line number Diff line number Diff line change 1+ import { Show , createSignal } from 'solid-js'
12import { MainPanel } from '@tanstack/devtools-ui'
3+ import { useStyles } from '../../styles/use-styles'
24import { SocialPreviewsSection } from './social-previews'
5+ import { SerpPreviewSection } from './serp-preview'
6+
7+ type SeoSubView = 'social-previews' | 'serp-preview'
38
49export const SeoTab = ( ) => {
10+ const [ activeView , setActiveView ] = createSignal < SeoSubView > ( 'social-previews' )
11+ const styles = useStyles ( )
12+
513 return (
614 < MainPanel withPadding >
7- < SocialPreviewsSection />
15+ < nav class = { styles ( ) . seoSubNav } aria-label = "SEO sections" >
16+ < button
17+ type = "button"
18+ class = { `${ styles ( ) . seoSubNavLabel } ${ activeView ( ) === 'social-previews' ? styles ( ) . seoSubNavLabelActive : '' } ` }
19+ onClick = { ( ) => setActiveView ( 'social-previews' ) }
20+ >
21+ Social previews
22+ </ button >
23+ < button
24+ type = "button"
25+ class = { `${ styles ( ) . seoSubNavLabel } ${ activeView ( ) === 'serp-preview' ? styles ( ) . seoSubNavLabelActive : '' } ` }
26+ onClick = { ( ) => setActiveView ( 'serp-preview' ) }
27+ >
28+ SERP Preview
29+ </ button >
30+ </ nav >
31+ < Show when = { activeView ( ) === 'social-previews' } >
32+ < SocialPreviewsSection noTitle />
33+ </ Show >
34+ < Show when = { activeView ( ) === 'serp-preview' } >
35+ < SerpPreviewSection noTitle />
36+ </ Show >
837 </ MainPanel >
938 )
1039}
Original file line number Diff line number Diff line change 1+ import {
2+ Section ,
3+ SectionDescription ,
4+ SectionIcon ,
5+ SectionTitle ,
6+ } from '@tanstack/devtools-ui'
7+ import { PageSearch } from '@tanstack/devtools-ui/icons'
8+
9+ const DUMMY_SERP = {
10+ title : 'Example Page Title - Your Site Name' ,
11+ description :
12+ 'This is a short meta description that shows how your page might appear in Google search results. Keep it under 160 characters.' ,
13+ url : 'https://example.com/page-path' ,
14+ }
15+
16+ export function SerpPreviewSection ( props : { noTitle ?: boolean } = { } ) {
17+ return (
18+ < Section >
19+ { ! props . noTitle && (
20+ < SectionTitle >
21+ < SectionIcon >
22+ < PageSearch />
23+ </ SectionIcon >
24+ SERP Preview
25+ </ SectionTitle >
26+ ) }
27+ < SectionDescription >
28+ See how your title tag and meta description to see your website's SERP
29+ snippet preview in Google search results.
30+ </ SectionDescription >
31+ < div >
32+ < p > { DUMMY_SERP . title } </ p >
33+ < p > { DUMMY_SERP . description } </ p >
34+ < p > { DUMMY_SERP . url } </ p >
35+ </ div >
36+ </ Section >
37+ )
38+ }
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ function SocialPreview(props: {
146146 )
147147}
148148
149- export function SocialPreviewsSection ( ) {
149+ export function SocialPreviewsSection ( props : { noTitle ?: boolean } = { } ) {
150150 const [ reports , setReports ] = createSignal < Array < SocialReport > > ( analyzeHead ( ) )
151151 const styles = useStyles ( )
152152
@@ -184,12 +184,14 @@ export function SocialPreviewsSection() {
184184
185185 return (
186186 < Section >
187- < SectionTitle >
188- < SectionIcon >
189- < SocialBubble />
190- </ SectionIcon >
191- Social previews
192- </ SectionTitle >
187+ { ! props . noTitle && (
188+ < SectionTitle >
189+ < SectionIcon >
190+ < SocialBubble />
191+ </ SectionIcon >
192+ Social previews
193+ </ SectionTitle >
194+ ) }
193195 < SectionDescription >
194196 See how your current page will look when shared on popular social
195197 networks. The tool checks for essential meta tags and highlights any
You can’t perform that action at this time.
0 commit comments