Social Chat with Nuxt and Vue

After integrating the Vue Social Chat module into my Nuxt app, I am facing difficulties in understanding how to customize the props and color settings. Currently, everything is functioning properly, but the WhatsApp icon and top bar within the speech bubble are displayed in black. How can I change this in Nuxt? The author suggests using CSS variables, but I'm unsure about where to place them and how to implement them in my code.

Since Nuxt does not have an App.vue file, I directly imported the module, which seems to be working fine, but I'm uncertain if I'm doing it correctly.

This is what my current default.vue page looks like. I haven't imported the module anywhere else:

<template>
  <v-app dark>
    <v-main>
      <Nuxt />
    </v-main>
    <div>
      <SocialChat
        icon
        :attendants="attendants"
      >
        <p slot="header" >Chat with us on WhatsApp for any questions or topics related to sales.</p>
        <template v-slot:button>
          <img
            src="https://raw.githubusercontent.com/ktquez/vue-social-chat/master/src/icons/whatsapp.svg"
            alt="WhatsApp icon"
            aria-hidden="true"
          >
        </template>
        <small slot="footer">Opening hours: 8am to 6pm</small>
      </SocialChat>
    </div>
  </v-app>
</template>

<script>
import { SocialChat } from 'vue-social-chat'

export default {
  name: 'DefaultLayout',
  components: {
    SocialChat
  },
  data() {
    return {
      attendants: [
        {
          app: 'whatsapp',
          label: '',
          name: '',
          number: '',
          avatar: {
            src: '',
            alt: ''
          }
        },
        // ...
      ],
    }
  },
}
</script>

<style>
.container {
  max-width: 1200px;
}
</style>

Answer №1

Here is everything you need in one place

<template>
  <div class="layout">
    <nuxt />
    <social-chat id="social-button" icon :attendants="attendants">
      <p slot="header">
        Click on our attendants below to chat on WhatsApp.
      </p>
      <template #button>
        <img
          src="https://raw.githubusercontent.com/ktquez/vue-social-chat/master/src/icons/whatsapp.svg"
          alt="icon whatsapp"
          aria-hidden="true"
        />
      </template>
      <small slot="footer"gt;Opening hours: 8am to 6pm</small>
    </social-chat>
  </div>
</template>

<script>
import { SocialChat } from 'vue-social-chat'

export default {
  name: 'DefaultLayout',
  components: {
    SocialChat,
  },
  data() {
    return {
      attendants: [
        {
          app: 'whatsapp',
          label: 'Technical support',
          name: 'Alan Ktquez',
          number: '5581983383532',
          avatar: {
            src: 'https://avatars0.githubusercontent.com/u/8084606?s=460&u=20b6499a416cf7129a18e5c168cf387e159edb1a&v=4',
            alt: 'Alan Ktquez avatar',
          },
        },
      ],
    }
  },
}
</script>

<style>
:root #social-button {
  --vsc-bg-header: orange;
  --vsc-bg-footer: #fafafa;
  --vsc-text-color-header: yellow;
  --vsc-text-color-footer: green;
  --vsc-bg-button: pink;
  --vsc-text-color-button: purple;
  --vsc-outline-color: #333;
  --vsc-border-color-bottom-header: teal;
  --vsc-border-color-top-footer: #f3f3f3;
}
</style>

We could have potentially used

--vsc-bg-button: pink !important;
instead of the CSS selector :root #social-button, but I prefer avoiding excessive CSS specificity.
The style could also be scoped, though it wouldn't cause any issues here.

You can find the GitHub repository here: https://github.com/kissu/vue-social

For a fully functional example, visit:

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Node.js is having trouble locating a module that has been installed

Upon transferring my node.js application to a different PC (where it functioned flawlessly on the development machine) and manually installing all the necessary dependencies, I encountered an error when attempting to run it: C:\Users\myself>n ...

There is a SyntaxError due to an unexpected token "o" in the JSON data. It is not a valid JSON format

