0.0.2 • Published 10 months ago

fahm-chat-ui v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Chat App Component

This is a reusable chat app component that provides a UI similar to popular messaging apps like WhatsApp or Telegram. It allows users to send messages and display a chat history.

Installation

To use the chat-app component in your Angular, React, or Vue project, follow the steps below.

Angular

  1. Install the chat-app package via npm:
npm install chat-app
  1. In your Angular module, import the chat-app module:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ChatAppComponent } from 'chat-app';

@NgModule({
  declarations: [ChatAppComponent],
  imports: [BrowserModule],
  bootstrap: [ChatAppComponent]
})
export class AppModule {}
  1. Use the chat-app component in your Angular template:
<chat-app endpoint="https://api.example.com/messages"></chat-app>

Replace "https://api.example.com/messages" with the actual endpoint URL to call when sending messages.

React

  1. Install the chat-app package via npm:
npm install chat-app
  1. Import and use the chat-app component in your React component:
import React from 'react';
import { ChatApp } from 'chat-app';

function App() {
  return (
    <div>
      <ChatApp endpoint="https://api.example.com/messages" />
    </div>
  );
}

export default App;

Replace "https://api.example.com/messages" with the actual endpoint URL to call when sending messages.

Vue

  1. Install the chat-app package via npm:
npm install chat-app
  1. Import and use the chat-app component in your Vue component:
<template>
  <div>
    <ChatApp endpoint="https://api.example.com/messages" />
  </div>
</template>

<script>
import { ChatApp } from 'chat-app';

export default {
  components: {
    ChatApp
  }
};
</script>

Replace "https://api.example.com/messages" with the actual endpoint URL to call when sending messages.

Props

The chat-app component accepts the following props:

  • endpoint (required): The API endpoint URL to call when sending messages. This should be a string.

Events

The chat-app component emits the following events:

  • messageSent: Triggered when a message is successfully sent. You can attach an event listener to handle this event.
const chatApp = document.querySelector('chat-app');

chatApp.addEventListener('messageSent', (event) => {
  console.log('Message sent:', event.detail);
});

Styling

The UI of the chat-app component can be customized using CSS classes and styles. Refer to the provided chat-app.css file for the available classes.

License

This project is licensed under the MIT License.


Feel free to customize the README to match your specific project structure or requirements.


To build and deploy a Stencil app, you can follow these general steps:

  1. Build the Stencil app:

    • Run the build command to generate the optimized static assets for your app:
      npm run build
    • The build command creates a www folder that contains the compiled assets (HTML, CSS, and JavaScript) of your Stencil app.
  2. Deploy the Stencil app:

    • Depending on your hosting environment and deployment workflow, you can choose one of the following options:

      • Static Hosting: If you have a static hosting provider, such as Netlify, Vercel, GitHub Pages, or AWS S3, you can deploy your Stencil app by uploading the contents of the www folder to the hosting provider.

      • Server Hosting: If you have a server hosting provider, such as Heroku, AWS EC2, or DigitalOcean, you can deploy your Stencil app by following the specific deployment instructions for your hosting provider. Typically, this involves setting up a server environment, installing dependencies, and configuring the server to serve the compiled assets from the www folder.

      • Serverless Architecture: If you are using a serverless architecture, such as AWS Lambda or Google Cloud Functions, you can deploy your Stencil app by packaging the compiled assets as a serverless function. This involves creating a serverless function that serves the compiled assets from the www folder and deploying it to your serverless provider.

  3. Set up routing (if needed):

    • If your Stencil app uses client-side routing (e.g., with Stencil Router), you may need to configure your hosting environment to support routing. This typically involves setting up URL rewriting rules to ensure that all requests are directed to the main index.html file of your app. Consult your hosting provider's documentation for instructions on configuring routing for your specific environment.
  4. Test and verify:

    • After deploying your Stencil app, test it thoroughly to ensure that all functionality works as expected in the deployed environment. Test various scenarios, including navigation, API calls, and any other features specific to your app.

Remember to consider security best practices, such as enabling HTTPS, protecting sensitive data, and implementing authentication and authorization mechanisms if required.

Note: The deployment process may vary depending on your specific hosting provider and deployment workflow. Refer to the documentation of your chosen hosting provider for more detailed instructions on deploying a Stencil app to their platform.

0.0.2

10 months ago

0.0.1

10 months ago