Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/components/entity/AnimationResource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { StoreContext } from "@/store";
import { observer } from "mobx-react";
import { MdDelete } from "react-icons/md";
import {
Animation,
TAnimation,
FadeInAnimation,
FadeOutAnimation,
SlideDirection,
Expand All @@ -22,7 +22,7 @@ const ANIMATION_TYPE_TO_LABEL: Record<string, string> = {
breath: "Breath",
};
export type AnimationResourceProps = {
animation: Animation;
animation: TAnimation;
};
export const AnimationResource = observer((props: AnimationResourceProps) => {
const store = React.useContext(StoreContext);
Expand All @@ -40,13 +40,13 @@ export const AnimationResource = observer((props: AnimationResourceProps) => {
</button>
</div>
{props.animation.type === "fadeIn" ||
props.animation.type === "fadeOut" ? (
props.animation.type === "fadeOut" ? (
<FadeAnimation
animation={props.animation as FadeInAnimation | FadeOutAnimation}
/>
) : null}
{props.animation.type === "slideIn" ||
props.animation.type === "slideOut" ? (
props.animation.type === "slideOut" ? (
<SlideAnimation
animation={props.animation as SlideInAnimation | SlideOutAnimation}
/>
Expand Down
17 changes: 9 additions & 8 deletions src/components/panels/AudioResourcesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ export const AudioResourcesPanel = observer(() => {
};
return (
<>
<div className="text-sm px-[16px] pt-[16px] pb-[8px] font-semibold">
Audios
</div>

{store.audios.map((audio, index) => {
return <AudioResource key={audio} audio={audio} index={index} />;
})}
<UploadButton
accept="audio/mp3,audio/*"
className="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold text-center mx-2 py-2 px-4 rounded cursor-pointer"
onChange={handleFileChange}
/>
<div className="flex justify-center mt-4">
<UploadButton
accept="audio/mp3,audio/*"
className="bg-green-400 w-full max-w-[260px] hover:bg-green-500 text-gray-800 font-bold text-center mx-2 py-2 px-4 rounded cursor-pointer"
onChange={handleFileChange}
name="Audios"
/>
</div>
</>
);
});
15 changes: 7 additions & 8 deletions src/components/panels/ImageResourcesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@ export const ImageResourcesPanel = observer(() => {
};
return (
<>
<div className="text-sm px-[16px] pt-[16px] pb-[8px] font-semibold">
Images
</div>
<UploadButton
accept="image/*"
className="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold text-center mx-2 py-2 px-4 rounded cursor-pointer"
onChange={handleFileChange}
/>
<div className="flex justify-center mt-4">
<UploadButton
accept="image/*"
className="bg-green-400 w-full max-w-[260px] hover:bg-green-500 text-gray-800 font-bold text-center mx-2 py-2 px-4 rounded cursor-pointer"
onChange={handleFileChange}
name="Images"
/></div>
<div >
{store.images.map((image, index) => {
return <ImageResource key={image} image={image} index={index} />;
Expand Down
17 changes: 9 additions & 8 deletions src/components/panels/VideoResourcesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,18 @@ export const VideoResourcesPanel = observer(() => {
};
return (
<>
<div className="text-sm px-[16px] pt-[16px] pb-[8px] font-semibold">
Videos
</div>

{store.videos.map((video, index) => {
return <VideoResource key={video} video={video} index={index} />;
})}
<UploadButton
accept="video/mp4,video/x-m4v,video/*"
className="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold text-center mx-2 py-2 px-4 rounded cursor-pointer"
onChange={handleFileChange}
/>
<div className="flex justify-center mt-4">
<UploadButton
accept="video/mp4,video/x-m4v,video/*"
className="bg-green-400 w-full max-w-[260px] hover:bg-green-500 text-gray-800 font-bold text-center mx-2 py-2 px-4 rounded cursor-pointer"
onChange={handleFileChange}
name={'Videos'}
/>
</div>
</>
);
});
5 changes: 4 additions & 1 deletion src/components/shared/UploadButton.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Image from "next/image";
export type UploadButtonProps = {
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
className?: string;
accept: string;
name: string
};
export const UploadButton = (props: UploadButtonProps) => {
return (
Expand All @@ -13,7 +15,8 @@ export const UploadButton = (props: UploadButtonProps) => {
className="hidden"
onChange={props.onChange}
/>
Upload
<p className="flex items-center justify-center"> {props.name}
</p>
</label>
);
};
Loading