Skip to content

Commit 3b8ad86

Browse files
author
Alice Koreman
committed
update prop name to wrapLines
1 parent 4d69e81 commit 3b8ad86

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

pages/code-view/with-actions-button.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function CodeViewPage() {
1717
/>
1818
<CodeView
1919
lineNumbers={true}
20-
lineWrapping={true}
20+
wrapLines={true}
2121
actions={<Button ariaLabel="Copy code" iconName="copy"></Button>}
2222
content={`Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.`}
2323
/>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ export default function CodeViewPage() {
2323
/>
2424
<Box>Wrapping, no line numbers</Box>
2525
<CodeView
26-
lineWrapping={true}
26+
wrapLines={true}
2727
content={`Hello this is a short line.\nHello this is a long line. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\nHello this is another short line.`}
2828
/>
2929
<Box>Wrapping, line numbers</Box>
3030
<CodeView
31-
lineWrapping={true}
31+
wrapLines={true}
3232
lineNumbers={true}
3333
content={`Hello this is a short line.\nHello this is a long line. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.\nHello this is another short line.`}
3434
/>
3535
<Box>Full example with indentation and code highlighting</Box>
3636
<CodeView
37-
lineWrapping={true}
37+
wrapLines={true}
3838
lineNumbers={true}
3939
highlight={cppHighlight}
4040
content={`void UserQuery(map<string, vector<string> > &svmap) {\n string queryName;\n cout << "Please enter a family name you want to query: ";\n cin >> queryName;\n int i = 0;\n for (map<string, vector<string> >::iterator itr = svmap.begin(), mapEnd = svmap.end(); itr != mapEnd; ++itr) {\n i++;\n if (itr->first == queryName) {\n cout << "The " << itr->first << " family has " << itr->second.size() << " children: ";\n for (vector<string>::iterator itrvec = itr->second.begin(), vecEnd = itr->second.end(); itrvec != vecEnd; ++itrvec)\n cout << *itrvec << " ";\n break;\n }\n }\n if (i >= svmap.size())\n cout << "Sorry, the " << queryName << " family is not found." << endl;\n}`}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Defaults to \`false\`.
4242
"description": "Controls whether line-wrapping is enabled when content would overflow the component.
4343
Defaults to \`false\`.
4444
",
45-
"name": "lineWrapping",
45+
"name": "wrapLines",
4646
"optional": true,
4747
"type": "boolean",
4848
},

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ describe("CodeView", () => {
9191
});
9292

9393
test("sets nowrap class to line if linesWrapping false", () => {
94-
render(<CodeView lineWrapping={false} content={"Hello World"}></CodeView>);
94+
render(<CodeView wrapLines={false} content={"Hello World"}></CodeView>);
9595
const wrapper = createWrapper().findCodeView()!;
9696
const element = wrapper!.findContent().getElement();
9797
expect(element.outerHTML).toContain("code-line-nowrap");
9898
});
9999

100100
test("sets wrap class to line if linesWrapping true", () => {
101-
render(<CodeView lineWrapping={true} content={"Hello World"}></CodeView>);
101+
render(<CodeView wrapLines={true} content={"Hello World"}></CodeView>);
102102
const wrapper = createWrapper().findCodeView()!;
103103
const element = wrapper!.findContent().getElement();
104104
expect(element.outerHTML).toContain("code-line-wrap");

src/code-view/interfaces.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface CodeViewProps {
2929
*
3030
* Defaults to `false`.
3131
*/
32-
lineWrapping?: boolean;
32+
wrapLines?: boolean;
3333

3434
/**
3535
* An optional slot to display a button to enable users to perform actions, such as copy or download the code snippet.

src/code-view/internal.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function InternalCodeView({
3535
content,
3636
actions,
3737
lineNumbers,
38-
lineWrapping,
38+
wrapLines,
3939
highlight,
4040
ariaLabel,
4141
ariaLabelledby,
@@ -70,7 +70,7 @@ export function InternalCodeView({
7070
className={clsx(
7171
styles["code-table"],
7272
actions && styles["code-table-with-actions"],
73-
lineWrapping && styles["code-table-with-line-wrapping"],
73+
wrapLines && styles["code-table-with-line-wrapping"],
7474
)}
7575
>
7676
<colgroup>
@@ -93,7 +93,7 @@ export function InternalCodeView({
9393
<span
9494
className={clsx(
9595
codeElement.props.className,
96-
lineWrapping ? styles["code-line-wrap"] : styles["code-line-nowrap"],
96+
wrapLines ? styles["code-line-wrap"] : styles["code-line-nowrap"],
9797
)}
9898
>
9999
{child}

0 commit comments

Comments
 (0)