diff --git a/src/options/ListRenderer.js b/src/options/ListRenderer.js
index c5ffc79..1014410 100644
--- a/src/options/ListRenderer.js
+++ b/src/options/ListRenderer.js
@@ -1,14 +1,14 @@
// @flow
import React from "react";
-import StringRenderer from "./StringRenderer";
import type { ListOption } from "../types/types";
-import PlainTextRenderer from "./PlainTextRenderer";
+import AbstractRenderer from "./AbstractRenderer";
type Props = {
options: ListOption,
onChange: any,
- onNavigate: any
+ onNavigate: any,
+ depth: number
};
/**
@@ -17,66 +17,36 @@ type Props = {
* with the number of items in the nested object is displayed instead
* that the user can click/navigate into.
*/
-const ListRenderer = ({ options, onChange, onNavigate }: Props) => {
+const ListRenderer = ({ options, onChange, onNavigate, depth }: Props) => {
+ const listItemCount = options.items.length;
return (
-
- {options.items.map(option => {
- switch (option.type) {
- case "List":
- const listItemCount = option.items.length;
- return (
-
- );
- case "Record":
- const recordCount = option.fields.length;
- return (
-
- );
- case "String":
- return (
-
+ {depth === options.path.length ? (
+
+ {options.items.map(option => (
+ -
+
- );
- case "PlainText":
- return (
-
- );
- default:
- throw Error(`Unknown option: ${option.type}`);
- }
- })}
-
+
+ ))}
+
+ ) : (
+
+ )}
+ >
);
};