Skip to content

Commit

Permalink
fix(article-pagination): update doc name type
Browse files Browse the repository at this point in the history
  • Loading branch information
RobsonOlv committed Jan 11, 2024
1 parent ccfc081 commit 2c11156
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
13 changes: 5 additions & 8 deletions src/components/article-pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@ interface Props {
pagination: {
previousDoc: {
slug: string | null
name: { en: string; pt: string; es: string } | null
name: string | null
}
nextDoc: {
slug: string | null
name: { en: string; pt: string; es: string } | null
name: string | null
}
}
hidePaginationPrevious: boolean
hidePaginationNext: boolean
}

import styles from './styles'
import { useIntl } from 'react-intl'

const ArticlePagination = ({
pagination,
hidePaginationNext,
hidePaginationPrevious,
}: Props) => {
const router = useRouter()
const locale = useIntl().locale as 'en' | 'pt' | 'es'
console.log('aaaa', pagination)

const handleClick = (e: { preventDefault: () => void }, slug: string) => {
e.preventDefault()
Expand All @@ -43,7 +42,7 @@ const ArticlePagination = ({
>
<Box sx={styles.paginationBox}>
<Text sx={styles.paginationText}>
{pagination.previousDoc.name?.[locale]}
{pagination.previousDoc.name}
</Text>
<Text sx={styles.subTitle}>« Previous</Text>
</Box>
Expand All @@ -58,9 +57,7 @@ const ArticlePagination = ({
}}
>
<Box sx={styles.paginationBox}>
<Text sx={styles.paginationText}>
{pagination.nextDoc.name?.[locale]}
</Text>
<Text sx={styles.paginationText}>{pagination.nextDoc.name}</Text>
<Text sx={styles.subTitle}>Next »</Text>
</Box>
</Link>
Expand Down
7 changes: 5 additions & 2 deletions src/pages/docs/tracks/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ interface Props {
pagination: {
previousDoc: {
slug: string | null
name: { en: string; pt: string; es: string } | null | null
name: string | null
}
nextDoc: {
slug: string | null
name: { en: string; pt: string; es: string } | null | null
name: string | null
}
}
isListed: boolean
Expand Down Expand Up @@ -384,6 +384,9 @@ export const getStaticProps: GetStaticProps = async ({
: null,
},
}
console.log('#####################################')
console.log(pagination)
console.log('#####################################')

const flattenedSidebar = flattenJSON(sidebarfallback)
const isListed: boolean = getKeyByValue(flattenedSidebar, slug)
Expand Down
4 changes: 2 additions & 2 deletions src/pages/docs/tutorial/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ interface Props {
pagination: {
previousDoc: {
slug: string | null
name: { en: string; pt: string; es: string } | null | null
name: string | null
}
nextDoc: {
slug: string | null
name: { en: string; pt: string; es: string } | null | null
name: string | null
}
}
isListed: boolean
Expand Down

0 comments on commit 2c11156

Please sign in to comment.