Skip to content

Commit de34365

Browse files
committed
feat: styling improvements
1 parent f3b6f2e commit de34365

17 files changed

+407
-337
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function MyApp() {
3030

3131
<QABot
3232
isLoggedIn={isLoggedIn}
33-
initiallyOpen={isOpen}
33+
defaultOpen={isOpen}
3434
onClose={() => setIsOpen(false)}
3535
welcome="Welcome to the ACCESS Q&A Bot!"
3636
prompt="How can I help you today?"
@@ -52,7 +52,7 @@ function MyApp() {
5252
welcome="Welcome to the Q&A Bot!"
5353
prompt="Ask me anything about ACCESS..."
5454
is-logged-in
55-
is-open>
55+
default-open>
5656
</access-qa-bot>
5757
```
5858

@@ -89,7 +89,7 @@ function MyApp() {
8989
prompt: "Ask a question about ACCESS...",
9090
isLoggedIn: true,
9191
embedded: true,
92-
isOpen: true
92+
defaultOpen: true
9393
});
9494
}
9595
});
@@ -121,7 +121,7 @@ Replace `v0.2.0` with the specific version you want to use. This method provides
121121
| isLoggedIn / is-logged-in | boolean | Whether the user is logged in |
122122
| isAnonymous / is-anonymous | boolean | Whether the user is anonymous |
123123
| disabled | boolean | Disable the chat input |
124-
| initiallyOpen / initially-open | boolean | Whether the chat is initially open |
124+
| defaultOpen / default-open | boolean | Whether the chat is initially open |
125125
| apiKey / api-key | string | API key for authentication |
126126
| onClose | function | Callback when the chat is closed (React only) |
127127

build/static/css/main.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/static/css/main.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/static/js/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/static/js/main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.d.ts

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,61 @@
11
interface QABotProps {
22
isLoggedIn?: boolean;
33
isAnonymous?: boolean;
4-
initiallyOpen?: boolean;
4+
defaultOpen?: boolean;
55
apiKey?: string;
66
embedded?: boolean;
77
welcome?: string;
88
prompt?: string;
99
disabled?: boolean;
10+
visible?: boolean;
1011
onClose?: () => void;
1112
[key: string]: any; // Allow additional props
1213
}
1314

15+
// React component with ref
16+
interface QABotRef {
17+
toggle: () => boolean;
18+
open: () => void;
19+
close: () => void;
20+
isOpen: () => boolean;
21+
}
22+
1423
// React component
15-
export const QABot: (props: QABotProps) => JSX.Element;
24+
export const QABot: React.ForwardRefExoticComponent<
25+
QABotProps & React.RefAttributes<QABotRef>
26+
>;
1627

1728
// Web Component class (available in the standalone build)
1829
export class WebComponentQABot extends HTMLElement {
1930
static observedAttributes: string[];
2031
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
2132
connectedCallback(): void;
2233
disconnectedCallback(): void;
34+
toggle(): boolean;
35+
open(): void;
36+
close(): void;
37+
isOpen(): boolean;
2338
}
2439

2540
// Function for non-React integration
2641
interface QAndAToolConfig extends QABotProps {
2742
target: HTMLElement;
43+
returnRef?: boolean;
44+
}
45+
46+
// Return type when returnRef is true
47+
interface QABotControlMethods {
48+
toggle: () => boolean;
49+
open: () => void;
50+
close: () => void;
51+
isOpen: () => boolean;
2852
}
2953

3054
// Main function for programmatic usage (works with React or Web Component)
31-
export function qAndATool(config: QAndAToolConfig): () => void;
55+
export function qAndATool(config: QAndAToolConfig): (() => void) | QABotControlMethods;
3256

3357
// Web Component specific function (exposed in the standalone bundle)
34-
export function webComponentQAndATool(config: QAndAToolConfig): () => void;
58+
export function webComponentQAndATool(config: QAndAToolConfig): (() => void) | QABotControlMethods;
3559

3660
// Default export (React component)
3761
export default QABot;

src/App.css

Lines changed: 9 additions & 231 deletions
Original file line numberDiff line numberDiff line change
@@ -1,231 +1,9 @@
1-
.rcb-toggle-button.rcb-button-show {
2-
background-size: 72%;
3-
background-position: center;
4-
background-repeat: no-repeat;
5-
background-color: rgb(26, 91, 110);
6-
}
7-
8-
.rcb-chat-window {
9-
width: 550px !important;
10-
max-width: calc(100%);
11-
max-height: 600px; /* TODO: why do we need this now */
12-
}
13-
14-
.rcb-chat-window .rcb-bot-avatar {
15-
background-size: contain;
16-
border-radius: 0;
17-
background-position: center;
18-
background-repeat: no-repeat;
19-
}
20-
21-
.rcb-chat-window .rcb-chat-header {
22-
display: flex;
23-
flex-direction: row;
24-
align-items: center;
25-
font-weight: 700;
26-
}
27-
28-
.rcb-chat-window a {
29-
font-weight: 700;
30-
color: #000000;
31-
text-decoration: underline;
32-
}
33-
34-
.rcb-chat-window a:hover {
35-
color: #107180;
36-
}
37-
38-
.rcb-chat-window .rcb-bot-message a {
39-
text-decoration: none;
40-
color: #ffffff;
41-
}
42-
43-
.rcb-chat-window .rcb-bot-message a:hover {
44-
text-decoration: underline;
45-
}
46-
47-
.rcb-chat-window .rcb-chat-input-textarea {
48-
overflow-y: auto;
49-
}
50-
51-
.rcb-chat-window .rcb-chat-footer-container {
52-
font-size: 10px;
53-
}
54-
55-
.embedded-qa-bot .rcb-chat-window {
56-
position: relative;
57-
width: 100% !important;
58-
height: 100%;
59-
max-height: none;
60-
max-width: 100% !important;
61-
box-shadow: none;
62-
border-radius: 0;
63-
}
64-
65-
/* Ensure chat elements take full width */
66-
.embedded-qa-bot .rcb-chat-container,
67-
.embedded-qa-bot .rcb-messages-container {
68-
width: 100% !important;
69-
max-width: 100% !important;
70-
}
71-
72-
/* Hide footer in embedded mode */
73-
.embedded-qa-bot .rcb-footer {
74-
display: none;
75-
}
76-
77-
.embedded-chat-container {
78-
width: 100%;
79-
transition: all 0.3s ease;
80-
position: relative;
81-
}
82-
83-
.embedded-chat-container.closed {
84-
height: 50px;
85-
overflow: hidden;
86-
}
87-
88-
.embedded-chat-container.open {
89-
height: 500px;
90-
}
91-
92-
.embedded-chat-closed {
93-
background-color: var(--primary-color, #1a5b6e);
94-
color: white;
95-
height: 50px;
96-
align-items: center;
97-
justify-content: space-between;
98-
padding: 0 15px;
99-
cursor: pointer;
100-
border-radius: 4px;
101-
position: absolute;
102-
top: 0;
103-
left: 0;
104-
right: 0;
105-
z-index: 1;
106-
}
107-
108-
.embedded-chat-open {
109-
position: relative;
110-
height: 100%;
111-
width: 100%;
112-
border-radius: 4px;
113-
}
114-
115-
.embedded-chat-content {
116-
overflow: hidden;
117-
width: 100%;
118-
}
119-
120-
.embedded-chat-open-btn {
121-
background-color: var(--secondary-color, #107180);
122-
color: white;
123-
border: none;
124-
padding: 5px 15px;
125-
border-radius: 4px;
126-
cursor: pointer;
127-
}
128-
129-
/* Custom close button in the react-chatbotify header */
130-
.embedded-close-button {
131-
background: transparent;
132-
border: none;
133-
font-size: 24px;
134-
cursor: pointer;
135-
color: #666;
136-
margin-left: 10px;
137-
line-height: 1;
138-
padding: 0 5px;
139-
}
140-
141-
.embedded-close-button:hover {
142-
color: #333;
143-
}
144-
145-
/* Hide the bot completely when it's not visible */
146-
.access-qa-bot.hidden {
147-
display: none;
148-
}
149-
150-
/* QABot Demo Component Styles */
151-
.qa-bot-demo {
152-
padding: 20px;
153-
margin: 20px 0;
154-
border: 1px solid #ddd;
155-
border-radius: 8px;
156-
}
157-
158-
.qa-bot-demo .controls {
159-
margin-bottom: 20px;
160-
}
161-
162-
.qa-bot-demo .button-row {
163-
display: flex;
164-
gap: 10px;
165-
}
166-
167-
.qa-bot-demo button {
168-
padding: 8px 16px;
169-
background-color: var(--primary-color, #1a5b6e);
170-
color: white;
171-
border: none;
172-
border-radius: 4px;
173-
cursor: pointer;
174-
}
175-
176-
.qa-bot-demo button:hover {
177-
background-color: var(--secondary-color, #107180);
178-
}
179-
180-
.embedded-bot-container {
181-
border: 1px solid #e0e0e0;
182-
border-radius: 4px;
183-
overflow: hidden;
184-
padding: 0;
185-
}
186-
187-
/* Mobile responsive styles for embedded chat */
188-
@media (max-width: 768px) {
189-
.embedded-chat-container.open {
190-
height: 400px;
191-
}
192-
193-
.embedded-chat-closed {
194-
height: 40px;
195-
font-size: 14px;
196-
}
197-
198-
.embedded-chat-open-btn {
199-
padding: 3px 10px;
200-
font-size: 12px;
201-
}
202-
}
203-
204-
@media (max-width: 480px) {
205-
.embedded-chat-container.open {
206-
height: 350px;
207-
}
208-
}
209-
210-
/* Ensure header also takes full width */
211-
.embedded-qa-bot .rcb-header {
212-
width: 100% !important;
213-
}
214-
215-
/* Fix any other width constraints */
216-
.embedded-qa-bot .rcb-bot-message,
217-
.embedded-qa-bot .rcb-user-message {
218-
max-width: 90% !important;
219-
word-break: break-word;
220-
}
221-
222-
/* Make the text input area expand properly */
223-
.embedded-qa-bot .rcb-chat-input-textarea {
224-
width: 100% !important;
225-
}
226-
227-
/* Overall container should expand fully */
228-
.qa-bot-container {
229-
width: 100%;
230-
max-width: 100%;
231-
}
1+
/**
2+
* ACCESS QA Bot Styles
3+
*
4+
* This file now imports modular CSS files from the styles directory
5+
* while maintaining backward compatibility with existing builds.
6+
*/
7+
8+
/* Import modular styles */
9+
@import './styles/index.css';

0 commit comments

Comments
 (0)