-
Notifications
You must be signed in to change notification settings - Fork 0
/
page_footer.ex
117 lines (106 loc) · 2.48 KB
/
page_footer.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
defmodule PhoenixDuskmoon.PageFooter do
@moduledoc """
render Page footer
"""
use PhoenixDuskmoon, :html
@doc """
Generates a Page footer.
## Example
<.dm_page_footer>
<:section class="">
ABC
</:section>
<:copyright>
(^_^)
</:copyright>
</.dm_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 dm_page_footer(assigns) do
~H"""
<footer class={[
"w-full min-h-fit",
"flex flex-col",
"py-20",
@class
]}>
<div class={[
"container mx-auto px-4",
"flex flex-col",
]}>
<div class={[
"grid grid-cols-2 md:grid-cols-3 gap-4",
"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