Skip to content

Commit 3ad396f

Browse files
committed
Remove TODO, move to-do to README
1 parent 777ea0a commit 3ad396f

File tree

2 files changed

+140
-39
lines changed

2 files changed

+140
-39
lines changed

README.md

Lines changed: 140 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

22
# Vue Bot UI
33

4-
#### For the one who finding a customizable chatbot UI.
4+
#### For the one who is finding a customizable chatbot UI.
55

66
I build for my private project, but I tried to bring as many options as I think someone need it, so feel free to use it.
77

8-
Demo page is coming soon.
8+
*Demo page is coming soon.*
99

1010
<p align="center">
1111
<img width="300" alt="vue bot UI" src="https://user-images.githubusercontent.com/5735071/71614782-52cc2280-2be0-11ea-8c1b-7af063401d3d.png">
@@ -15,10 +15,10 @@ Demo page is coming soon.
1515
## Install
1616

1717
```bash
18-
yarn add vue-bot-ui
18+
npm install vue-bot-ui
1919

2020
// or
21-
npm install vue-bot-ui
21+
yarn add vue-bot-ui
2222
```
2323

2424
## Usage
@@ -34,66 +34,157 @@ Vue.use(VueBotUI)
3434
Use it:
3535

3636
```vue
37-
<VueBotUI :options="botOptions"/>
37+
<VueBotUI
38+
:messages="data"
39+
:options="botOptions"
40+
/>
3841
```
3942

4043
```javascript
4144
data () {
4245
return {
4346
botOptions: {
44-
// Options here
47+
// See the list of options below
4548
}
4649
}
4750
}
4851
```
4952

