JSFiddle - React, Tailwind, and code Playground

by Sampath_Madhuranga

HTML

$("#messages").append($("<div align=right><div class=bubble-r><li></div></div><br />").text(msg));

CSS

.chat {
  color: white;
}

.chat .dropdown-toggle:after {
  content: none;
}

.userbutton {
  size: 2px;
}
.card {
  color: black;
}
.card-text {
  overflow: auto;
  height: 10rem;
}
.onlinebar {
  position: "absolute";
  color: red;
  bottom: 0;
  left: 0;
}
#chatbtn {
  color: black;
  width: 200px;

  margin-left: 5px;
  margin-top: 0px;
}

.chatcollapse {
  width: 100%;
  height: 100%;
  margin: 0px;
  padding: 0px;
}
#chatHeader {
  margin: 0px;
  padding: 0px;
}
#chatcard {
  width: 2rem;
}
.card-deck .card {
  max-width: calc(25% + 80px);
}
.card-body {
  padding: 0px;
  margin: 0px;
}
.bubble-r {
  align-items: flex-end;
  position: relative;
  background: #0072c6;
  max-width: 100px;
  padding: 5px;
  font-family: arial;
  margin: 0 auto;
  font-size: 14px;
  color: white;
  border-radius: 6px;
}

.bubble-r:after,
.bubble-r:before {
  left: 100%; /*change this from right to left*/
  top: 42%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
}

.bubble-r:after {
  border-color: rgba(200, 200, 204, 0);
  border-left-color: #0072c6; /*change this from right to left */
  border-width: 8px;
  margin-top: -3px;
}

.bubble-r:before {
  border-color: rgba(200, 204, 0, 0);
  border-left-color: #0072c6; /*change this from right to left*/
  border-width: 8px;
  margin-top: -3px;
}

.bubble {
  position: relative;
  background: #cad5d7;

  max-width: 100px;
  padding: 5px;
  font-family: arial;
  margin: 0 auto;
  font-size: 14px;
  border-radius: 6px;
}
.bubble:after,
.bubble:before {
  right: 100%;
  top: 42%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
}

.bubble:after {
  border-color: rgba(255, 255, 204, 0);
  border-right-color: #cad5d7;
  border-width: 8px;
  margin-top: -3px;
}
.bubble:before {
  border-color: rgba(255, 204, 0, 0);
  border-right-color: #cad5d7;
  border-width: 8px;
  margin-top: -3px;
}

JavaScript

$("#messages").append(
          $("<div class=bubble-r><li></div><br />").text(msg)
        );
      } else {
        $("#messages").append(
          $("<div class=bubble><li></div> <br />").text(msg)
        );
      }
    });
  }

  render() {
    return (
      <ul id="messages">
        <div />
      </ul>
    );
  }