diff --git a/src/app/Item.js b/src/app/Item.js
index b6199f4..80e68c9 100644
--- a/src/app/Item.js
+++ b/src/app/Item.js
@@ -45,6 +45,19 @@ export function Item({ item, itemNameId, outfitState, dispatchToOutfit }) {
);
}
+/**
+ * ItemSkeleton is a placeholder for when an Item is loading.
+ */
+function ItemSkeleton() {
+ return (
+
+
+
+
+
+ );
+}
+
/**
* ItemContainer is the outermost element of an `Item`.
*
@@ -205,18 +218,14 @@ export function ItemListContainer({ children }) {
}
/**
- * ItemListSkeleton is a loading placeholder for an `ItemListContainer` and the
- * `Item`s inside!
+ * ItemListSkeleton is a placeholder for when an ItemListContainer and its
+ * Items are loading.
*/
export function ItemListSkeleton({ count }) {
return (
{Array.from({ length: count }).map((_, i) => (
-
-
-
-
-
+
))}
);
diff --git a/src/app/ItemsPanel.js b/src/app/ItemsPanel.js
index c9d2bad..24a441c 100644
--- a/src/app/ItemsPanel.js
+++ b/src/app/ItemsPanel.js
@@ -16,6 +16,19 @@ import { CSSTransition, TransitionGroup } from "react-transition-group";
import { Delay, Heading1, Heading2 } from "./util";
import { Item, ItemListContainer, ItemListSkeleton } from "./Item";
+/**
+ * ItemsPanel shows the items in the current outfit, and lets the user toggle
+ * between them! It also shows an editable outfit name, to help set context.
+ *
+ * Note that this component provides an effective 1 unit of padding around
+ * itself, which is uncommon in this app: we usually prefer to let parents
+ * control the spacing!
+ *
+ * This is because Item has padding, but it's generally not visible; so, to
+ * *look* aligned with the other elements like the headings, the headings need
+ * to have extra padding. Essentially: while the Items _do_ stretch out the
+ * full width of the container, it doesn't look like it!
+ */
function ItemsPanel({ outfitState, loading, dispatchToOutfit }) {
const { zonesAndItems } = outfitState;
@@ -28,53 +41,23 @@ function ItemsPanel({ outfitState, loading, dispatchToOutfit }) {
/>
- {loading &&
- [1, 2, 3].map((i) => (
-
-
-
-
-
-
-
-
- ))}
- {!loading && (
+ {loading ? (
+ <>
+
+
+
+ >
+ ) : (
{zonesAndItems.map(({ zoneLabel, items }) => (
- {
- e.style.height = e.offsetHeight + "px";
- }}
- >
-
-
- {zoneLabel}
-
-
-
-
+
+
+
))}
)}
@@ -83,15 +66,24 @@ function ItemsPanel({ outfitState, loading, dispatchToOutfit }) {
);
}
-function ItemRadioList({ name, items, outfitState, dispatchToOutfit }) {
+/**
+ * ItemZoneGroup shows the items for a particular zone, and lets the user
+ * toggle between them.
+ *
+ * For each item, it renders a
)}
@@ -186,22 +191,65 @@ function OutfitHeading({ outfitState, dispatchToOutfit }) {
);
}
-function OutfitNameEditButton({ onRequestEdit }) {
+/**
+ * ItemZoneGroupTransitioner manages the fade-out transition when an
+ * ItemZoneGroup is removed. See react-transition-group docs for more info!
+ */
+function ItemZoneGroupTransitioner({ children }) {
return (
- {
+ e.style.height = e.offsetHeight + "px";
+ }}
>
-
-
+ {children}
+
+ );
+}
+
+/**
+ * ItemTransitioner manages the fade-out transition when an Item is removed.
+ * See react-transition-group docs for more info!
+ */
+function ItemTransitioner({ children }) {
+ return (
+ {
+ e.style.height = e.offsetHeight + "px";
+ }}
+ >
+ {children}
+
);
}