50-
## TODO
51-
Many things...
52-
- API services (I'm going to use `axios`)
53-
- Loading / Typing indicators
54-
- Disable message input on loading, vice versa...
55-
- Validate option type
53+
## Props
54+
List of available props to use in the component:
55+
56+
| Name | Type | Default | Description |
57+
| --- | --- | --- | --- |
58+
| `messages` | Array | [] | **Required**. Data of Messages |
59+
| `options` | Object | see below | Some options to customize UI |
60+
| `bot-typing` | Boolean | false | If `true`, the bot typing indicator will show |
61+
| `input-disable` | Boolean | false | If `true`, message input will be disabled |
5662

5763

5864
## Options
65+
List of available options to customize UI:
66+
67+
| Name | Type | Default | Description |
68+
| --- | --- | --- | --- |
69+
| `botTitle` | String | 'Chatbot' | The bot name that will be shown on header of the board |
70+
| `colorScheme` | String | '#1b53d0' | Background color of bubble button & board header |
71+
| `textColor` | String | '#fff' | Color of bubble button icon & board header title |
72+
| `bubbleBtnSize` | Number | 56 | Size of bubble button |
73+
| `animation` | Boolean | true | Set to `false` to disable animation of bubble button icon & board showing |
74+
| `boardContentBg` | String | '#fff' | Background color of board messages box |
75+
| `botAvatarSize` | Number | 32 | Size of bot avatar |
76+
| `botAvatarImg` | String | 'http://placehold.it/200x200' | The size of bot avatar |
77+
| `msgBubbleBgBot` | String | '#f0f0f0' | Background color of BOT message |
78+
| `msgBubbleColorBot` | String | '#000' | Text color of BOT message |
79+
| `msgBubbleBgUser` | String | '#4356e0' | Background color of user message |
80+
| `msgBubbleColorUser` | String | '#fff' | Text color of user message |
81+
| `inputPlaceholder` | String | 'Message' | The placeholder for message input |
82+
| `inputDisableBg` | String | '#fff' | Background color for the disabled input, mixed with opacity 0.2 |
83+
| `inputDisablePlaceholder` | String | null | Placeholder message for disabled input |
84+
85+
86+
## Data & Events
87+
This is the most important part you need to know, because you need these to integrate your bot API.
88+
Take a look my `App.vue` file if you need an example.
89+
90+
#### Data
91+
**Common pattern** - Example data
92+
93+
```javascript
94+
const messages = [
95+
{
96+
agent: 'bot', // Required. 'bot' or 'user'
97+
type: 'text', // Required. Bubble message component type: 'text' / 'button'
98+
text: 'Hello. How can I help you', // Required. The message
99+
avatar: 'http://...', // Avatar
100+
disableInput: false, // Disable message input or not
101+
...
102+
},
103+
{
104+
agent: 'user',
105+
type: 'text', // always
106+
text: 'I need a new laptop',
107+
}
108+
]
109+
```
110+
111+
**Component List** `components/MessageBubble/..` - Current components supported by this package
112+
113+
- **SingleText** component (`type: 'text'`)
114+
```javascript
115+
{
116+
agent: 'bot',
117+
type: 'text',
118+
text: 'Hello. How can I help you',
119+
avatar: 'http://...',
120+
disableInput: false,
121+
}
122+
```
123+
124+
- **ButtonOptions** component (`type: 'button'`)
125+
```javascript
126+
{
127+
agent: 'bot',
128+
type: 'button',
129+
text: 'Select the option below',
130+
avatar: 'http://...',
131+
disableInput: true,
132+
options: [
133+
{
134+
text: 'Open Google',
135+
value: 'https://google.com',
136+
action: 'url'
137+
},
138+
{
139+
text: 'Submit Support Ticket',
140+
value: 'submit_ticket',
141+
action: 'postback' // Request to API
142+
}
143+
],
144+
}
145+
```
146+
147+
- Other components are coming soon...
148+
149+
#### Events
59150

60-
| Name | Type | Default | Description |
61-
| --- | --- | --- | --- |
62-
| inputPlaceholder | String | 'Message' | The placeholder for message input |
63-
| botTitle | String | 'Chatbot' | Name of the bot that will be shown on header of the board |
64-
| colorScheme | String | '#1b53d0' | The background color of bubble button & board header |
65-
| textColor | String | '#fff' | The color of bubble button icon & board header title |
66-
| bubbleBtnSize | Number | 56 | The size of bubble button |
67-
| animation | Boolean | true | Set to `false` to disable animation of bubble button icon & board showing |
68-
| boardContentBg | String | '#fff' | The background color of board messages box |
69-
| botAvatarSize | Number | 32 | The size of bot avatar |
70-
| botAvatarImg | String | 'http://placehold.it/200x200' | The size of bot avatar |
71-
| msgBubbleBgBot | String | '#f0f0f0' | The background color of BOT message |
72-
| msgBubbleColorBot | String | '#000' | The text color of BOT message |
73-
| msgBubbleBgUser | String | '#4356e0' | The background color of user message |
74-
| msgBubbleColorUser | String | '#fff' | The text color of user message |
151+
| Name | Params | Description |
152+
| --- | --- | --- |
153+
| `init` | | Fire everytime the board is opened |
154+
| `msg-send` | value (Object) | Fire when user hit Send or select an option |
155+
| `destroy ` | | Fire when board is closed |
75156

76157

77158
## Slots
78159

79160
Usage
80161
```vue
81-
<template slot="header>
82-
...
83-
</template>
162+
<VueBotUI :messages="data">
163+
<template slot="header">
164+
...
165+
</template>
166+
</VueBotUI>
84167
```
85168

86-
- **header** -- Board header, that contains Bot name. You can add icon or customize by this slot
87-
- **actions** -- The slot beside Send button in the board footer. You can add some actions here (emoji, attach,...)
88-
- **sendButton** -- The slot to customize Send button in the board footer.
89-
- **bubbleButton** -- Customize the Bubble button
169+
List of available slots:
170+
171+
| Name | Description |
172+
| --- | --- |
173+
| `header` | Board header, that contains Bot name. |
174+
| `actions` | The slot beside Send button in the input message. You can add extra actions here (emoji, attach,...) |
175+
| `sendButton` | Send button icon, you can change it to text. |
176+
| `bubbleButton` | Bubble button that contains BubbleIcon & CloseIcon as default. |
177+
| `botTyping` | Bot Typing message bubble that contains 3 dots indicator as default. |
178+
90179

91180
The more details for slots is coming soon.
92181

93182

94-
##### Not found what your need? Customize yourself:
183+
#### Not found what your need? Customize yourself:
95184
You can overwrite the CSS by class name. Each type and state has separated class for you to customize.
96185

186+
**Feature request**: Feel free to open an issue to ask for a new feature.
187+
97188

98189
## Developers / Build
99190
```bash
@@ -106,11 +197,24 @@ yarn
106197
# Development & Demo - http://localhost:1901
107198
yarn serve
108199

109-
# Build main library for client & SSR
200+
# Build main library
110201
yarn build-bundle
111202
```
112203

204+
## Todo:
205+
Many things...
206+
- ~~Events~~
207+
- ~~Loading / Typing indicators~~
208+
- ~~Disable message input on loading, vice versa...~~
209+
- Validate option type
210+
- Properties for `target` of button options
211+
- Add more message bubble components (video, images,...)
212+
- Add more events
213+
- Test
214+
- Accessibility
215+
113216
---
217+
114218
- The icons and images from [FlatIcon](https://www.flaticon.com/)
115219
- Placeholder image from [Placehold.it](http://placehold.it)
116220

TODO

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)