-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into FE/feature/#78-채팅-컴포넌트-구현-및-사이드바-구현
- Loading branch information
Showing
18 changed files
with
213 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Icon } from '@iconify/react/dist/iconify.js'; | ||
|
||
interface CamBoxProps { | ||
videoRef: React.RefObject<HTMLVideoElement>; | ||
defaultImage: 'bg-ddung' | 'bg-sponge'; | ||
cameraConnected?: boolean; | ||
audioConnected?: boolean; | ||
} | ||
|
||
const CamBox = ({ videoRef, defaultImage, cameraConnected, audioConnected }: CamBoxProps) => { | ||
return ( | ||
<> | ||
<div className="flex relative"> | ||
<video | ||
className={`flex-1 rounded-[55px] w-320 max-w-full ${!cameraConnected && defaultImage}`} | ||
ref={videoRef} | ||
autoPlay | ||
playsInline | ||
/> | ||
<div className="absolute bottom-0 left-0 p-30 flex gap-5 text-white"> | ||
<Icon | ||
icon="pepicons-pop:camera" | ||
className={`rounded-full w-40 h-40 p-8 ${cameraConnected ? 'bg-black' : 'bg-gray-300'}`} | ||
/> | ||
<Icon | ||
icon="mingcute:mic-off-line" | ||
className={`rounded-full w-40 h-40 p-8 ${audioConnected ? 'bg-black' : 'bg-gray-300'}`} | ||
/> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default CamBox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './CamBox'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,71 @@ | ||
export interface OnChangeSelectFunction { | ||
import { useEffect, useRef, useState } from 'react'; | ||
|
||
import { Icon } from '@iconify/react'; | ||
|
||
export interface CustomSelectOptions { | ||
value: string; | ||
label: string; | ||
} | ||
|
||
export interface CustomSelectOptions extends OnChangeSelectFunction { | ||
selected?: boolean; | ||
} | ||
|
||
interface CustomSelectProps { | ||
width?: string; | ||
options: CustomSelectOptions[]; | ||
required?: boolean; | ||
autoFocus?: boolean; | ||
onChange?: ({ value, label }: OnChangeSelectFunction) => void; | ||
onChange?: ({ value, label }: CustomSelectOptions) => void; | ||
} | ||
|
||
export default function CustomSelect({ options, required, autoFocus, onChange }: CustomSelectProps) { | ||
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => { | ||
const { selectedIndex, options } = e.target; | ||
const { value, innerText } = options[selectedIndex]; | ||
export default function CustomSelect({ width, options, autoFocus, onChange }: CustomSelectProps) { | ||
const [opened, setOpened] = useState(false); | ||
const inputRef = useRef<HTMLInputElement>(null); | ||
const [selected, setSelected] = useState<CustomSelectOptions>({ value: '', label: '' }); | ||
|
||
useEffect(() => { | ||
if (options.length) setSelected(options[0]); | ||
}, [options]); | ||
|
||
onChange?.({ value, label: innerText }); | ||
const updateOption = (option: CustomSelectOptions) => { | ||
inputRef.current?.click(); | ||
if (option.value !== selected.value) { | ||
setSelected(option); | ||
onChange?.(option); | ||
} | ||
}; | ||
|
||
return ( | ||
<select | ||
className="select select-bordered w-full" | ||
required={required} | ||
autoFocus={autoFocus} | ||
onChange={handleChange} | ||
> | ||
{options.map(({ value, label, selected }) => ( | ||
<option | ||
key={value} | ||
value={value} | ||
selected={selected} | ||
<div className="relative"> | ||
<div className={`absolute collapse ${width ?? 'w-300'} min-h-48 bg-white border border-gray-300`}> | ||
<input | ||
title={selected.label} | ||
ref={inputRef} | ||
type="checkbox" | ||
className="min-h-48" | ||
onClick={() => setOpened(!opened)} | ||
/> | ||
<div className="collapse-title w-full leading-48 min-h-48 focus:outline-none flex justify-between py-0 px-15"> | ||
{selected.label} | ||
<Icon | ||
icon="teenyicons:down-solid" | ||
className="h-48 transition-transform" | ||
transform={`${opened ? 'rotate(180)' : 'rotate(0)'}`} | ||
/> | ||
</div> | ||
<div | ||
className={`collapse-content w-full`} | ||
autoFocus={autoFocus} | ||
> | ||
{label} | ||
</option> | ||
))} | ||
</select> | ||
{options.map(({ value, label }) => ( | ||
<p | ||
className={`display-medium14 ${selected.value === value && 'text-point font-bold'} | ||
leading-24 p-0 py-8 hover:bg-gray-100`} | ||
key={value} | ||
title={selected.label} | ||
onClick={() => updateOption({ value, label })} | ||
> | ||
{label} | ||
</p> | ||
))} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.