fix: make functions expressions and imports order

This commit is contained in:
RadoslavDimchev 2024-01-23 19:02:47 +02:00
parent 4d145760ec
commit 0d8f60163a
2 changed files with 12 additions and 9 deletions

View File

@ -2,11 +2,12 @@ import { useEffect, useRef, useState } from 'react'
import { XStack, YStack } from 'tamagui'
import { Avatar, Text } from '@status-im/components'
import { ReactionIcon } from '@status-im/icons'
import './CreateAvatar.css'
import { Emoji, EmojiClickData, EmojiStyle } from 'emoji-picker-react'
import LabelInputField from '../LabelInputField'
import ColorPicker from '../ColorPicker/ColorPicker'
import EmojiPickerDialog from '../EmojiPickerDialog'
import { Emoji, EmojiClickData, EmojiStyle } from 'emoji-picker-react'
import './CreateAvatar.css'
const CreateAvatar = () => {
const [chosenColor, setChosenColor] = useState('#2A4AF5')
@ -14,16 +15,17 @@ const CreateAvatar = () => {
const [selectedEmoji, setSelectedEmoji] = useState<string>('1f600')
const emojiRef = useRef<HTMLDivElement | null>(null)
function changeEmoji(emojiData: EmojiClickData) {
const changeEmoji = (emojiData: EmojiClickData) => {
setSelectedEmoji(emojiData.unified)
}
useEffect(() => {
function handleClickOutside(event: any) {
if (emojiRef.current && !emojiRef.current.contains(event.target)) {
setIsEmojiDialogOpen(false)
}
const handleClickOutside = (event: any) => {
if (emojiRef.current && !emojiRef.current.contains(event.target)) {
setIsEmojiDialogOpen(false)
}
}
useEffect(() => {
document.addEventListener('mousedown', handleClickOutside)
return () => {
document.removeEventListener('mousedown', handleClickOutside)

View File

@ -14,7 +14,7 @@ type EmojiPickerProps = {
changeEmoji: (emojiData: EmojiClickData) => void
}
function EmojiPickerDialog({ emojiStyle, changeEmoji }: EmojiPickerProps) {
const EmojiPickerDialog = ({ emojiStyle, changeEmoji }: EmojiPickerProps) => {
return (
<Stack position="absolute" zIndex={1} left={100} top={-150}>
<EmojiPicker
@ -54,4 +54,5 @@ function EmojiPickerDialog({ emojiStyle, changeEmoji }: EmojiPickerProps) {
</Stack>
)
}
export default EmojiPickerDialog