Skip to content

Commit 3e138c9

Browse files
committed
feat: added comparator diff in Collapsable
1 parent 7b12675 commit 3e138c9

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/components/Collapsable.tsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1+
import { ComparatorDiff } from "./ComparatorDiff";
12
import "../styles/Collapsable.css";
23

3-
const Collapsible = ({ details }: any) => {
4+
const Collapsible = (props: any) => {
45
return (
56
<>
67
<details>
78
<summary>Details</summary>
89
<div className="details__wrapper content">
910
<ul>
10-
{details.map((el: string, i: number) => (
11-
<li key={i}>{el}</li>
12-
))}
11+
{props.details.map((el: string, i: number) =>
12+
props.prevDetails && props.prevDetails[i] ? (
13+
<li key={i}>
14+
<ComparatorDiff
15+
previous={props.prevDetails[i]}
16+
current={el}
17+
/>
18+
</li>
19+
) : (
20+
<li key={i}>{el}</li>
21+
),
22+
)}
1323
</ul>
1424
</div>
1525
</details>
1626
</>
1727
);
1828
};
29+
1930
export default Collapsible;

0 commit comments

Comments
 (0)