1- import clsx from 'clsx' ;
1+ // index.tsx
2+
23import Link from '@docusaurus/Link' ;
34import {
45 PageMetadata ,
@@ -10,10 +11,10 @@ import Translate, {translate} from '@docusaurus/Translate';
1011import SearchMetadata from '@theme/SearchMetadata' ;
1112import type { Props } from '@theme/DocTagDocListPage' ;
1213import Heading from '@theme/Heading' ;
14+ import { File , FlaskConical , Factory , FileCheck } from 'lucide-react' ;
1315import styles from './styles.module.css' ;
14- import useBaseUrl from '@docusaurus/useBaseUrl' ;
1516
16- // Very simple pluralization: probably good enough for now
17+ // Custom pluralization hook
1718function useNDocsTaggedPlural ( ) {
1819 const { selectMessage} = usePluralForm ( ) ;
1920 return ( count : number ) =>
@@ -22,63 +23,58 @@ function useNDocsTaggedPlural() {
2223 translate (
2324 {
2425 id : 'theme.docs.tagDocListPageTitle.nDocsTagged' ,
25- description :
26- 'Pluralized label for "{count} docs tagged". Use as much plural forms (separated by "|") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)' ,
26+ description : 'Pluralized label for "{count} docs tagged"' ,
2727 message : 'We found one article tagged|We found {count} articles tagged' ,
2828 } ,
2929 { count} ,
3030 ) ,
3131 ) ;
3232}
3333
34+ // Compose the page title
3435function usePageTitle ( props : Props ) : string {
35- const nDocsTaggedPlural = useNDocsTaggedPlural ( ) ;
36+ const nDocsTagged = useNDocsTaggedPlural ( ) ( props . tag . count ) ;
3637 return translate (
3738 {
3839 id : 'theme.docs.tagDocListPageTitle' ,
39- description : 'The title of the page for a docs tag' ,
40+ description : 'Title of the docs tag list page ' ,
4041 message : '{nDocsTagged} with "{tagName}"' ,
4142 } ,
42- { nDocsTagged : nDocsTaggedPlural ( props . tag . count ) , tagName : props . tag . label } ,
43+ { nDocsTagged, tagName : props . tag . label } ,
4344 ) ;
4445}
4546
47+ // Single document item
4648function DocItem ( { doc} : { doc : Props [ 'tag' ] [ 'items' ] [ number ] } ) : JSX . Element {
47- return (
48- < article className = "margin-vert--lg" >
49- < div className = { clsx ( "row row--no-gutters" , styles . item ) } >
50-
51- { /* Image Content */ }
52- < div className = "col col--1" aria-hidden = "true" >
53- < img
54- src = { doc . image || useBaseUrl ( "img/open-telekom-cloud-social-card.png" ) }
55- alt = { doc . title }
56- className = { styles . item__image }
57- />
58- </ div >
49+ const url = doc . permalink ;
50+ const IconComponent = url . includes ( 'best-practices' )
51+ ? FileCheck
52+ : url . includes ( 'by-industry' )
53+ ? Factory
54+ : url . includes ( 'blueprints' )
55+ ? FlaskConical
56+ : File ;
5957
60- { /* Title content */ }
61- < div className = { clsx ( "col col--11" , styles . item__inner ) } >
62- < div style = { { paddingTop : '4px' , paddingLeft : '15px' } } >
63- < Link to = { doc . permalink } >
64- < Heading as = "h2" > { doc . title } </ Heading >
65- </ Link >
66- { /* {doc.description && <p className={styles.item__description}>{doc.description}</p> } */ }
67- </ div >
58+ return (
59+ < article className = { styles . article } >
60+ < div className = { styles . itemRow } >
61+ < div className = { styles . icon } >
62+ < IconComponent size = { 24 } />
6863 </ div >
69-
70- { /* Description content */ }
71- < div className = { clsx ( "col col--12" , styles . item__inner ) } >
72- < div >
73- { doc . description && < p className = { styles . item__description } > { doc . description } </ p > }
74- </ div >
64+ < div className = { styles . content } >
65+ < Link to = { doc . permalink } className = { styles . title } >
66+ { doc . title }
67+ </ Link >
68+ { doc . description && (
69+ < p className = { styles . description } > { doc . description } </ p >
70+ ) }
7571 </ div >
76-
7772 </ div >
7873 </ article >
7974 ) ;
8075}
8176
77+ // Metadata component
8278function DocTagDocListPageMetadata ( {
8379 title,
8480 tag,
@@ -91,22 +87,21 @@ function DocTagDocListPageMetadata({
9187 ) ;
9288}
9389
90+ // Main content component
9491function DocTagDocListPageContent ( {
9592 tag,
9693 title,
9794} : Props & { title : string } ) : JSX . Element {
9895 return (
9996 < HtmlClassNameProvider
100- className = { clsx ( ThemeClassNames . page . docsTagDocListPage ) } >
101- < div className = "container margin-vert--lg" >
102- < div className = "row" >
103- < main className = "col col--8 col--offset-2" >
104- { tag . unlisted && < Unlisted /> }
105- < header className = "margin-bottom--xl" >
106- < Heading as = "h1" > { title } </ Heading >
107- { tag . description && < p > { tag . description } </ p > }
108-
109- < scale-button size = "small" variant = "secondary" href = { tag . allTagsPath } >
97+ className = { ThemeClassNames . page . docsTagDocListPage }
98+ >
99+ < div className = { styles . page } >
100+ { tag . unlisted && < Unlisted /> }
101+ < header className = { styles . header } >
102+ < Heading as = "h1" > { title } </ Heading >
103+ { tag . description && < p > { tag . description } </ p > }
104+ < scale-button size = "small" variant = "secondary" href = { tag . allTagsPath } >
110105 < scale-icon-action-backward > </ scale-icon-action-backward >
111106 < Translate
112107 id = "theme.tags.tagsPageLink"
@@ -115,19 +110,18 @@ function DocTagDocListPageContent({
115110 </ Translate >
116111 </ scale-button >
117112
118- </ header >
119- < section className = "margin-vert--lg" >
120- { tag . items . map ( ( doc ) => (
121- < DocItem key = { doc . id } doc = { doc } />
122- ) ) }
123- </ section >
124- </ main >
125- </ div >
113+ </ header >
114+ < section >
115+ { tag . items . map ( ( doc ) => (
116+ < DocItem key = { doc . id } doc = { doc } />
117+ ) ) }
118+ </ section >
126119 </ div >
127120 </ HtmlClassNameProvider >
128121 ) ;
129122}
130123
124+ // Exported page component
131125export default function DocTagDocListPage ( props : Props ) : JSX . Element {
132126 const title = usePageTitle ( props ) ;
133127 return (
0 commit comments