Skip to content

Commit

Permalink
Finished integrating flexible-space with flexible-pane
Browse files Browse the repository at this point in the history
  • Loading branch information
almamarie committed Jan 10, 2023
1 parent 7af3ffd commit 97a06cc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
12 changes: 10 additions & 2 deletions components/all-items/SingleItem.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
import styles from "./SingleItem.module.css";
import { Item } from "../../public/utils/types";

import SingleItemCard from "../ui/cart/SingleItemCard";
import { useAppDispatch } from "../../store";
type Item = { name: string };
const SingleItem: React.FC<{ item: Item }> = (props) => {
const dispatch = useAppDispatch();

return (
<SingleItemCard>
<SingleItemCard
// onClickHandler={() => {
// dispatch();
// }}
>
<div className={styles.card}>
<p className={styles.name}>{props.item.name}</p>
<svg
Expand Down
2 changes: 1 addition & 1 deletion components/details-pane/CurrentItemDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useAppSelector } from "../../store";
import { DUMMY_ITEMS } from "../../store/items";
import Button from "../ui/buttons/Button";
import styles from "./ItemDetails.module.css";
import styles from "./CurrentItemDetails.module.css";

const CurrentItemDetails = () => {
// fetch item id from store
Expand Down
3 changes: 2 additions & 1 deletion components/layout/DetailsPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import CurrentCart from "../details-pane/CurrentCart";
import ItemDetails from "../details-pane/CurrentItemDetails";
import styles from "./DetailsPane.module.css";
import { RootState, useAppSelector } from "../../store";
import CurrentItemDetails from "../details-pane/CurrentItemDetails";

const DetailsPane = () => {
const currentShowing = useAppSelector((state: RootState) => {
Expand All @@ -15,7 +16,7 @@ const DetailsPane = () => {
}

if (currentShowing === "show selected item") {
return <ItemDetails />;
return <CurrentItemDetails />;
}

if (currentShowing === "show current cart") {
Expand Down
4 changes: 2 additions & 2 deletions store/details-pane-slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ interface DetailsPaneState {
}

const initialState: DetailsPaneState = {
currentShowing: "add new item",
currentShowing: "show selected item",
cartId: "001",
itemId: "001",
itemId: "banana",
};

const detailsPaneSlice = createSlice({
Expand Down

0 comments on commit 97a06cc

Please sign in to comment.