Skip to content

Instantly share code, notes, and snippets.

@ericchuawc
Created March 21, 2023 23:29
Show Gist options
  • Save ericchuawc/cb7f18286548c4ffa4dd7011da7aa3f2 to your computer and use it in GitHub Desktop.
Save ericchuawc/cb7f18286548c4ffa4dd7011da7aa3f2 to your computer and use it in GitHub Desktop.
you are accessing the variable "name" inside a LiveView template
def user_msg_heex(assigns) do
Logger.info(assigns: assigns)
~H"""
<li class="relative bg-white py-5 px-4 focus-within:ring-2 focus-within:ring-inset focus-within:ring-indigo-600 hover:bg-gray-50">
<div class="flex justify-between space-x-3">
<div class="min-w-0 flex-1">
<a href="#" class="block focus:outline-none">
<span class="absolute inset-0" aria-hidden="true"></span>
<p class="truncate text-sm font-medium text-gray-900 mb-4">
<%= @msg_data.username %>
</p>
</a>
</div>
</div>
<div class="mt-1">
<p class="text-sm text-gray-600 line-clamp-2"><%= @msg_data.msg %></p>
</div>
</li>
"""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment