diff --git a/src/component/VoidInput.ts b/src/component/VoidInput.ts
new file mode 100644
index 0000000..6c5198f
--- /dev/null
+++ b/src/component/VoidInput.ts
@@ -0,0 +1,9 @@
+import styled from "styled-components";
+
+const voidInput = styled.input`
+ display: none;
+ width: 0;
+ height: 0;
+`;
+
+export default voidInput;
\ No newline at end of file
diff --git a/src/component/template/component/VideoTemplate.tsx b/src/component/template/component/VideoTemplate.tsx
index 3887e4b..f12478d 100644
--- a/src/component/template/component/VideoTemplate.tsx
+++ b/src/component/template/component/VideoTemplate.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, {useRef} from 'react';
import Video from "@remote/value/Video";
import {Column} from "@designsystem/component/flexLayout";
import Text from "@designsystem/component/text";
@@ -14,16 +14,21 @@ function VideoTemplate(
video
}: VideoTemplateProps
) {
+ const isYoutubeUrl = video.videoUrl.startsWith('https://www.youtube.com');
return (
VIDEO
{video.videoTitle}
-
+ {isYoutubeUrl ? (
+
+ ) : (
+
+ )}
);
}
diff --git a/src/page/invitation/design/option/BaseMusicOption.tsx b/src/page/invitation/design/option/BaseMusicOption.tsx
index 5256ec3..3805bfd 100644
--- a/src/page/invitation/design/option/BaseMusicOption.tsx
+++ b/src/page/invitation/design/option/BaseMusicOption.tsx
@@ -12,6 +12,7 @@ import BaseMusic from "@remote/value/BaseMusic";
import fileApi from "@remote/api/FileApi";
import Music, {getMusicName} from "@remote/value/Music";
import LoadingOverlay from "@src/component/LoadingOverlay";
+import VoidInput from "@src/component/VoidInput";
type SelectMode = 'select' | 'direct';
const selectModeRecord: Record = {
@@ -82,7 +83,7 @@ function BaseMusicOption(
await audio.play();
}
}
-
+
const onClickPlayCustomMusic = async () => {
const audio = audioRef.current;
if (!audio) return;
@@ -133,7 +134,7 @@ function BaseMusicOption(
음원 파일 추가
최대 20MB MP3 파일만 가능
-
-
- onChange({...baseMusic, effect: checked})}
- label={'자동 재생'}
- />
- 브라우저 {/* TODO: Fix dummy text */}
-
+ onChange({...baseMusic, effect: checked})}
+ label={'자동 재생'}
+ />
@@ -219,12 +217,6 @@ const S = {
border-radius: 8px;
padding: 30px 0;
`,
- voidInput: styled.input`
- display: none;
- width: 0;
- height: 0;
- `,
-
}
export default BaseMusicOption;
\ No newline at end of file
diff --git a/src/page/invitation/design/option/GalleryOption.tsx b/src/page/invitation/design/option/GalleryOption.tsx
index 721dd53..37d7dd5 100644
--- a/src/page/invitation/design/option/GalleryOption.tsx
+++ b/src/page/invitation/design/option/GalleryOption.tsx
@@ -10,6 +10,7 @@ import fileApi from "@remote/api/FileApi";
import Text from "@designsystem/component/text";
import LoadingOverlay from "@src/component/LoadingOverlay";
import {DragDropContext, Draggable, Droppable, DropResult} from "react-beautiful-dnd";
+import VoidInput from "@src/component/VoidInput";
interface GalleryOptionProps {
imgList: string[];
@@ -72,7 +73,7 @@ function GalleryOption(
- (null);
+
+ const onChangeVideoUrl = (value: string) => {
+ if (value === '') {
+ onChange({...video, videoUrl: value});
+ return;
+ }
+
+ const urlPattern = /(?:https?:\/\/)?(?:www\.|m\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})/;
+ // const urlPattern = /(?:https?:\/\/)?(?:www\.|m\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\\w-]{11})/;
+ const match = value.match(urlPattern);
+
+ if (match && match[1]) {
+ const videoID = match[1];
+ onChange({...video, videoUrl: `https://www.youtube.com/embed/${videoID}`});
+ }
+ };
+
+ const uploadVideo = async (event: ChangeEvent) => {
+ const files = event.target.files;
+ if (!files) return;
+
+ const file = files[0];
+ if (!file) return;
+
+ setIsFetching(true);
+ const {data} = await fileApi.upload(file);
+
+ onChange({...video, videoUrl: data.url});
+ setIsFetching(false);
+ };
+
return (
@@ -37,13 +72,27 @@ function VideoOption(
onChange({...video, videoUrl: event.target.value})
+ onChange: event => onChangeVideoUrl(event.target.value)
}} placeholder={'유튜브 링크'} width={264}/>
{/* TODO */}
-
+
+
diff --git a/src/page/mypage/MyPage.tsx b/src/page/mypage/MyPage.tsx
index fe9a600..fb8004c 100644
--- a/src/page/mypage/MyPage.tsx
+++ b/src/page/mypage/MyPage.tsx
@@ -133,7 +133,7 @@ function MyPage() {
member.email
+ >{member.email}