-
Notifications
You must be signed in to change notification settings - Fork 7
feat: socials component #538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
fb2a3f8
feat: validate and add socials.ex
AfonsoMartins26 6aa9b72
feat: socials component working
AfonsoMartins26 d973f50
fix: pass tests
AfonsoMartins26 254e5ec
fix: uploader.ex restored
AfonsoMartins26 e8a47ff
feat: remove max_size
AfonsoMartins26 46c0b6e
feat: some of the requested changes
AfonsoMartins26 610e62b
feat: entity required
AfonsoMartins26 0a36db7
feat: requested change
AfonsoMartins26 5065e30
feat: add function to helpers.ex
AfonsoMartins26 f85352a
code format
AfonsoMartins26 ba211f5
feat: add requested changes
AfonsoMartins26 cd3be11
feat: requested changes
AfonsoMartins26 f252d21
Merge branch 'develop' into am/socialscomponent
AfonsoMartins26 2665191
fix: calling of the function
AfonsoMartins26 81a2401
Merge branch 'am/socialscomponent' of github.com:cesium/atomic into a…
AfonsoMartins26 3d33e8f
feat: remove alias and fix to AtomicWeb
AfonsoMartins26 2a0bd4e
code format
AfonsoMartins26 fec1d1e
fix: capitalize
AfonsoMartins26 25c7159
feat: complete for mobile
AfonsoMartins26 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| defmodule AtomicWeb.Components.Socials do | ||
| @moduledoc false | ||
| use Phoenix.Component | ||
| alias AtomicWeb.Components.Helpers | ||
|
AfonsoMartins26 marked this conversation as resolved.
Outdated
|
||
|
|
||
| attr :entity, :map, required: true | ||
|
|
||
| def socials(assigns) do | ||
| assigns = assign(assigns, :socials_with_values, get_social_values(assigns.entity)) | ||
|
|
||
| ~H""" | ||
| <div class="mt-4 flex gap-4"> | ||
|
AfonsoMartins26 marked this conversation as resolved.
Outdated
|
||
| <%= for {social, icon, url_base, social_value} <- @socials_with_values do %> | ||
| <%= if social_value do %> | ||
| <div class="flex flex-row items-center gap-x-1"> | ||
| <img src={"/images/" <> icon} class="h-5 w-5" alt={Helpers.atom_to_string_capitalize(social)} /> | ||
| <.link class="text-blue-500" target="_blank" href={url_base <> social_value}> | ||
| <%= Helpers.atom_to_string_capitalize(social) %> | ||
|
AfonsoMartins26 marked this conversation as resolved.
Outdated
|
||
| </.link> | ||
| </div> | ||
| <% end %> | ||
| <% end %> | ||
| </div> | ||
| """ | ||
| end | ||
|
|
||
| defp get_social_values(entity) do | ||
| get_socials() | ||
| |> Enum.map(fn {social, icon, url_base} -> | ||
| social_value = Map.get(entity, social) | ||
| {social, icon, url_base, social_value} | ||
| end) | ||
| end | ||
|
|
||
| def get_socials do | ||
| [ | ||
| {:tiktok, "tiktok.svg", "https://tiktok.com/"}, | ||
| {:instagram, "instagram.svg", "https://instagram.com/"}, | ||
| {:facebook, "facebook.svg", "https://facebook.com/"}, | ||
| {:x, "x.svg", "https://x.com/"} | ||
| ] | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.