-
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 pull request #286 from boostcampwm-2024/Feature/fe/Chat-cleanBot
[Feature] 채팅 클린봇 모드 구현
- Loading branch information
Showing
6 changed files
with
164 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { RiRobot2Line } from 'react-icons/ri'; | ||
import { BsBoxArrowUpRight } from 'react-icons/bs'; | ||
import Toggle from '@components/common/Toggle'; | ||
|
||
interface ChatSettingsMenuProps { | ||
onClose?: () => void; | ||
position?: { | ||
top: string; | ||
right: string; | ||
}; | ||
cleanBotEnabled: boolean; | ||
onCleanBotChange: (enabled: boolean) => void; | ||
} | ||
|
||
function ChatSettingsMenu({ | ||
onClose, | ||
position = { top: '50px', right: '8px' }, | ||
cleanBotEnabled, | ||
onCleanBotChange, | ||
}: ChatSettingsMenuProps) { | ||
return ( | ||
<> | ||
<button aria-label="채팅세팅메뉴 닫기" type="button" className="z fixed inset-0" onClick={onClose} /> | ||
<div | ||
className="absolute z-50 min-w-[252px] rounded-lg border border-lico-gray-3 bg-lico-gray-5 p-1 shadow-lg" | ||
style={{ | ||
top: position.top, | ||
right: position.right, | ||
}} | ||
> | ||
<div className="flex w-full items-center justify-between rounded-md px-3 py-2 hover:bg-lico-gray-4"> | ||
<div className="flex items-center gap-3 font-bold text-lg text-lico-gray-2"> | ||
<RiRobot2Line size={18} /> | ||
<span>클린봇</span> | ||
</div> | ||
<Toggle checked={cleanBotEnabled} onChange={onCleanBotChange} /> | ||
</div> | ||
|
||
<button | ||
type="button" | ||
onClick={() => window.open('/chat-popup', '_blank', 'width=400,height=600')} | ||
className="flex w-full items-center justify-between rounded-md px-3 py-2 hover:bg-lico-gray-4" | ||
> | ||
<div className="flex items-center gap-3 font-bold text-lg text-lico-gray-2"> | ||
<BsBoxArrowUpRight size={16} /> | ||
<span>채팅창 팝업</span> | ||
</div> | ||
</button> | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
export default ChatSettingsMenu; |
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 @@ | ||
interface ToggleProps { | ||
checked: boolean; | ||
onChange: (checked: boolean) => void; | ||
className?: string; | ||
} | ||
|
||
function Toggle({ checked, onChange, className = '' }: ToggleProps) { | ||
return ( | ||
<button | ||
type="button" | ||
onClick={() => onChange(!checked)} | ||
className={`relative inline-flex h-6 w-14 items-center rounded-full transition-colors duration-200 ease-in-out ${checked ? 'bg-lico-orange-1' : 'bg-lico-gray-3'} ${className}`} | ||
> | ||
<div className="absolute inset-0 flex items-center justify-between px-1.5 font-medium text-xs"> | ||
<span | ||
className={`font-bold text-lico-gray-3 transition-opacity duration-200 ${checked ? 'opacity-100' : 'opacity-0'}`} | ||
> | ||
ON | ||
</span> | ||
<span | ||
className={`font-bold text-lico-gray-1 transition-opacity duration-200 ${checked ? 'opacity-0' : 'opacity-100'}`} | ||
> | ||
OFF | ||
</span> | ||
</div> | ||
<div | ||
className={`${ | ||
checked ? 'translate-x-8' : 'translate-x-1' | ||
} z-10 inline-block h-4 w-4 transform rounded-full bg-lico-gray-1 transition duration-300 ease-in-out`} | ||
/> | ||
</button> | ||
); | ||
} | ||
|
||
export default Toggle; |
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