Skip to content

Commit 6c16662

Browse files
committed
use graphql to get site title in layout component
1 parent 6602a7c commit 6c16662

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/components/layout.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@ interface Props {
2020
children: React.ReactNode;
2121
}
2222

23-
const AppName = "Browser Actions";
24-
2523
const AppHeader = () => {
2624
const actionItems = ["setup-chrome", "setup-firefox", "setup-edge"];
2725
const extensionItems = ["release-chrome-extension", "release-firefox-addon"];
28-
const { icon } = useStaticQuery(graphql`
26+
const { icon, site } = useStaticQuery(graphql`
2927
query Icon {
3028
icon: file(relativePath: { eq: "icon.png" }) {
3129
childImageSharp {
3230
gatsbyImageData(width: 24, height: 24)
3331
}
3432
}
33+
site {
34+
siteMetadata {
35+
title
36+
}
37+
}
3538
}
3639
`);
3740

@@ -51,7 +54,7 @@ const AppHeader = () => {
5154
image={icon.childImageSharp.gatsbyImageData}
5255
alt="icon"
5356
/>
54-
<Text margin={{ left: "xsmall" }}>{AppName}</Text>
57+
<Text margin={{ left: "xsmall" }}>{site.siteMetadata.title}</Text>
5558
</Button>
5659
<Menu
5760
label="Open Source"

0 commit comments

Comments
 (0)