Skip to content

Commit a642071

Browse files
committed
Add usage to action page
1 parent 9b08472 commit a642071

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/components/code.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Box } from "grommet";
2+
import type * as React from "react";
3+
4+
interface Props {
5+
children: React.ReactNode;
6+
}
7+
8+
export const CodeBlock: React.FC<Props> = ({ children }) => (
9+
<Box
10+
background="light-2"
11+
pad={{ horizontal: "medium", vertical: "small" }}
12+
round="small"
13+
>
14+
<pre>
15+
<code>{children}</code>
16+
</pre>
17+
</Box>
18+
);

src/templates/action.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import type { HeadFC, PageProps } from "gatsby";
22
import {
3-
Anchor,
43
Box,
54
Heading,
65
NameValueList,
@@ -10,6 +9,7 @@ import {
109
Paragraph,
1110
} from "grommet";
1211
import { Actions as ActionsIcon, Github as GithubIcon } from "grommet-icons";
12+
import { CodeBlock } from "../components/code";
1313
import { Layout } from "../components/layout";
1414
import { ExternalLink } from "../components/link";
1515
import { Seo } from "../components/seo";
@@ -26,6 +26,8 @@ interface Props {
2626

2727
const ActionPage: React.FC<PageProps & Props> = ({ pageContext }) => {
2828
const { name, action } = pageContext;
29+
const usage = `- uses: browser-actions/${name}@latest`;
30+
2931
return (
3032
<Layout>
3133
<Page kind="narrow" margin={{ vertical: "xlarge" }}>
@@ -52,6 +54,9 @@ const ActionPage: React.FC<PageProps & Props> = ({ pageContext }) => {
5254
{action.description}
5355
</Paragraph>
5456

57+
<Heading level="2">Usage</Heading>
58+
<CodeBlock>{usage}</CodeBlock>
59+
5560
<Heading level="2">Inputs</Heading>
5661
{action.inputs ? (
5762
<NameValueList>

0 commit comments

Comments
 (0)