Skip to content

Commit

Permalink
feat: make social links configuration optional (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
wotnak authored Aug 9, 2023
1 parent 071225d commit 34090dc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions packages/gatsby-theme-adr/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,27 @@ exports.createPages = async ({ graphql, actions, reporter }) => {
createAdrDetail(createPage, graphql, reporter),
]);
};

// Define SiteMetadata type schema to allow for optional socialLinks.
exports.createSchemaCustomization = ({ actions }) => {
actions.createTypes(`
type Site {
siteMetadata: SiteMetadata!
}
type SiteMetadata {
siteUrl: String!
title: String!
description: String!
image: String!
menuLinks: [IconLink!]!
socialLinks: [IconLink!]
}
type IconLink {
name: String!
uri: String!
iconName: String
}
`);
};
2 changes: 1 addition & 1 deletion packages/gatsby-theme-adr/src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const Footer = ({ links, socialLinks }: FooterProps): ReactElement => {
))}
</nav>
<div className="xl:ml-6 ml-3 hidden sm:flex justify-center space-x-6">
{socialLinks.map(({ name, uri, iconName }) => {
{socialLinks?.map(({ name, uri, iconName }) => {
return (
<span key={name} className="text-gray-400 hover:text-gray-500">
<span className="sr-only">{name}</span>
Expand Down

0 comments on commit 34090dc

Please sign in to comment.