Skip to content

Commit

Permalink
update: ui
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikAgspert committed Sep 26, 2024
1 parent 6119bc8 commit 70f6bb3
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 47 deletions.
4 changes: 2 additions & 2 deletions src/components/CarouselComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ const CarouselComponent = ({ productData, defaultSheetData }) => {
sliderRef.current.slickPrev();
}
};
console.log("state carousel", productData)
console.log("state carousel", productData);

return (
<Stack position={"relative"} overflow={"hidden"} maxH={"80dvh"}>
<Stack position={"relative"} overflow={"hidden"}>
<Slider ref={sliderRef} {...settings}>
{productData?.map((dataset) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/generic/DraggableDrawer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default function DraggableDrawer({
}) {
const { height } = useWindowSize();
const level = React.useMemo(
() => [0, -(height - 80), -(height - 80)],
() => [0, -(height - 160), -(height - 160)],
[height]
);

Expand Down
22 changes: 11 additions & 11 deletions src/components/top-level/AddContentButton.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
/* eslint-disable react/prop-types */
import React, { useState } from 'react';
import React, { useState } from "react";
import {
IconButton,
Menu,
MenuButton,
MenuList,
MenuItem,
} from '@chakra-ui/react';
import { AddIcon } from '@chakra-ui/icons';
} from "@chakra-ui/react";
import { AddIcon } from "@chakra-ui/icons";



const AddContentButton= ({ onAdd }) => {
const AddContentButton = ({ onAdd }) => {
return (
<Menu>
<MenuButton
Expand All @@ -23,13 +21,15 @@ const AddContentButton= ({ onAdd }) => {
isRound
/>
<MenuList>
<MenuItem onClick={() => onAdd('360_image')}>360° Image</MenuItem>
<MenuItem onClick={() => onAdd('360_video')}>360° Video</MenuItem>
<MenuItem onClick={() => onAdd('Header')}>Header</MenuItem>
<MenuItem onClick={() => onAdd('Media Content')}>Media Content</MenuItem>
<MenuItem onClick={() => onAdd("360_image")}>360° Image</MenuItem>
<MenuItem onClick={() => onAdd("360_video")}>360° Video</MenuItem>
<MenuItem onClick={() => onAdd("header")}>Header</MenuItem>
<MenuItem onClick={() => onAdd("media_content")}>
Media Content
</MenuItem>
</MenuList>
</Menu>
);
};

export default AddContentButton;
export default AddContentButton;
17 changes: 12 additions & 5 deletions src/components/top-level/ContentBuilder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,17 @@ const ContentBuilder = () => {

return (
<Box display="flex" h="100%">
<Box width="50%" position="relative" borderWidth={2} h="100%">
<Box position="absolute" top={0} right={4}>
<Box
width="60%"
position="relative"
h="100dvh"
padding={10}
overflowY={"scroll"}
>
<Box position="absolute" top={10} right={4}>
<AddContentButton onAdd={addContent} />
</Box>

<VStack mt={24} spacing={4} align="stretch">
{contents.map((content) => (
<ContentCard
Expand All @@ -267,14 +274,14 @@ const ContentBuilder = () => {
</VStack>
</Box>

<Stack width="50%" borderWidth={2} h="100%" alignItems={"center"}>
<Stack width="40%" h="100%" alignItems={"center"}>
<Stack
w={"292px"}
h={"603px"}
my={5}
mt={50}
borderWidth={5}
borderColor={"black"}
borderRadius={30}
borderRadius={50}
overflow={"hidden"}
>
<CarouselComponent
Expand Down
93 changes: 66 additions & 27 deletions src/components/top-level/ContentCard.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import React, { useRef } from "react";
import { Box, IconButton, HStack, Heading, Switch, Input } from "@chakra-ui/react";
import {
Box,
IconButton,
HStack,
Heading,
Switch,
Input,
} from "@chakra-ui/react";
import { DeleteIcon, EditIcon } from "@chakra-ui/icons";
import MediaPicker from "./MediaPicker";

Expand All @@ -12,10 +19,12 @@ const ContentCard = ({ id, type, header, data, onUpdate, onDelete }) => {

const handleMediaChange = (newMedia) => {
onUpdate({
data: [{
...data[0],
image_url: newMedia[0]
}]
data: [
{
...data[0],
image_url: newMedia[0],
},
],
});
};

Expand All @@ -24,33 +33,63 @@ const ContentCard = ({ id, type, header, data, onUpdate, onDelete }) => {
<HStack justifyContent="space-between" mb={4}>
<Heading size="md">{type}</Heading>
<HStack>
<IconButton onClick={onDelete} aria-label="Delete" icon={<DeleteIcon />} size="sm" />
<Switch size="sm" onChange={() => onUpdate({ isActive: !data[0]?.isActive })} />
<IconButton
onClick={onDelete}
aria-label="Delete"
icon={<DeleteIcon />}
size="sm"
/>
<Switch
size="sm"
onChange={() => onUpdate({ isActive: !data[0]?.isActive })}
/>
</HStack>
</HStack>
<Box display="flex" alignItems="center" mb={4}>
<Input
placeholder="Header"
size="sm"
ref={inputRef}
value={header}
onChange={handleHeaderChange}

{type === "header" && (
<Box display="flex" alignItems="center" mb={4}>
<Input
placeholder="Header"
size="sm"
ref={inputRef}
value={header}
onChange={handleHeaderChange}
/>
<IconButton
aria-label="Edit"
icon={<EditIcon />}
size="sm"
ml={2}
onClick={() => inputRef.current.focus()}
/>
</Box>
)}

{type === "360_image" && (
<MediaPicker
type={type}
selectedImages={data[0]?.image_url ? [data[0].image_url] : []}
onImagesChange={handleMediaChange}
/>
<IconButton
aria-label="Edit"
icon={<EditIcon />}
size="sm"
ml={2}
onClick={() => inputRef.current.focus()}
)}

{type === "360_video" && (
<MediaPicker
type={type}
selectedImages={data[0]?.image_url ? [data[0].image_url] : []}
onImagesChange={handleMediaChange}
/>
)}

{type === "media_content" && (
<MediaPicker
type={type}
selectedImages={data[0]?.image_url ? [data[0].image_url] : []}
onImagesChange={handleMediaChange}
/>
</Box>
<MediaPicker
type={type}
selectedImages={data[0]?.image_url ? [data[0].image_url] : []}
onImagesChange={handleMediaChange}
/>
)}
</Box>
);
};

export default ContentCard;
export default ContentCard;
2 changes: 1 addition & 1 deletion src/components/top-level/content-builder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ContentBuilder from "./ContentBuilder";

const ContentBuilderPage = () => {
return (
<Box w="100dvw" minH="100dvh" borderWidth={2}>
<Box w="100dvw" minH="100dvh">
<ContentBuilder />
</Box>
);
Expand Down

0 comments on commit 70f6bb3

Please sign in to comment.