Skip to content

Commit 2f64ecf

Browse files
Apply review comment
1 parent 870d425 commit 2f64ecf

6 files changed

Lines changed: 11 additions & 11 deletions

File tree

packages/e2e/src/authors.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { expect, test } from "@playwright/test";
22
import { launchViewer, uploadFile } from "./support/upload";
33

4-
test("document authors section", async ({ page }) => {
4+
test("authors section", async ({ page }) => {
55
await page.goto("/");
66

77
await uploadFile(page, "document.tei");

packages/react-tei/src/authors/tags/Address.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { Typography } from "@mui/material";
22
import { DebugTag } from "../../debug/DebugTag";
33
import type { ComponentProps } from "../../tags/type";
44
import { Value } from "../../tags/Value";
5-
import { useValueSeparator } from "./useValueSeparator";
5+
import { useJoinValues } from "./useJoinValues";
66

77
export function Address({ data }: ComponentProps) {
8-
const value = useValueSeparator(data.value, ", ");
8+
const value = useJoinValues(data.value, ", ");
99

1010
if (!value.length) {
1111
return (

packages/react-tei/src/authors/tags/Affiliation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import { useId } from "react";
44
import { DebugTag } from "../../debug/DebugTag";
55
import type { ComponentProps } from "../../tags/type";
66
import { Value } from "../../tags/Value";
7-
import { useValueSeparator } from "./useValueSeparator";
7+
import { useJoinValues } from "./useJoinValues";
88

99
export function Affiliation({ data }: ComponentProps) {
1010
const id = useId();
11-
const value = useValueSeparator(data.value, ", ");
11+
const value = useJoinValues(data.value, ", ");
1212

1313
if (!value.length) {
1414
return (

packages/react-tei/src/authors/tags/Author.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IS_DEBUG } from "../../debug/debug.const";
77
import type { DocumentJson } from "../../parser/document";
88
import type { ComponentProps } from "../../tags/type";
99
import { Value } from "../../tags/Value";
10-
import { useValueSeparator } from "./useValueSeparator";
10+
import { useJoinValues } from "./useJoinValues";
1111

1212
const AFFILIATION_TAG = "affiliation";
1313

@@ -29,7 +29,7 @@ export function Author({ data }: ComponentProps) {
2929
return valueArray.filter((item) => item.tag !== AFFILIATION_TAG);
3030
}, [data.attributes, valueArray]);
3131

32-
const nameWithSpacing = useValueSeparator(name, " ");
32+
const nameWithSpacing = useJoinValues(name, " ");
3333

3434
const affiliations = useMemo(() => {
3535
return valueArray.filter((item) => item.tag === AFFILIATION_TAG);

packages/react-tei/src/authors/tags/useValueSeparator.spec.tsx renamed to packages/react-tei/src/authors/tags/useJoinValues.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { describe, expect, it } from "vitest";
22
import { renderHook } from "vitest-browser-react";
3-
import { useValueSeparator } from "./useValueSeparator";
3+
import { useJoinValues } from "./useJoinValues";
44

5-
describe("useValueSeparator", () => {
5+
describe("useJoinValues", () => {
66
it("should add text tags with separator between values", async () => {
77
const { result } = await renderHook(() =>
8-
useValueSeparator(
8+
useJoinValues(
99
[
1010
{ tag: "orgName", value: [{ tag: "#text", value: "University A" }] },
1111
{ tag: "orgName", value: [{ tag: "#text", value: "Institute B" }] },

packages/react-tei/src/authors/tags/useValueSeparator.tsx renamed to packages/react-tei/src/authors/tags/useJoinValues.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useMemo } from "react";
22
import type { DocumentJsonValue } from "../../parser/document";
33

4-
export function useValueSeparator(value: DocumentJsonValue, separator: string) {
4+
export function useJoinValues(value: DocumentJsonValue, separator: string) {
55
return useMemo(() => {
66
if (!Array.isArray(value)) {
77
return [];

0 commit comments

Comments
 (0)