Skip to content

Commit 8be3b27

Browse files
authored
chore: identifiers tables (#647)
1 parent a721ca9 commit 8be3b27

2 files changed

Lines changed: 6 additions & 35 deletions

File tree

src/components/content/SearchableTable.tsx

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Button, SearchInput } from "@sumup-oss/circuit-ui";
2-
import { useEffect, useMemo, useRef, useState } from "react";
1+
import { SearchInput } from "@sumup-oss/circuit-ui";
2+
import { useMemo, useRef, useState } from "react";
33

44
import styles from "./SearchableTable.module.css";
55
import Table, { type TableColumn } from "./Table";
@@ -10,20 +10,16 @@ type Props = {
1010
columns: SearchableTableColumn[];
1111
rows: Record<string, unknown>[];
1212
searchPlaceholder?: string;
13-
maxHeight?: number;
1413
tableLayout?: "fixed" | "auto";
1514
};
1615

1716
const SearchableTable = ({
1817
columns,
1918
rows,
2019
searchPlaceholder = "Search",
21-
maxHeight = 420,
2220
tableLayout = "fixed",
2321
}: Props) => {
2422
const [searchQuery, setSearchQuery] = useState("");
25-
const [isExpanded, setIsExpanded] = useState(false);
26-
const [canExpand, setCanExpand] = useState(false);
2723
const wrapperRef = useRef<HTMLDivElement>(null);
2824

2925
const normalizedQuery = searchQuery.trim().toLowerCase();
@@ -47,19 +43,6 @@ const SearchableTable = ({
4743
);
4844
}, [columns, normalizedQuery, rows]);
4945

50-
useEffect(() => {
51-
const container = wrapperRef.current;
52-
if (!container) {
53-
return;
54-
}
55-
56-
setCanExpand(container.scrollHeight > maxHeight);
57-
}, [filteredRows, maxHeight]);
58-
59-
useEffect(() => {
60-
setIsExpanded(false);
61-
}, [searchQuery]);
62-
6346
return (
6447
<section className={`${styles.section} not-content`}>
6548
<SearchInput
@@ -75,20 +58,8 @@ const SearchableTable = ({
7558
rows={filteredRows}
7659
tableLayout={tableLayout}
7760
containerRef={wrapperRef}
78-
maxHeight={isExpanded ? undefined : `${maxHeight}px`}
61+
maxHeight="420px"
7962
/>
80-
81-
{canExpand ? (
82-
<Button
83-
type="button"
84-
variant="tertiary"
85-
size="s"
86-
onClick={() => setIsExpanded((value) => !value)}
87-
className={styles.button}
88-
>
89-
{isExpanded ? "Collapse" : "Expand to view all"}
90-
</Button>
91-
) : null}
9263
</section>
9364
);
9465
};

src/content/docs/tools/glossary/merchant.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ suffix identifies the specific type of identifier.
3737
{ key: "icon", label: "" },
3838
{ key: "country", label: "Country", nowrap: true },
3939
{ key: "name", label: "Name", minWidth: "18rem" },
40-
{ key: "ref", label: "Reference", nowrap: true },
40+
{ key: "ref", label: "Reference", nowrap: true, as: "code" },
4141
]}
4242
rows={[
4343
{
@@ -613,7 +613,7 @@ Legal types are of the pattern `{country_code}.{identifier_type}`. The prefix in
613613
{ key: "icon", label: "" },
614614
{ key: "country", label: "Country", nowrap: true },
615615
{ key: "description", label: "Description", minWidth: "18rem" },
616-
{ key: "ref", label: "Reference", nowrap: true },
616+
{ key: "ref", label: "Reference", nowrap: true, as: "code" },
617617
]}
618618
rows={[
619619
{
@@ -2901,7 +2901,7 @@ Persons can have various roles within a merchant:
29012901
{ key: "icon", label: "" },
29022902
{ key: "country", label: "Country", nowrap: true },
29032903
{ key: "name", label: "Name", minWidth: "18rem" },
2904-
{ key: "ref", label: "Reference", nowrap: true },
2904+
{ key: "ref", label: "Reference", nowrap: true, as: "code" },
29052905
]}
29062906
rows={[
29072907
{

0 commit comments

Comments
 (0)