Skip to content

Commit

Permalink
generate templates
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Sinclair committed May 5, 2024
1 parent 330273d commit 8dc1e41
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Can be installed by adding `bloom` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:bloom, "~> 0.0.2"}
{:bloom, "~> 0.0.8"}
]
end
```
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Bloom.MixProject do
def project do
[
app: :bloom,
version: "0.0.7",
version: "0.0.8",
elixir: "~> 1.16",
start_permanent: Mix.env() == :prod,
deps: deps(),
Expand Down
6 changes: 5 additions & 1 deletion priv/templates/avatar.ex
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ defmodule <%= @module_name %>Web.Components.Avatar do
attr(:rest, :global)

def avatar(assigns) do
image =
assigns[:img_src] ||
"https://api.dicebear.com/8.x/#{assigns[:style]}/svg?seed=#{assigns[:name]}"

~H"""
<div class={["flex items-center w-12 h-12", @class]} {@rest}>
<img
src={@img_src || "https://api.dicebear.com/7.x/#{@style}/svg?seed=#{@name}"}
src={image}
alt={"#{@name} avatar"}
class="rounded-lg"
/>
Expand Down

0 comments on commit 8dc1e41

Please sign in to comment.