This code is designed to check an XML file to see if the email or login inputted by a user is already in use, and then provide a JSON response. The AJAX code for this functionality is as follows: $.ajax({ type: 'post', dat ...

What is the best way to use a Handlebars file on multiple routes?

I have been working on extracting articles from a news website by scraping them successfully. The data is being displayed properly on the front-end console log, but I am facing an issue with rendering it onto the page using a button - it only appears when ...

Guide to adding items to an array in json-server using a JavaScript-created database

I built a JSON-server app that dynamically generates the database using JavaScript when it starts running. The data I create is organized within a 'users' object, as illustrated below: { "users": [ { "id": "user_id_0", ...

`How can I trigger a JavaScript event when the content of an input field is modified?`

Currently, I am working on implementing validation in JavaScript. My goal is to provide the user with an alert whenever they modify the value of an input field. <input type="text" name="onchange" id="onchange" size="35" maxlength="50" /> ...

When trying to pass an array to a servlet through ajax, receiving a null parameter is

Just starting out with ajax and encountering an issue. This is what I have set up: var myArray = [2324.031536 , 2355.015241 , 2397.099387 , 2444.286019]; $(document).ready(function() { ...

Create dynamic and interactive content by embedding text within SVG shapes using the powerful D

How can I write text into an SVG shape created with d3.js and limit it to stay inside the shape similar to this example http://bl.ocks.org/mbostock/4063582? I attempted to use a clipPath following the example provided. However, when inspecting with firebu ...

Setting the state to an array of objects in React: A beginner's guide

Currently, I am developing a flashcard application using React. To store the data entered by the user, I have initialized my state as an array of objects that can hold up to 10 terms and definitions at a time: state = { allTerms: [ { ...

Limited to IE6 and 7 - Issue with CSS/jQuery animation

After putting in 8 hours of non-stop work, I'm feeling pretty drained and need some assistance with fixing a bug that's specific to IE6/7. Any jQuery/CSS experts out there willing to lend a hand? To check out the issue, please visit this link us ...

What is the process for resetting a JQueryUI effect animation?

I'm facing an issue with two timer bars that each wind down over a 5-second period. When I try to stop and reset the first timer, it simply continues from where it left off instead of resetting. The desired behavior is as follows: Timer1 starts User ...

Tips for transferring input type from jQuery to ajaxRemember to pass the input type correctly

I created a basic bootstrap form and I am looking to transfer the input type to PHP using ajax. I have managed to retrieve the input name and value using serializeArray(). Is there a way to expand the output of serializeArray to also encompass the input & ...

PHP script integration with WHMCS

I've been attempting to add analytic.php into head.tpl in WHMCS, but I keep encountering an error. Analytic.php location: root/analytic.php Head.tpl location: root/whmcs/template/six/includes/head.tpl I read that WHMCS supports Smarty PHP, so I&apos ...

In what way can I utilize the request object within a promise that is nested?

I am currently working on a Nuxt server side rendered application using the express framework for authentication with the openid-client package. My goal is to store the retrieved token in the express session, but I am facing an issue where the request mode ...

What is the best way to highlight specific text in React components that is passed from an object?

This is the page HTML content where an object is created. A portion of the description needs to be emphasized: const agencyProps = { title: "Managed agency selection", paragraph: "Strengten your onboarding process", videoImage: { ...

Sending handlebars variable to the client-side JavaScript file

I am currently working on an application using node.js along with express and handlebars, and I'm trying to find a way to transfer handlebars data from the server to client-side JavaScript files. Here is an example: //server.js var person = { na ...

Having trouble with the functionality of a Chrome extension content-script JavaScript that is set to run at document_end

Currently, I am in the process of developing a Google Chrome extension that is designed to hide the "news" section located on the right-hand side of Facebook, along with the ads displayed on the right side. Additionally, the background color is meant to be ...

Using a function parameter to restore the values of an array

Looking to clear an array using a function parameter. Below is my implementation: <script> fruitArray = ["apple", "banana", "orange", "pineapple"] function clearFruitArray(myArr){ myArr = []; ...

Creating dynamic web content using KaTeX and Node.js

When I attempt to display a complex formula using HTML and CSS, I encounter difficulties. Instead of the desired output, my screen is filled with confusing unicode characters. To resolve this issue, I decided to use KaTeX. I downloaded KaTeX into the dire ...

Ways to eliminate unnecessary characters from API replies

Currently, I am developing an API in NodeJS and facing a challenge in handling special characters such as /. Here is an excerpt from my API response: https://i.sstatic.net/TfK6O.png static async getAdminOrders(logId, callback) { logger(logId, `Gett ...

Create a PDF document with the background of the input text included and printable

I am trying to find a way to make the background image of the input text appear when saving the page as a PDF (right-click, select "Print ...," and then "Save as PDF"). The page has a square background image that creates the effect of each character being ...