Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: custom user input buttons #2314

Merged
merged 11 commits into from
Mar 23, 2023
Merged

Conversation

Iru89
Copy link
Contributor

@Iru89 Iru89 commented Mar 15, 2023

Description

This PR adds the feature to define in the bot the icons to send an emoji and attach a file as you can do with the send text button by declaring a custom component

Context

I didn't want to modify more things but I think the css should also be refactored to reduce the number of nested divs with fixed paddings to separate the elements. As you can see in the image the custom buttons are not well aligned.

Approach taken / Explain the design

To document / Usage example

Before change icons
Captura de Pantalla 2023-03-15 a las 12 10 45
After change icons
Captura de Pantalla 2023-03-15 a las 12 11 40

You can define custom components for each button like this
Captura de Pantalla 2023-03-15 a las 12 32 19

Testing

The pull request...

  • has unit tests
  • has integration tests
  • doesn't need tests because... [provide a description]

Copy link
Contributor

@vanbasten17 vanbasten17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🤟

packages/botonic-react/src/webchat/webchat.jsx Outdated Show resolved Hide resolved
packages/botonic-react/src/webchat/webchat.jsx Outdated Show resolved Hide resolved
packages/botonic-react/src/webchat/webchat.jsx Outdated Show resolved Hide resolved
Copy link
Contributor

@asastre asastre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @vanbasten17 comments and also I suggest to move the custom rendering logic to the webchat.jsx file (the same way it's done with the SendButton component), let me know if it make sense to you.

@Iru89 Iru89 requested review from vanbasten17 and asastre March 18, 2023 15:51
@Iru89 Iru89 force-pushed the feat/custom-user-input-buttons branch from 498aff5 to 206d926 Compare March 20, 2023 12:10
@Iru89
Copy link
Contributor Author

Iru89 commented Mar 20, 2023

in the commit I have removed the IconContainer that is only used in this button what really changes is the padding but I think it still looks good because I have also changed the styled component UserInputContainer in de next commit

Copy link
Contributor

@vanbasten17 vanbasten17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go for it 🚀

@vanbasten17 vanbasten17 force-pushed the feat/custom-user-input-buttons branch from 1410961 to 636f127 Compare March 23, 2023 10:20
@vanbasten17 vanbasten17 merged commit 49582e1 into master-lts Mar 23, 2023
@vanbasten17 vanbasten17 deleted the feat/custom-user-input-buttons branch March 23, 2023 12:02
vanbasten17 added a commit that referenced this pull request Mar 23, 2023
* feat(react): add in CUSTOM_PROPERTIES customEmojiPicker and customAttachments

* feat(botonic-react): render the custom component if it exists

* feat(botonic-react): render the custom component if it is defined in CUSTOM_PROPERTIES

* chore(botonic-react): add build:watch script

* refactor(botonic-react): rename functions typo error

* feat(botonic-react): create ConditionalAnimation as a component

* refactor(botonic-react): put the conditional rendering logic inside each component

* refactor(botonic-react): simplify the webchat component

* chore(react): bump alpha version

* chore(react): bump to 0.21.2

---------

Co-authored-by: Marc Rabat <marcrabat@gmail.com>
Co-authored-by: Marc Rabat Pla <35448568+vanbasten17@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants