UNPKG

ondemand-react-chat-bot

Version:

OnDemandChatBot is a React library that provides an easy-to-use AI-powered chatbot component for your application. Built on top of the OnDemand platform, it allows full customization and seamless AI integration.

197 lines (170 loc) 3.22 kB
* { font-family: sans-serif; } .ai-chat-container { position: fixed; bottom: 1rem; right: 1rem; z-index: 50; } .help-button { cursor: pointer; background-color: black; color: #000000; border-width: 0; padding: 0.8rem 0.8rem; color: white; border-radius: 9999px; transition: background-color 0.3s; } .chat-window { display: flex; flex-direction: column; height: 35rem; width: 25rem; background-color: white; border-radius: 0.5rem; box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); } .chat-header { display: flex; align-items: center; justify-content: space-between; background-color: black; height: 3.5rem; padding: 0 0.5rem; border-top-left-radius: 0.5rem; border-top-right-radius: 0.5rem; color: white; } .cancel { cursor: pointer; color: white; border-width: 0; background: transparent; } .messages-container { flex: 1; overflow-y: auto; padding: 1rem; scroll-behavior: smooth; } .messages-container::-webkit-scrollbar { width: 6px; } .messages-container::-webkit-scrollbar-track { background: transparent; } .messages-container::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.2); border-radius: 3px; } .message-wrapper { display: flex; margin-bottom: 1rem; } .message-wrapper.user { justify-content: flex-end; } .message-wrapper.ai { justify-content: flex-start; } .message { max-width: 80%; padding: 0.75rem; border-radius: 0.5rem; font-size: 1rem; line-height: 1.4; letter-spacing: 0ch; } .message.user { background-color: #000000; color: white; } .message.ai { background-color: #f3f4f6; color: #1f2937; } .welcome-message { padding: 0.2rem 1rem; font-size: 1rem; font-weight: 500; color: #0d0d0d52; } .welcome-message span { font-weight: 600; color: #adedd5; } .chat-input-container { border-top: 1px solid #e5e7eb; padding: 1rem; } .chat-form { display: flex; gap: 0.5rem; } .chat-input { flex: 1; padding: 0.75rem; border: 1px solid #1e1e1e18; border-radius: 0.5rem; font-size: 0.875rem; transition: border-color 0.3s; } .chat-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(173, 237, 213, 0.2); } .chat-input:disabled { background-color: #f3f4f6; cursor: not-allowed; } .send-button { border-width: 0; color: white; padding: 0.5rem 0.75rem; border-radius: 0.5rem; transition: background-color 0.3s; cursor: pointer; } .send-button:disabled { opacity: 0.7; cursor: not-allowed; } .loader { width: 20px; aspect-ratio: 2; --_g: no-repeat radial-gradient(circle closest-side, #000 90%, #0000); background: var(--_g) 0% 50%, var(--_g) 50% 50%, var(--_g) 100% 50%; background-size: calc(100% / 3) 50%; animation: l3 1s infinite linear; } @keyframes l3 { 20% { background-position: 0% 0%, 50% 50%, 100% 50%; } 40% { background-position: 0% 100%, 50% 0%, 100% 50%; } 60% { background-position: 0% 50%, 50% 100%, 100% 0%; } 80% { background-position: 0% 50%, 50% 50%, 100% 100%; } } .shine { font-size: 0.8rem; animation: blink 2s linear infinite; } @keyframes blink { 0% { opacity: 0.4; } 50% { opacity: 0.8; } 100% { opacity: 0.4; } }