Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new Home page to document page. (#9)
* feat: Consider to build a page header. * feat: Add new wc_page_header, wc_page_footer and home page. * feat: Refactor home page. * chore: Fix ci version. * fix: Fix class attr to any, it can be binary, false or list. * fix: Fix class attr to any, it can be binary, false or list. --------- Co-authored-by: Jonathan Gao <gsmlg.com@gmail.com>
- Loading branch information
Showing
20 changed files
with
533 additions
and
77 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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
118 changes: 118 additions & 0 deletions
118
apps/phoenix_webcomponent/lib/phoenix_webcomponent/page_footer.ex
This file contains 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,118 @@ | ||
defmodule Phoenix.WebComponent.PageFooter do | ||
@moduledoc """ | ||
render Page footer | ||
""" | ||
use Phoenix.WebComponent, :html | ||
|
||
@doc """ | ||
Generates a Page footer. | ||
## Example | ||
<.wc_page_footer> | ||
<:section class=""> | ||
ABC | ||
</:section> | ||
<:copyright> | ||
(^_^) | ||
</:copyright> | ||
</.wc_page_footer> | ||
""" | ||
@doc type: :component | ||
attr(:id, :any, | ||
default: false, | ||
doc: """ | ||
html attribute id | ||
""" | ||
) | ||
|
||
attr(:class, :any, | ||
default: "", | ||
doc: """ | ||
html attribute class | ||
""" | ||
) | ||
|
||
slot(:section, | ||
required: false, | ||
doc: """ | ||
Page footer section | ||
""" | ||
) do | ||
attr(:class, :string) | ||
attr(:title, :string) | ||
attr(:title_class, :string) | ||
attr(:body_class, :string) | ||
end | ||
|
||
slot(:copyright, | ||
required: false, | ||
doc: """ | ||
Page footer right side copyright. | ||
""" | ||
) do | ||
attr(:class, :string) | ||
attr(:title, :string) | ||
attr(:title_class, :string) | ||
attr(:body_class, :string) | ||
end | ||
|
||
def wc_page_footer(assigns) do | ||
~H""" | ||
<footer class={[ | ||
"w-full min-h-fit", | ||
"flex flex-col", | ||
"py-20", | ||
@class | ||
]}> | ||
<div class={[ | ||
"container mx-auto", | ||
"flex flex-col", | ||
]}> | ||
<div class={[ | ||
"flex flex-row", | ||
"justify-between items-start", | ||
"w-full" | ||
]}> | ||
<div | ||
:for={section <- @section} | ||
class={[ | ||
"flex flex-col", | ||
Map.get(section, :class, "") | ||
]} | ||
> | ||
<%= if Map.get(section, :title, "") != "" do %> | ||
<h4 class={["font-bold my-2", Map.get(section, :title_class, "")]}> | ||
<%= Map.get(section, :title, "") %> | ||
</h4> | ||
<% end %> | ||
<div class={["flex flex-col", Map.get(section, :body_class, "")]}> | ||
<%= render_slot(section) %> | ||
</div> | ||
</div> | ||
<div | ||
:for={copyright <- @copyright} | ||
class={[ | ||
"flex flex-col self-center", | ||
Map.get(copyright, :class, "") | ||
]} | ||
> | ||
<%= if Map.get(copyright, :title, "") != "" do %> | ||
<h4 class={["font-bold my-2", Map.get(copyright, :title_class, "")]}> | ||
<%= Map.get(copyright, :title, "") %> | ||
</h4> | ||
<% end %> | ||
<div class={["flex flex-col", Map.get(copyright, :body_class, "")]}> | ||
<%= render_slot(copyright) %> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> | ||
""" | ||
end | ||
end |
Oops, something went wrong.