Skip to content

Instantly share code, notes, and snippets.

@teamon
Created November 9, 2022 09:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teamon/8295ec572274efbe3889136e89fb4e6f to your computer and use it in GitHub Desktop.
Save teamon/8295ec572274efbe3889136e89fb4e6f to your computer and use it in GitHub Desktop.
defmodule SupportChat do
import Phoenix.Component
alias Phoenix.LiveView.JS
@doc """
Chat bubble at the bottom right corner.
"""
def bubble(assigns) do
~H"""
<div>
<div phx-click={JS.show(to: "#support-chat")} class="z-10 fixed w-12 h-12 flex items-center justify-center cursor-pointer rounded-full text-white bg-black" style="right: 25px; bottom: 25px;">
<svg width="24" height="24" viewBox="0 0 24 24" role="img" xmlns="http://www.w3.org/2000/svg">
<path
fill="white"
d="M23.849 14.91c-.24 2.94-2.73 5.22-5.7 5.19h-3.15l-6 3.9v-3.9l6-3.9h3.15c.93.03 1.71-.66 1.83-1.59.18-3 .18-6-.06-9-.06-.84-.75-1.47-1.56-1.53-2.04-.09-4.2-.18-6.36-.18s-4.32.06-6.36.21c-.84.06-1.5.69-1.56 1.53-.21 3-.24 6-.06 9 .09.93.9 1.59 1.83 1.56h3.15v3.9h-3.15a5.644 5.644 0 0 1-5.7-5.19c-.21-3.21-.18-6.39.06-9.6a5.57 5.57 0 0 1 5.19-5.1c2.1-.15 4.35-.21 6.6-.21s4.5.06 6.63.24a5.57 5.57 0 0 1 5.19 5.1c.21 3.18.24 6.39.03 9.57z"
/>
</svg>
</div>
<div id="support-chat" class="hidden z-20 bg-sea fixed rounded p-5 text-white bg-black" style="width: 325px; right: 25px; bottom: 25px;">
Contact us at <a href="mailto:hello@ubots.co" class="underline hover:opacity-60">hello@ubots.co</a>
or use the in-Slack live-chat Support in any of our apps.
<button phx-click={JS.hide(to: "#support-chat")} class="underline text-sm float-right opacity-60">
&#x2715; close
</button>
</div>
</div>
"""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment