Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

Commit 7063e3d

Browse files
committed
Add jsdocs to pages
1 parent c768c52 commit 7063e3d

File tree

3 files changed

+34
-15
lines changed

3 files changed

+34
-15
lines changed

pages/[...slug].js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ import PropTypes from 'prop-types'
66
// Define route post type.
77
const postType = 'page'
88

9+
/**
10+
* Render the Page component.
11+
*
12+
* @author WebDevStudios
13+
* @param {object} props The component attributes as props.
14+
* @param {object} props.post The post data object.
15+
* @return {Element} The Page component.
16+
*/
917
export default function Page({post}) {
1018
return (
1119
<Layout
@@ -44,7 +52,7 @@ export default function Page({post}) {
4452
* Get post static paths.
4553
*
4654
* @author WebDevStudios
47-
* @return {Object} Object consisting of array of paths and fallback setting.
55+
* @return {object} Object consisting of array of paths and fallback setting.
4856
*/
4957
export async function getStaticPaths() {
5058
return await getPostTypeStaticPaths(postType)
@@ -53,11 +61,11 @@ export async function getStaticPaths() {
5361
/**
5462
* Get post static props.
5563
*
56-
* @param {Object} context Context for current post.
57-
* @param {Object} context.params Route parameters for current post.
58-
* @param {boolean} context.preview Whether requesting preview of post.
59-
* @param {Object} context.previewData Post preview data.
60-
* @return {Object} Post props.
64+
* @param {object} context Context for current post.
65+
* @param {object} context.params Route parameters for current post.
66+
* @param {boolean} context.preview Whether requesting preview of post.
67+
* @param {object} context.previewData Post preview data.
68+
* @return {object} Post props.
6169
*/
6270
export async function getStaticProps({params}) {
6371
return getPostTypeStaticProps(params, postType)

pages/index.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ import Page from './[...slug]'
77
// Define route post type.
88
const postType = 'page'
99

10+
/**
11+
* Render the HomePage component.
12+
*
13+
* @author WebDevStudios
14+
* @param {object} props The component attributes as props.
15+
* @param {object} props.post The post data object.
16+
* @return {Element} The HomePage component.
17+
*/
1018
export default function HomePage({post}) {
1119
// Display dynamic page data if homepage retrieved from WP.
1220
if (post) {
@@ -47,10 +55,10 @@ export default function HomePage({post}) {
4755
/**
4856
* Get post static props.
4957
*
50-
* @param {Object} context Context for current post.
51-
* @param {boolean} context.preview Whether requesting preview of post.
52-
* @param {Object} context.previewData Post preview data.
53-
* @return {Object} Post props.
58+
* @param {object} context Context for current post.
59+
* @param {boolean} context.preview Whether requesting preview of post.
60+
* @param {object} context.previewData Post preview data.
61+
* @return {object} Post props.
5462
*/
5563
export async function getStaticProps() {
5664
return await getPostTypeStaticProps({slug: '/'}, postType)

pages/search.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import {useRouter} from 'next/router'
66
import config from '@/functions/config'
77

88
/**
9-
* The Search component displays the search page.
9+
* Render the Search component.
10+
*
11+
* @author WebDevStudios
12+
* @return {Element} The Search component.
1013
*/
1114
export default function Search() {
1215
const router = useRouter()
@@ -27,10 +30,10 @@ export default function Search() {
2730
/**
2831
* Get post static props.
2932
*
30-
* @param {Object} context Context for current post.
31-
* @param {boolean} context.preview Whether requesting preview of post.
32-
* @param {Object} context.previewData Post preview data.
33-
* @return {Object} Post props.
33+
* @param {object} context Context for current post.
34+
* @param {boolean} context.preview Whether requesting preview of post.
35+
* @param {object} context.previewData Post preview data.
36+
* @return {object} Post props.
3437
*/
3538
export async function getStaticProps() {
3639
return await getPostTypeStaticProps({slug: '/'}, 'search')

0 commit comments

Comments
 (0)