-
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.
feat: DF-102 | imrpove comment input (#104)
* feat: DF-102 | add multiline to post and comments * feat: DF-102 | add sending comment on enter * feat: DF-102 | fix comment send button on the bottom * feat: DF-102 | add emoji picker to post and comment creation * feat: DF-102 | fix lockfile conflict
- Loading branch information
Showing
10 changed files
with
201 additions
and
28 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,59 @@ | ||
import Picker from '@emoji-mart/react'; | ||
import SentimentSatisfiedOutlinedIcon from '@mui/icons-material/SentimentSatisfiedOutlined'; | ||
import { | ||
IconButton, | ||
IconButtonProps, | ||
Popover, | ||
PopoverProps, | ||
} from '@mui/material'; | ||
import { BaseEmoji } from 'emoji-mart/dist-es'; | ||
import { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export const EmojiButton = ({ | ||
onEmojiSelect, | ||
PopoverProps, | ||
...props | ||
}: { | ||
onEmojiSelect: (emoji: BaseEmoji) => void; | ||
PopoverProps?: Omit<PopoverProps, 'open'>; | ||
} & IconButtonProps) => { | ||
const { t, i18n } = useTranslation('translation', { keyPrefix: 'comment' }); | ||
|
||
const [anchorEl, setAnchorEl] = useState<HTMLButtonElement | null>(null); | ||
|
||
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => { | ||
setAnchorEl(event.currentTarget); | ||
}; | ||
|
||
const handleClose = () => { | ||
setAnchorEl(null); | ||
}; | ||
|
||
const open = Boolean(anchorEl); | ||
|
||
return ( | ||
<> | ||
<IconButton title={t('emoji') ?? ''} {...props} onClick={handleClick}> | ||
<SentimentSatisfiedOutlinedIcon /> | ||
</IconButton> | ||
<Popover | ||
open={open} | ||
onClose={handleClose} | ||
anchorEl={anchorEl} | ||
anchorOrigin={{ | ||
vertical: 'top', | ||
horizontal: 'center', | ||
}} | ||
transformOrigin={{ | ||
vertical: 'bottom', | ||
horizontal: 'left', | ||
}} | ||
PaperProps={{ style: { background: 'transparent' } }} | ||
{...PopoverProps} | ||
> | ||
<Picker locale={i18n.language} onEmojiSelect={onEmojiSelect} /> | ||
</Popover> | ||
</> | ||
); | ||
}; |
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,5 @@ | ||
import * as yup from 'yup'; | ||
|
||
export const commentValidator = yup.object().shape({ | ||
content: yup.string().required(), | ||
}); |
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