Skip to content

Commit f922ff1

Browse files
committed
Never mind, change API a little bit more.
1 parent a2dc39c commit f922ff1

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

pages/code-view/with-line-numbers.page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { CodeView, CodeViewProps } from "../../lib/components";
77
import { ScreenshotArea } from "../screenshot-area";
88

99
const i18nStrings: CodeViewProps.I18nStrings = {
10-
lineLabel: `Line number`,
11-
contentLabel: `Content`,
10+
lineNumberLabel: `Line number`,
11+
codeLabel: `Code`,
1212
};
1313

1414
export default function CodeViewPage() {

src/__tests__/__snapshots__/documenter.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ exports[`definition for 'code-view' matches the snapshot 1`] = `
4848
"name": "CodeViewProps.I18nStrings",
4949
"properties": [
5050
{
51-
"name": "contentLabel",
51+
"name": "codeLabel",
5252
"optional": true,
5353
"type": "string",
5454
},
5555
{
56-
"name": "lineLabel",
56+
"name": "lineNumberLabel",
5757
"optional": true,
5858
"type": "string",
5959
},

src/code-view/__tests__/code-view.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ describe("CodeView", () => {
3030
render(
3131
<CodeView
3232
lineNumbers={true}
33-
i18nStrings={{ lineLabel: "Line number", contentLabel: "Content" }}
33+
i18nStrings={{ lineNumberLabel: "Line number", codeLabel: "Code" }}
3434
content={`# Hello World\n\nThis is a markdown example.`}
3535
/>,
3636
);

src/code-view/interfaces.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export interface CodeViewProps {
5050

5151
export namespace CodeViewProps {
5252
export interface I18nStrings {
53-
lineLabel?: string;
54-
contentLabel?: string;
53+
lineNumberLabel?: string;
54+
codeLabel?: string;
5555
}
5656
}

src/code-view/internal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function InternalCodeView({
4848
const darkMode = useCurrentMode(containerRef) === "dark";
4949

5050
const regionProps = ariaLabel || ariaLabelledby ? { role: "region" } : {};
51-
const accessibleLineNumbers = lineNumbers && i18nStrings?.lineLabel && i18nStrings?.contentLabel;
51+
const accessibleLineNumbers = lineNumbers && i18nStrings?.lineNumberLabel && i18nStrings?.codeLabel;
5252

5353
// Create tokenized React nodes of the content.
5454
const code = highlight ? highlight(content) : textHighlight(content);
@@ -82,8 +82,8 @@ export function InternalCodeView({
8282
{accessibleLineNumbers && (
8383
<thead className={styles["screenreader-only"]}>
8484
<tr>
85-
{lineNumbers && <th>{i18nStrings.lineLabel}</th>}
86-
<th>{i18nStrings.contentLabel}</th>
85+
{lineNumbers && <th>{i18nStrings.lineNumberLabel}</th>}
86+
<th>{i18nStrings.codeLabel}</th>
8787
</tr>
8888
</thead>
8989
)}

0 commit comments

Comments
 (0)