Skip to content

Commit 5f7dbc2

Browse files
authored
docs: add jsdoc for all the components throughout the code-base(#300)
* docs: add JSDoc comments to BlogSidebar and RelatedPostItem * docs(Calendar): add JSDoc for Calendar component with prop types and behavior description * docs: add JSDoc to BlogDashboard component * docs: add JSDoc to BlogIndex component with tag and blog layout info * docs: add JSDoc to blog layout component * docs: add JSDoc for DefaultLayoutNarrow layout component * docs: add JSDoc for DefaultLayout component * docs: add JSDoc to people layout component * docs: Add JSDoc for TagTemplate layout and byline helper * docs: add JSDoc to TagProjectPage component * docs: add JSDoc for UpdatesTagProjectPage component * docs: add JSDoc for UpdatesTagProjectPage component * docs: add JSDoc for SitemapLayout component * docs: add JSDoc for DropDownMenu component * docs: add JSDoc for LatestBlogsUpdates component * docs: add JSDoc for LatestProductBlogsUpdates component * docs: add JSDoc for LatestEntries component and helper functions * docs: add JSDoc for CovidWhatsappTSNEMap component * docs: add JSDoc for VaccineHesitancyClusterVisualization component * docs: add JSDoc for AllBlogindexLayout component * docs: add JSDoc for NarrowContentWrapper component * docs: add JSDoc for NarrowSection component * docs: add JSDoc for ContentpageLayout component * docs: add JSDoc for BlogHeadercard component * docs: add module-level JSDoc for corestyle component * docs: add JSDoc for CustomCodeBlock component * docs: add JSDoc for IconFeed SVG component * docs: add JSDoc for InlineCodeBlock component * docs: add JSDoc for MailchimpSubscribeForm component * docs: add JSDoc for MasonryLayout component * docs: add JSDoc for MasonryLayoutResponsive * docs: add jSDoc for peopleCard component * docs: add jSDoc for ResponsiveContributorGrid component * docs: add JSDoc for ResponsiveImage component * docs: add JSDoc for SEO component * docs: add jSDoc for simpleheader component * docs: add JSDoc for SmallFooter component * docs: add JSDoc for Spinner component * docs: add JSDoc for TagBubble component * docs: add JSDoc for tagBubbleBlog component * docs: add JSDoc for TattleLinks component * docs: add JSDoc for TattleLogo component * docs: add JSDoc for textstyle exports * docs: add JSDoc for TattleTheme object
1 parent c266333 commit 5f7dbc2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+478
-4
lines changed

src/components/BlogSidebar.jsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ import { Box, Heading, Text } from "grommet"
33
import { GatsbyImage } from "gatsby-plugin-image"
44
import { PlainLink } from "./atomic/TattleLinks"
55

6+
/**
7+
* RelatedPostItem displays a related blog post with an optional cover image,
8+
* the title (linked to the blog page), and an excerpt preview.
9+
*
10+
* @param {object} props - Component props
11+
* @param {object} props.post - The related blog post data
12+
* @param {string} props.post.title - Title of the blog post
13+
* @param {string} props.post.slug - URL slug for the blog post
14+
* @param {object} [props.post.coverImage] - Gatsby image object for the cover image
15+
* @param {string} [props.post.excerpt] - Short excerpt or summary of the blog post
16+
* @returns {JSX.Element} The rendered related post item
17+
*/
18+
619
const RelatedPostItem = ({ post }) => (
720
<Box
821
margin={{ bottom: "small" }}
@@ -37,6 +50,14 @@ const RelatedPostItem = ({ post }) => (
3750
</Box>
3851
)
3952

53+
/**
54+
* BlogSidebar displays a list of related blog posts in the sidebar.
55+
*
56+
* @param {object} props - Component props
57+
* @param {Array<object>} props.relatedPosts - Array of related blog post objects
58+
* @returns {JSX.Element} The rendered sidebar with related posts or a fallback message
59+
*/
60+
4061
const BlogSidebar = ({ relatedPosts }) => {
4162
return (
4263
<Box

src/components/Calendar.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
import React, { useEffect } from "react";
22
import * as d3 from "d3";
33

4+
5+
/**
6+
* Calendar component renders a heatmap-style calendar using D3.js
7+
* to visualize blog post frequency per day across multiple years.
8+
*
9+
* @component
10+
*
11+
* @param {Object} props - Component props.
12+
* @param {Object[]} props.data - Array of blog post objects.
13+
* @param {string} props.data[].date - ISO string of post date (e.g., "2025-01-17").
14+
*
15+
* @returns {JSX.Element} A responsive calendar heatmap of blog activity.
16+
*
17+
* @remarks
18+
* Uses `d3.scaleLinear` to color days by post count.
19+
* Clears previous SVGs before rendering new ones.
20+
* Shows tooltip on hover with post details.
21+
*/
22+
23+
24+
425
const Calendar = ({ data }) => {
526
const startYear = d3.min(data, (d) => new Date(d.date).getFullYear());
627
const endYear = d3.max(data, (d) => new Date(d.date).getFullYear());

src/components/DropDownMenu.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ import {
1111
**/
1212
import { NavigationLabel, Theme } from "./atomic/core-style"
1313

14+
/**
15+
* DropDownMenu renders a tooltip-style dropdown with navigational links.
16+
* It uses Grommet's Drop component, toggled by a button click, and closes on outside click or Escape key.
17+
*
18+
* @param {Object} props - Component props
19+
* @param {Array<{ id: string, target: string }>} props.options - Menu items with unique ID and target URL.
20+
* @param {string} props.title - Button label for triggering the dropdown.
21+
*
22+
* @returns {JSX.Element} The dropdown menu component.
23+
*/
24+
25+
1426
const DropDownMenu = ({ options, title }) => {
1527
const [fetching, setFetching] = useState(false)
1628
const [showToolTip, setShowToolTip] = useState(false)

src/components/LatestBlogsUpdates.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ import NarrowContentWrapper from "./atomic/layout/narrow-content-wrapper"
44
import { Box, Heading } from "grommet"
55
import { LatestEntries } from "./LatestEntries"
66

7+
/**
8+
* LatestBlogsUpdates component fetches and displays the latest blog posts and updates.
9+
*
10+
* - Uses Gatsby's useStaticQuery to retrieve blog and update data.
11+
* - Renders two sections: Latest Blogs and Latest Updates (if included later).
12+
*
13+
* @returns {JSX.Element} The rendered component showing the latest content.
14+
*/
15+
16+
717
export default function LatestBlogsUpdates() {
818
const data = useStaticQuery(graphql`
919
{

src/components/LatestEntries.jsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ import { Box, ResponsiveContext, Text } from "grommet"
33
import { PlainLink } from "./atomic/TattleLinks"
44
import { ExternalLink } from "react-feather"
55

6+
/**
7+
* Formats a date string to "MMM DD YYYY" format (e.g., "Jun 22 2025").
8+
*
9+
* @param {string|Date} date - The original date input.
10+
* @returns {string} Formatted date string.
11+
*/
12+
613
function formatDateLatestEntries(date) {
714
let dateString = new Date(date).toDateString("ind")
815
return dateString.split(" ").slice(1).join(" ")
@@ -11,6 +18,14 @@ function formatDateLatestEntries(date) {
1118
/**
1219
* @param {string} author
1320
*/
21+
22+
/**
23+
* Formats the author string to show abbreviated form (e.g., "John Doe et al.").
24+
*
25+
* @param {string} author - Full author name string, usually comma-separated.
26+
* @returns {string} Abbreviated author string.
27+
*/
28+
1429
function formatAuthor(author) {
1530
if (typeof author !== "string") return ""
1631
let firstDividerIndex = -1
@@ -31,6 +46,15 @@ function formatAuthor(author) {
3146
return author
3247
}
3348

49+
/**
50+
* Renders a list of blog or update entries based on the `isUpdate` flag.
51+
*
52+
* @param {Object} props
53+
* @param {Object[]} props.entries - Array of entry objects (blog/update).
54+
* @param {boolean} props.isUpdate - Determines if the list is for updates or blogs.
55+
* @returns {JSX.Element} Rendered list of entries.
56+
*/
57+
3458
// Component to Display latest entries of Blogs and Updates
3559
export function LatestEntries({ entries, isUpdate }) {
3660
const size = useContext(ResponsiveContext)

src/components/LatestProductBlogsUpdates.jsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ import { projectSlugMaker } from "../lib/project-slug-maker"
44
import { Box, Heading } from "grommet"
55
import { LatestEntries } from "./LatestEntries"
66

7+
/**
8+
* `LatestProductBlogsUpdates` renders a list of the latest blog posts and updates
9+
* related to the provided project names.
10+
*
11+
* @component
12+
* @param {Object} props - Component props
13+
* @param {string[]} props.projects - An array of project names as strings
14+
*
15+
* @returns {JSX.Element|null} A list of latest blogs and updates filtered by projects,
16+
* or `null` if no projects are provided.
17+
*/
18+
719
export function LatestProductBlogsUpdates({ projects }) {
820
//projects is an array of string
921
const data = useStaticQuery(graphql`

src/components/atomic/AppShell.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ import { PlainLink } from "./TattleLinks"
1515
* @function ContentPageLayout
1616
**/
1717

18+
/**
19+
* Renders the main layout shell for content pages, applying theme, layout width, and responsive design.
20+
* Includes a modal banner for highlighting key content (e.g., case studies).
21+
*
22+
* @param {Object} props
23+
* @param {React.ReactNode} props.children - The main content to render within the layout.
24+
* @param {string} [props.contentWidth] - Optional maximum width for the content area.
25+
* @returns {JSX.Element} Layout wrapper with modal and themed shell.
26+
*/
27+
1828
const MODAL_TEXT =
1929
"Read our New Case Study of the Information Chaos During India's Second Covid-19 Wave"
2030
const MODAL_PATH = "/articles/covid-whatsapp-public-groups/"

src/components/atomic/BlogHeaderCard.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@ import React from "react"
22
import { Box, Heading, Text } from "grommet"
33
import { byline } from "../default-blog-index-layout"
44

5+
/**
6+
* Renders the header section of a blog post card with title, author, date, and project info.
7+
*
8+
* @param {Object} props
9+
* @param {string} props.name - Blog post title.
10+
* @param {string} props.author - Author name.
11+
* @param {string} props.date - Publication date string.
12+
* @param {string} [props.project] - Optional project associated with the blog.
13+
* @returns {JSX.Element} Blog header card component.
14+
*/
15+
516
const BlogHeaderCard = ({ name, author, date, project }) => (
617
<Box margin={{ bottom: "small" }}>
718
<Box direction={"row"} align={"center"}>

src/components/atomic/IconFeed.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import React from "react"
22

3+
/**
4+
* SVG icon component for the feed symbol.
5+
*
6+
* @returns {JSX.Element} SVG feed icon.
7+
*/
8+
39
export default function IconFeed() {
410
return (
511
<svg

src/components/atomic/MailchimpSubscribeForm.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ const MAILCHIMP_URL =
1010
* @function MailchimpSubscribeForm
1111
**/
1212

13+
/**
14+
* Renders a custom email subscription form using Mailchimp.
15+
* Handles user input, form submission, and displays status messages.
16+
*
17+
* @returns {JSX.Element} Mailchimp subscribe form component.
18+
*/
19+
20+
1321
const SimpleForm = () => <MailchimpSubscribe url={MAILCHIMP_URL} />
1422

1523
const MailchimpSubscribeForm = () => {

0 commit comments

Comments
 (0)