hatchways / team-penguin

World Chat Messenger allows users from completely different language backgrounds to converse with each other in their own language taking globalization to the next level.
2 stars 0 forks source link

able to switch between original and translated messages #87

Closed rjtbansal closed 4 years ago

rjtbansal commented 4 years ago

Issue #80

cch5ng commented 4 years ago

Hi Rajat, The Chat component should store the state for the language toggle switch and also the onChange handler. Both of those would be passed down as props to the ChatHeader component. The AntSwitch checked value would then use the language toggle state value. The AntSwitch onChange should change to something like:

onChange={(ev) => props.handleLanguageSwitchChange(ev.target.checked)}

(where handleLanguageSwitchChange was handleChange and also it makes sense to store the language toggle switch state as boolean as you already did in Chat)

Let me know if that does not make sense.

On Wed, Jun 10, 2020 at 6:32 PM Rajat Bansal notifications@github.com wrote:

@rjtbansal commented on this pull request.

In client/src/components/Chat/ChatHeader.js https://github.com/hatchways/team-penguin/pull/87#discussion_r438494375:

@@ -112,7 +113,7 @@ const ChatHeader = props => {

- Off + Original Language

I tried it but Im unable to flip the Switch if I try to store checked state in the parent and pass it down as props here. Pretty much all material UI samples are using states to toggle the switch. Im not sure how I could control it from above Chat component. Let me know if you have suggestions on this.

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/hatchways/team-penguin/pull/87#discussion_r438494375, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEI72EZAW5X32NSHAMOZNLRWAX37ANCNFSM4N25BSCA .

rjtbansal commented 4 years ago

Thanks @cch5ng for sharing your approach. Its cleaner now.