Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
mad styling
Browse files Browse the repository at this point in the history
  • Loading branch information
gillyb committed Dec 17, 2024
1 parent ba8f2f8 commit 5ea4363
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
33 changes: 33 additions & 0 deletions apps/documentation/src/pages/ProactiveMessage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { useState } from 'react';

const inputStyle = {
border: 'solid 1px black',
borderRadius: '4px',
padding: '2px',
};

const sendButtonStyle = {
background: '#e8e8e8',
borderRadius: '4px',
padding: '4px 8px',
marginLeft: '4px',
};

export default function ProactiveMessage() {
const [message, setMessage] = useState('');

const send = () => {
(window as any).voiceflow.chat.proactive.push({ type: 'text', payload: { message } });
setMessage('');
};

return (
<div>
Add proactive message:
<input type="text" style={inputStyle} value={message} onChange={(e) => setMessage(e.target.value)} />
<button type="button" style={sendButtonStyle} onClick={send}>
Send
</button>
</div>
);
}
13 changes: 8 additions & 5 deletions apps/documentation/src/pages/chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'regenerator-runtime/runtime';

import { ChatScript } from '@/components/ChatScript';

import ProactiveMessage from './ProactiveMessage';

export const getServerSideProps = async (context: any) => ({
// will be passed to the page component as props
props: {
Expand All @@ -13,12 +15,13 @@ export const getServerSideProps = async (context: any) => ({
export default function ChatPage(props: any) {
return (
<>
<div style={{ position: 'relative' }}>
You can switch projects by changing the URL `projectID=...`
{props.projectID && <ChatScript {...props} />}
</div>

<div style={{ height: '100vh', padding: '30px' }}>
<div style={{ position: 'relative' }}>
You can switch projects by changing the URL `projectID=...`
{props.projectID && <ChatScript {...props} />}
</div>
<ProactiveMessage />

<div style={{ width: '600px', height: '100%', margin: '0 auto' }} id="chat_embed"></div>
</div>
</>
Expand Down

0 comments on commit 5ea4363

Please sign in to comment.