Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into sound-effect
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Sinclair committed May 5, 2024
2 parents 2ca3721 + 4b31fed commit 330273d
Show file tree
Hide file tree
Showing 30 changed files with 806 additions and 431 deletions.
9 changes: 8 additions & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
plugins: [TailwindFormatter, Phoenix.LiveView.HTMLFormatter],
inputs: [
"{mix,.formatter}.exs",
"{config,lib,test}/**/*.{ex,exs}",
"*.{heex,ex,exs}",
"priv/*/seeds.exs",
"{config,lib,test}/**/*.{heex,ex,exs}"
]
]
11 changes: 11 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to the "Bloom" project will be documented in this file.

### [0.0.7] - 2024-05-01

#### Added

- Avatar component
- Ability to add JS to components

#### Changed

- Utilising @doc from components in Storybook

### [0.0.6] - 2024-05-01

#### Changed
Expand Down
61 changes: 61 additions & 0 deletions bloom_site/lib/bloom_site_web/components/avatar.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
defmodule BloomSiteWeb.Components.Avatar do
use Phoenix.Component

@doc """
Avatar component using https://avatars.dicebear.com styles.
Can be overridden by an image URL.
Styles available:
Adventurer
Adventurer Neutral
Avataaars
Avataaars Neutral
Big Ears
Big Ears Neutral
Big Smile
Bottts
Bottts Neutral
Croodles
Croodles Neutral
Fun Emoji
Icons
Identicon
Initials
Lorelei
Lorelei Neutral
Micah
Miniavs
Notionists
Notionists Neutral
Open Peeps
Personas
Pixel Art
Pixel Art Neutral
Rings
Shapes
Thumbs
"""

attr(:name, :string, required: true, doc: "Name for avatar and seed for dicebear API")
attr(:style, :string, default: "miniavs", doc: "Style for dicebear API")
attr(:img_src, :string, required: false, doc: "Image URL - overrides dicebear API")
attr(:class, :string, default: "", doc: "CSS class for parent div")
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={image}
alt={"#{@name} avatar"}
class="rounded-lg"
/>
</div>
"""
end
end
2 changes: 1 addition & 1 deletion bloom_site/lib/bloom_site_web/components/bento_grid.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule BloomSiteWeb.Components.BentoGrid do
use Phoenix.Component

@moduledoc """
@doc """
Bento grid component with bento cards.
See `bento_card/1` for usage.
Expand Down
2 changes: 1 addition & 1 deletion bloom_site/lib/bloom_site_web/components/card.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule BloomSiteWeb.Components.Card do
use Phoenix.Component

@moduledoc """
@doc """
Card component
"""

Expand Down
2 changes: 1 addition & 1 deletion bloom_site/lib/bloom_site_web/components/code_snippet.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule BloomSiteWeb.Components.CodeSnippet do
use Phoenix.Component

@moduledoc """
@doc """
Code snippet component
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule BloomSiteWeb.CoreComponents do
@moduledoc """
@doc """
Provides core UI components.
At the first glance, this module may seem daunting, but its goal is
Expand Down
2 changes: 1 addition & 1 deletion bloom_site/lib/bloom_site_web/components/gradient_text.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule BloomSiteWeb.Components.GradientText do
use Phoenix.Component

@moduledoc """
@doc """
Gradient text component
"""

Expand Down
2 changes: 1 addition & 1 deletion bloom_site/lib/bloom_site_web/components/hero.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule BloomSiteWeb.Components.Hero do
use Phoenix.Component

@moduledoc """
@doc """
Hero component
"""

Expand Down
10 changes: 6 additions & 4 deletions bloom_site/lib/bloom_site_web/components/layouts/app.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@
<img src={~p"/images/bloom.png"} width="36" />
</a>
<p class="bg-brand/5 text-brand rounded-full px-2 font-medium leading-6">
v0.0.6
v0.0.7
</p>
</div>
<div class="flex items-center gap-4 font-semibold leading-6 text-zinc-900">
<a href="https://github.com/chrisgreg/bloom" class="hover:text-zinc-700 w-8">
<.link navigate="/showcase" class="hover:text-zinc-700">Showcase</.link>
<.link navigate="/storybook" class="hover:text-zinc-700">Docs</.link>
<.link href="https://github.com/chrisgreg/bloom" class="hover:text-zinc-700 w-8">
<svg class="w-8 h-8" aria-hidden="true" fill="currentColor" viewBox="0 0 24 24">
<path
fill-rule="evenodd"
d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z"
clip-rule="evenodd"
/>
</svg>
</a>
</.link>
</div>
</div>
</header>
<main class="px-4 py-20 sm:px-6 lg:px-8">
<div class="mx-auto max-w-4xl">
<div class="mx-auto max-w-7xl">
<.flash_group flash={@flash} />
<%= @inner_content %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion bloom_site/lib/bloom_site_web/components/marquee.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule BloomSiteWeb.Components.Marquee do
use Phoenix.Component

@moduledoc """
@doc """
Marquee component
Sliding carousel of images that can go backwards and forwards.
Expand Down
1 change: 1 addition & 0 deletions bloom_site/lib/bloom_site_web/live/landing_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule BloomSiteWeb.LandingLive do
import BloomSiteWeb.Components.BentoGrid
import BloomSiteWeb.Components.Marquee
import BloomSiteWeb.Components.Card
import BloomSiteWeb.Components.Avatar

def mount(_params, _session, socket) do
{:ok, socket}
Expand Down
Loading

0 comments on commit 330273d

Please sign in to comment.