-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: message list component (#723)
- Loading branch information
Showing
4 changed files
with
319 additions
and
250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
|
||
const BadwordWarning = ({ id, setBadwordChoices, badwordChoices }) => { | ||
const hideBadword = (id) => { | ||
setBadwordChoices({ ...badwordChoices, [id]: 'hide' }); | ||
}; | ||
|
||
const showBadword = (id) => { | ||
setBadwordChoices({ ...badwordChoices, [id]: 'show' }); | ||
}; | ||
|
||
return ( | ||
<div className="dark:text-white text-black flex flex-col border-red border w-full rounded-r-md p-3"> | ||
<p>Your buddy is trying to send you a bad word</p> | ||
<div className="flex w-full gap-6"> | ||
<span | ||
onClick={() => showBadword(id)} | ||
className="text-sm cursor-pointer" | ||
> | ||
See | ||
</span> | ||
<span | ||
onClick={() => hideBadword(id)} | ||
className="text-red text-sm cursor-pointer" | ||
> | ||
Hide | ||
</span> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default BadwordWarning | ||
|
||
BadwordWarning.propTypes = { | ||
id: PropTypes.string.isRequired, | ||
setBadwordChoices: PropTypes.func.isRequired, | ||
badwordChoices: PropTypes.object.isRequired | ||
} |
Oops, something went wrong.