irelia 0.0.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +32 -10
  3. data/Rakefile +18 -2
  4. data/app/assets/config/irelia_manifest.js +2 -0
  5. data/app/assets/dist/javascripts/irelia.js +1 -0
  6. data/app/assets/dist/stylesheets/irelia.css +1 -0
  7. data/app/assets/src/main.js +2 -0
  8. data/app/assets/src/main.pcss +245 -0
  9. data/app/components/index.js +7 -0
  10. data/app/components/index.pcss +38 -0
  11. data/app/components/irelia/app_shell/component.html.erb +18 -0
  12. data/app/components/irelia/app_shell/component.rb +14 -0
  13. data/app/components/irelia/app_shell/index.pcss +20 -0
  14. data/app/components/irelia/app_shell/preview.rb +9 -0
  15. data/app/components/irelia/app_shell/previews/default.html.erb +21 -0
  16. data/app/components/irelia/avatar/component.html.erb +3 -0
  17. data/app/components/irelia/avatar/component.rb +16 -0
  18. data/app/components/irelia/avatar/index.pcss +8 -0
  19. data/app/components/irelia/avatar/preview.rb +9 -0
  20. data/app/components/irelia/breadcrumbs/component.html.erb +12 -0
  21. data/app/components/irelia/breadcrumbs/component.rb +18 -0
  22. data/app/components/irelia/breadcrumbs/index.pcss +16 -0
  23. data/app/components/irelia/breadcrumbs/preview.rb +9 -0
  24. data/app/components/irelia/button/component.html.erb +27 -0
  25. data/app/components/irelia/button/component.rb +40 -0
  26. data/app/components/irelia/button/index.pcss +57 -0
  27. data/app/components/irelia/button/preview.rb +79 -0
  28. data/app/components/irelia/card/component.html.erb +5 -0
  29. data/app/components/irelia/card/component.rb +15 -0
  30. data/app/components/irelia/card/index.pcss +9 -0
  31. data/app/components/irelia/card/preview.rb +18 -0
  32. data/app/components/irelia/component.rb +55 -0
  33. data/app/components/irelia/component_preview.rb +7 -0
  34. data/app/components/irelia/container/component.rb +30 -0
  35. data/app/components/irelia/container/index.pcss +45 -0
  36. data/app/components/irelia/container/preview.rb +18 -0
  37. data/app/components/irelia/div/component.html.erb +3 -0
  38. data/app/components/irelia/div/component.rb +15 -0
  39. data/app/components/irelia/div/index.pcss +7 -0
  40. data/app/components/irelia/divider/component.html.erb +7 -0
  41. data/app/components/irelia/divider/component.rb +10 -0
  42. data/app/components/irelia/divider/index.pcss +15 -0
  43. data/app/components/irelia/dropdown/component.html.erb +17 -0
  44. data/app/components/irelia/dropdown/component.rb +52 -0
  45. data/app/components/irelia/dropdown/controller.js +14 -0
  46. data/app/components/irelia/dropdown/index.pcss +37 -0
  47. data/app/components/irelia/dropdown/preview.rb +42 -0
  48. data/app/components/irelia/dropdown/previews/direction_up.html.erb +10 -0
  49. data/app/components/irelia/empty_collection/component.html.erb +19 -0
  50. data/app/components/irelia/empty_collection/component.rb +15 -0
  51. data/app/components/irelia/empty_collection/index.pcss +23 -0
  52. data/app/components/irelia/empty_collection/preview.rb +9 -0
  53. data/app/components/irelia/flex/component.html.erb +3 -0
  54. data/app/components/irelia/flex/component.rb +21 -0
  55. data/app/components/irelia/flex/index.pcss +37 -0
  56. data/app/components/irelia/form/base/component.rb +51 -0
  57. data/app/components/irelia/form/base/index.pcss +7 -0
  58. data/app/components/irelia/form/email_field/component.html.erb +3 -0
  59. data/app/components/irelia/form/email_field/component.rb +10 -0
  60. data/app/components/irelia/form/email_field/index.pcss +7 -0
  61. data/app/components/irelia/form/email_field/preview.rb +9 -0
  62. data/app/components/irelia/form/email_field/previews/default.html.erb +3 -0
  63. data/app/components/irelia/form/group/component.html.erb +19 -0
  64. data/app/components/irelia/form/group/component.rb +26 -0
  65. data/app/components/irelia/form/group/index.pcss +32 -0
  66. data/app/components/irelia/form/password_field/component.html.erb +3 -0
  67. data/app/components/irelia/form/password_field/component.rb +10 -0
  68. data/app/components/irelia/form/password_field/index.pcss +7 -0
  69. data/app/components/irelia/form/password_field/preview.rb +9 -0
  70. data/app/components/irelia/form/password_field/previews/default.html.erb +3 -0
  71. data/app/components/irelia/form/select/component.html.erb +3 -0
  72. data/app/components/irelia/form/select/component.rb +18 -0
  73. data/app/components/irelia/form/select/index.pcss +7 -0
  74. data/app/components/irelia/form/select/preview.rb +9 -0
  75. data/app/components/irelia/form/select/previews/default.html.erb +3 -0
  76. data/app/components/irelia/form/text_field/component.html.erb +3 -0
  77. data/app/components/irelia/form/text_field/component.rb +10 -0
  78. data/app/components/irelia/form/text_field/index.pcss +7 -0
  79. data/app/components/irelia/form/text_field/preview.rb +9 -0
  80. data/app/components/irelia/form/text_field/previews/default.html.erb +3 -0
  81. data/app/components/irelia/html/component.html.erb +3 -0
  82. data/app/components/irelia/html/component.rb +10 -0
  83. data/app/components/irelia/html/index.pcss +16 -0
  84. data/app/components/irelia/html/preview.rb +9 -0
  85. data/app/components/irelia/icon/component.rb +18 -0
  86. data/app/components/irelia/icon/index.pcss +7 -0
  87. data/app/components/irelia/icon/preview.rb +10 -0
  88. data/app/components/irelia/icon/previews/font_awesome.html.erb +23 -0
  89. data/app/components/irelia/modal/component.html.erb +28 -0
  90. data/app/components/irelia/modal/component.rb +29 -0
  91. data/app/components/irelia/modal/controller.js +50 -0
  92. data/app/components/irelia/modal/index.pcss +41 -0
  93. data/app/components/irelia/modal/preview.rb +12 -0
  94. data/app/components/irelia/modal/previews/remote_content.html.erb +6 -0
  95. data/app/components/irelia/modal/previews/static_content.html.erb +4 -0
  96. data/app/components/irelia/navbar/brand/component.rb +25 -0
  97. data/app/components/irelia/navbar/brand/index.pcss +9 -0
  98. data/app/components/irelia/navbar/brand/preview.rb +10 -0
  99. data/app/components/irelia/navbar/component.html.erb +10 -0
  100. data/app/components/irelia/navbar/component.rb +20 -0
  101. data/app/components/irelia/navbar/index.pcss +13 -0
  102. data/app/components/irelia/navbar/navigation/component.html.erb +5 -0
  103. data/app/components/irelia/navbar/navigation/component.rb +15 -0
  104. data/app/components/irelia/navbar/navigation/index.pcss +9 -0
  105. data/app/components/irelia/navbar/navigation/link/component.html.erb +5 -0
  106. data/app/components/irelia/navbar/navigation/link/component.rb +18 -0
  107. data/app/components/irelia/navbar/navigation/link/index.pcss +13 -0
  108. data/app/components/irelia/navbar/navigation/link/preview.rb +10 -0
  109. data/app/components/irelia/navbar/navigation/preview.rb +15 -0
  110. data/app/components/irelia/navbar/preview.rb +17 -0
  111. data/app/components/irelia/navbar/previews/default.html.erb +19 -0
  112. data/app/components/irelia/navbar/previews/full_width.html.erb +19 -0
  113. data/app/components/irelia/navbar/previews/navigation_right.html.erb +19 -0
  114. data/app/components/irelia/navbar/section/component.html.erb +3 -0
  115. data/app/components/irelia/navbar/section/component.rb +13 -0
  116. data/app/components/irelia/navbar/section/index.pcss +8 -0
  117. data/app/components/irelia/navbar/separator/component.rb +14 -0
  118. data/app/components/irelia/navbar/separator/index.pcss +8 -0
  119. data/app/components/irelia/navigation/component.html.erb +7 -0
  120. data/app/components/irelia/navigation/component.rb +23 -0
  121. data/app/components/irelia/navigation/index.pcss +7 -0
  122. data/app/components/irelia/navigation/preview.rb +14 -0
  123. data/app/components/irelia/notification/component.html.erb +9 -0
  124. data/app/components/irelia/notification/component.rb +27 -0
  125. data/app/components/irelia/notification/index.pcss +41 -0
  126. data/app/components/irelia/notification/preview.rb +22 -0
  127. data/app/components/irelia/page_header/component.html.erb +15 -0
  128. data/app/components/irelia/page_header/component.rb +17 -0
  129. data/app/components/irelia/page_header/index.pcss +36 -0
  130. data/app/components/irelia/page_header/preview.rb +13 -0
  131. data/app/components/irelia/sidebar/brand/component.html.erb +6 -0
  132. data/app/components/irelia/sidebar/brand/component.rb +19 -0
  133. data/app/components/irelia/sidebar/brand/index.pcss +13 -0
  134. data/app/components/irelia/sidebar/brand/preview.rb +10 -0
  135. data/app/components/irelia/sidebar/component.html.erb +8 -0
  136. data/app/components/irelia/sidebar/component.rb +16 -0
  137. data/app/components/irelia/sidebar/index.pcss +12 -0
  138. data/app/components/irelia/sidebar/navigation/component.html.erb +5 -0
  139. data/app/components/irelia/sidebar/navigation/component.rb +12 -0
  140. data/app/components/irelia/sidebar/navigation/index.pcss +8 -0
  141. data/app/components/irelia/sidebar/navigation/link/component.html.erb +10 -0
  142. data/app/components/irelia/sidebar/navigation/link/component.rb +26 -0
  143. data/app/components/irelia/sidebar/navigation/link/index.pcss +20 -0
  144. data/app/components/irelia/sidebar/navigation/link/preview.rb +14 -0
  145. data/app/components/irelia/sidebar/navigation/preview.rb +16 -0
  146. data/app/components/irelia/sidebar/preview.rb +9 -0
  147. data/app/components/irelia/sidebar/previews/default.html.erb +12 -0
  148. data/app/components/irelia/sidebar/section/component.html.erb +3 -0
  149. data/app/components/irelia/sidebar/section/component.rb +16 -0
  150. data/app/components/irelia/sidebar/section/index.pcss +11 -0
  151. data/app/components/irelia/split_screen/component.html.erb +8 -0
  152. data/app/components/irelia/split_screen/component.rb +18 -0
  153. data/app/components/irelia/split_screen/index.pcss +35 -0
  154. data/app/components/irelia/split_screen/preview.rb +12 -0
  155. data/app/components/irelia/stack/component.html.erb +3 -0
  156. data/app/components/irelia/stack/component.rb +21 -0
  157. data/app/components/irelia/stack/index.pcss +25 -0
  158. data/app/components/irelia/stack/preview.rb +47 -0
  159. data/app/components/irelia/stack/previews/default.html.erb +5 -0
  160. data/app/components/irelia/stack/previews/horizontal.html.erb +5 -0
  161. data/app/components/irelia/stack/previews/vertical.html.erb +5 -0
  162. data/app/components/irelia/table/component.html.erb +23 -0
  163. data/app/components/irelia/table/component.rb +31 -0
  164. data/app/components/irelia/table/index.pcss +32 -0
  165. data/app/components/irelia/table/preview.rb +9 -0
  166. data/app/components/irelia/table/previews/default.html.erb +19 -0
  167. data/app/components/irelia/table/row/component.html.erb +5 -0
  168. data/app/components/irelia/table/row/component.rb +34 -0
  169. data/app/components/irelia/table/row/index.pcss +7 -0
  170. data/app/helpers/irelia/components_helper.rb +62 -0
  171. data/app/helpers/irelia/form_helper.rb +9 -0
  172. data/app/helpers/irelia/head_helper.rb +7 -0
  173. data/app/views/irelia/_head.html.erb +25 -0
  174. data/lib/irelia/config.rb +18 -0
  175. data/lib/irelia/engine.rb +18 -0
  176. data/lib/irelia/form_builder.rb +48 -0
  177. data/lib/irelia/options/fixed.rb +26 -0
  178. data/lib/irelia/options/flex/direction.rb +22 -0
  179. data/lib/irelia/options/flex/gap.rb +25 -0
  180. data/lib/irelia/options/flex/grow.rb +21 -0
  181. data/lib/irelia/options/flex/items.rb +25 -0
  182. data/lib/irelia/options/flex/justify.rb +27 -0
  183. data/lib/irelia/options/padding.rb +46 -0
  184. data/lib/irelia/options/text_formatting.rb +30 -0
  185. data/lib/irelia/options/width.rb +19 -0
  186. data/lib/irelia/version.rb +1 -1
  187. data/lib/irelia.rb +20 -1
  188. metadata +236 -16
  189. data/config/routes.rb +0 -2
  190. data/lib/tasks/irelia_tasks.rake +0 -4
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Modal::Component < Irelia::Component
4
+ option :name
5
+ option :title, optional: true
6
+
7
+ renders_one :button, "ToggleButton"
8
+
9
+ def variants
10
+ class_names(
11
+ "irelia-modal",
12
+ "irelia-modal--default": variant == :default,
13
+ "irelia-modal--with-title": title.present?
14
+ )
15
+ end
16
+
17
+ def before_render
18
+ raise "Missing button component" if content && button.nil?
19
+ end
20
+
21
+ class ToggleButton < Irelia::Button::Component
22
+ def initialize(**options)
23
+ options[:html_options] ||= {}
24
+ options[:html_options]["data"] = { "action": "irelia-modal#open" }
25
+
26
+ super(**options)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,50 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ export default class extends Controller {
4
+ static targets = ["container", "frame", "loader", "background"];
5
+
6
+ connect() {
7
+ this.observer = new MutationObserver(this.frameMutated.bind(this));
8
+ this.observer.observe(this.frameTarget, {
9
+ attributes: true,
10
+ childList: false,
11
+ characterData: false,
12
+ });
13
+ }
14
+
15
+ disconnect() {
16
+ this.observer.disconnect();
17
+ delete this.observer;
18
+ this.close();
19
+ }
20
+
21
+ frameMutated() {
22
+ if (this.frameTarget.hasAttribute("busy")) {
23
+ this.loaderTarget.classList.remove("hidden");
24
+ this.open();
25
+ } else {
26
+ this.loaderTarget.classList.add("hidden");
27
+ }
28
+ }
29
+
30
+ open() {
31
+ // Unhide the modal
32
+ this.containerTarget.classList.remove("hidden");
33
+ }
34
+
35
+ close(e) {
36
+ e.preventDefault();
37
+
38
+ // Hide the modal
39
+ this.containerTarget.classList.add("hidden");
40
+ }
41
+
42
+ closeWithKeyboard(e) {
43
+ if (
44
+ e.keyCode === 27 &&
45
+ !this.containerTarget.classList.contains("hidden")
46
+ ) {
47
+ this.close(e);
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,41 @@
1
+ @layer components {
2
+ .irelia-modal__container {
3
+ @apply fixed top-0 left-0 z-[99] flex items-center justify-center w-screen h-screen px-10;
4
+ }
5
+
6
+ .irelia-modal__background {
7
+ @apply absolute inset-0 w-full h-full bg-black bg-opacity-20;
8
+ }
9
+
10
+ .irelia-modal {
11
+ @apply relative w-full py-6 bg-white px-7 rounded-lg shadow;
12
+
13
+ .irelia-modal__header {
14
+ @apply flex items-center justify-between;
15
+
16
+ h3 {
17
+ @apply text-lg font-bold text-irelia-primary;
18
+ }
19
+ }
20
+
21
+ .irelia-modal__close-button {
22
+ @apply absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 text-gray-600 rounded-full hover:text-gray-800 hover:bg-gray-50;
23
+ }
24
+
25
+ .irelia-modal__content {
26
+ @apply relative w-auto;
27
+ }
28
+ }
29
+
30
+ .irelia-modal--with-title {
31
+ @apply border-b border-irelia-border;
32
+
33
+ .irelia-modal__header {
34
+ @apply border-b border-irelia-border pb-3.5 mb-5;
35
+ }
36
+ }
37
+
38
+ .irelia-modal--default {
39
+ @apply sm:max-w-lg;
40
+ }
41
+ }
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Modal::Preview < Irelia::ComponentPreview
4
+ # You can specify the container class for the default template
5
+ # self.container_class = "w-1/2 border border-gray-300"
6
+ #
7
+ def static_content
8
+ end
9
+
10
+ def remote_content
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ <%= irelia_modal(name: "popup_modal", title: "Remote loaded content") %>
2
+
3
+ <%= irelia_stack do %>
4
+ <%= irelia_button(url: modals_preview_path, modal: "popup_modal") { "Open Modal 1" } %>
5
+ <%= irelia_button(url: modals_preview2_path, modal: "popup_modal") { "Open Modal 2" } %>
6
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <%= irelia_modal(name: "static_modal", title: "Static modal title") do |modal| %>
2
+ <% modal.with_button { "Open modal" } %>
3
+ This is modal with static content.
4
+ <% end %>
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Brand::Component < Irelia::Component
4
+ option :url, default: -> { nil }, optional: true
5
+
6
+ def variants
7
+ class_names(
8
+ "irelia-navbar__brand",
9
+ "irelia-navbar__brand--default": variant == :default
10
+ )
11
+ end
12
+
13
+ def initialize(**options)
14
+ super
15
+
16
+ @tag = @url.present? ? :a : :span
17
+ @html_options[:href] = @url if @url.present?
18
+ end
19
+
20
+ def call
21
+ content_tag(@tag, html_options) do
22
+ content
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,9 @@
1
+ @layer components {
2
+ .irelia-navbar__brand {
3
+ @apply text-xl font-bold;
4
+ }
5
+
6
+ .irelia-navbar__brand--default {
7
+ @apply text-irelia-primary hover:text-irelia-primary-hover transition;
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Brand::Preview < Irelia::ComponentPreview
4
+ # You can specify the container class for the default template
5
+ # self.container_class = "w-1/2 border border-gray-300"
6
+
7
+ def default
8
+ render(Irelia::Navbar::Brand::Component.new(url: "#")) { "Irelia" }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ <%= content_tag :section, html_options do %>
2
+ <%= render(Irelia::Container::Component.new(
3
+ size: full_width ? :full_width : :xl,
4
+ center: true,
5
+ html_options: { class: "irelia-navbar__inner" })) do %>
6
+ <% components.each do |component| %>
7
+ <%= component %>
8
+ <% end %>
9
+ <% end %>
10
+ <% end %>
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Component < Irelia::Component
4
+ option :full_width, default: -> { false }
5
+
6
+ renders_many :components, types: {
7
+ brand: { renders: Irelia::Navbar::Brand::Component, as: :brand },
8
+ navigation: { renders: Irelia::Navbar::Navigation::Component, as: :navigation },
9
+ separator: { renders: Irelia::Navbar::Separator::Component, as: :separator },
10
+ section: { renders: Irelia::Navbar::Section::Component, as: :section }
11
+ }
12
+
13
+ def variants
14
+ class_names(
15
+ "irelia-navbar",
16
+ "irelia-navbar--default": variant == :default,
17
+ "irelia-navbar--full-width": full_width
18
+ )
19
+ end
20
+ end
@@ -0,0 +1,13 @@
1
+ @layer components {
2
+ .irelia-navbar {
3
+ @apply bg-irelia-surface h-[var(--irelia-navbar-height)] sticky left-0 right-0 top-0 z-50 items-center border-irelia-border border-b;
4
+ }
5
+
6
+ .irelia-navbar__inner {
7
+ @apply flex items-center gap-x-10 h-full text-sm;
8
+ }
9
+
10
+ .irelia-navbar--full-width .irelia-navbar__inner {
11
+ @apply px-10;
12
+ }
13
+ }
@@ -0,0 +1,5 @@
1
+ <%= content_tag :div, html_options do %>
2
+ <% links.each do |link| %>
3
+ <%= link %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Navigation::Component < Irelia::Navbar::Section::Component
4
+ # Override to make the default value true
5
+ option :grow, default: -> { true }, in: [ true, false ]
6
+
7
+ renders_many :links, Irelia::Navbar::Navigation::Link::Component
8
+
9
+ def variants
10
+ class_names(
11
+ "irelia-navbar__navigation",
12
+ "irelia-navbar__navigation--default": variant == :default
13
+ )
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ @layer components {
2
+ .irelia-navbar__navigation {
3
+ @apply irelia-navbar__section;
4
+ }
5
+
6
+ .irelia-navbar__navigation--default {
7
+ @apply h-full gap-x-8;
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ <%= link_to url, html_options do %>
2
+ <span class=".irelia-navbar__navigation__link__content">
3
+ <%= content %>
4
+ </span>
5
+ <% end %>
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Navigation::Link::Component < Irelia::Component
4
+ option :url
5
+ option :active, default: -> { false }
6
+
7
+ def variants
8
+ class_names(
9
+ "irelia-navbar__navigation__link",
10
+ "irelia-navbar__navigation__link--default": variant == :default,
11
+ "irelia-navbar__navigation__link--active": active
12
+ )
13
+ end
14
+
15
+ # def call
16
+ # raise "#{self.class.name}: content block is required" if content.nil?
17
+ # end
18
+ end
@@ -0,0 +1,13 @@
1
+ @layer components {
2
+ .irelia-navbar__navigation__link {
3
+ @apply flex;
4
+ }
5
+
6
+ .irelia-navbar__navigation__link--default {
7
+ @apply h-full items-center text-irelia-text hover:text-irelia-primary;
8
+ }
9
+
10
+ .irelia-navbar__navigation__link--default.irelia-navbar__navigation__link--active {
11
+ @apply text-irelia-primary font-bold;
12
+ }
13
+ }
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Navigation::Link::Preview < Irelia::ComponentPreview
4
+ # You can specify the container class for the default template
5
+ # self.container_class = "w-1/2 border border-gray-300"
6
+
7
+ def default
8
+ render(Irelia::Navbar::Navigation::Link::Component.new(url: "#")) { "Navbar link" }
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Navigation::Preview < Irelia::ComponentPreview
4
+ # You can specify the container class for the default template
5
+ # self.container_class = "w-1/2 border border-gray-300"
6
+
7
+ def default
8
+ render(Irelia::Navbar::Navigation::Component.new) do |nav|
9
+ nav.with_link(url: "#", active: true) { "Home" }
10
+ nav.with_link(url: "#") { "Features" }
11
+ nav.with_link(url: "#") { "Pricing" }
12
+ nav.with_link(url: "#") { "Documentation" }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Preview < Irelia::ComponentPreview
4
+ # You can specify the container class for the default template
5
+ # self.container_class = "w-1/2 border border-gray-300"
6
+
7
+ def default
8
+ end
9
+
10
+ # @label Navigation on right side
11
+ def navigation_right
12
+ end
13
+
14
+ # @label Full width (no container)
15
+ def full_width
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ <%= irelia_navbar do |navbar| %>
2
+ <% navbar.with_brand(url: "#") { "Irelia" } %>
3
+
4
+ <%= navbar.with_separator %>
5
+
6
+ <% navbar.with_navigation do |nav| %>
7
+ <%= nav.with_link(url: "#", active: true) { "Home" } %>
8
+ <%= nav.with_link(url: "#") { "Features" } %>
9
+ <%= nav.with_link(url: "#") { "Pricing" } %>
10
+ <%= nav.with_link(url: "#") { "Documentation" } %>
11
+ <% end %>
12
+
13
+ <%= navbar.with_separator %>
14
+
15
+ <%= navbar.with_section do |section| %>
16
+ <%= irelia_button(size: :sm, color: :secondary) { "Sign in" } %>
17
+ <%= irelia_button(size: :sm) { "Create account" } %>
18
+ <% end %>
19
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <%= irelia_navbar(full_width: true) do |navbar| %>
2
+ <% navbar.with_brand(url: "#") { "Irelia" } %>
3
+
4
+ <%= navbar.with_separator %>
5
+
6
+ <% navbar.with_navigation do |nav| %>
7
+ <%= nav.with_link(url: "#", active: true) { "Home" } %>
8
+ <%= nav.with_link(url: "#") { "Features" } %>
9
+ <%= nav.with_link(url: "#") { "Pricing" } %>
10
+ <%= nav.with_link(url: "#") { "Documentation" } %>
11
+ <% end %>
12
+
13
+ <%= navbar.with_separator %>
14
+
15
+ <%= navbar.with_section do |section| %>
16
+ <%= irelia_button(size: :sm, color: :secondary) { "Sign in" } %>
17
+ <%= irelia_button(size: :sm) { "Create account" } %>
18
+ <% end %>
19
+ <% end %>
@@ -0,0 +1,19 @@
1
+ <%= irelia_navbar do |navbar| %>
2
+ <% navbar.with_brand(url: "#") { "Irelia" } %>
3
+
4
+ <%= navbar.with_separator %>
5
+
6
+ <% navbar.with_navigation(justify: :end) do |nav| %>
7
+ <%= nav.with_link(url: "#", active: true) { "Home" } %>
8
+ <%= nav.with_link(url: "#") { "Features" } %>
9
+ <%= nav.with_link(url: "#") { "Pricing" } %>
10
+ <%= nav.with_link(url: "#") { "Documentation" } %>
11
+ <% end %>
12
+
13
+ <%= navbar.with_separator %>
14
+
15
+ <%= navbar.with_section do |section| %>
16
+ <%= irelia_button(size: :sm, color: :secondary) { "Sign in" } %>
17
+ <%= irelia_button(size: :sm) { "Create account" } %>
18
+ <% end %>
19
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <%= content_tag :div, html_options do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Section::Component < Irelia::Component
4
+ include Irelia::Options::Flex::Grow
5
+ include Irelia::Options::Flex::Justify
6
+
7
+ def variants
8
+ class_names(
9
+ "irelia-navbar__section",
10
+ "irelia-navbar__section--default": variant == :default
11
+ )
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ @layer components {
2
+ .irelia-navbar__section {
3
+ @apply flex items-center gap-x-5;
4
+ }
5
+
6
+ .irelia-navbar__section--default {
7
+ }
8
+ }
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navbar::Separator::Component < Irelia::Component
4
+ def variants
5
+ class_names(
6
+ "irelia-navbar__separator",
7
+ "irelia-navbar__separator--default": variant == :default
8
+ )
9
+ end
10
+
11
+ def call
12
+ content_tag(:div, content, html_options)
13
+ end
14
+ end
@@ -0,0 +1,8 @@
1
+ @layer components {
2
+ .irelia-navbar__separator {
3
+ @apply w-[1px] h-[30px] bg-irelia-border;
4
+ }
5
+
6
+ .irelia-navbar__separator--default {
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ <%= content_tag :nav, html_options do %>
2
+ <%= render(Irelia::Stack::Component.new) do %>
3
+ <% links.each do |link| %>
4
+ <%= link %>
5
+ <% end %>
6
+ <% end %>
7
+ <% end %>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navigation::Component < Irelia::Component
4
+ renders_many :links, "NavigationLink"
5
+
6
+ def variants
7
+ class_names(
8
+ "irelia-navigation",
9
+ "irelia-navigation--default": variant == :default
10
+ )
11
+ end
12
+
13
+ class NavigationLink < Irelia::Button::Component
14
+ option :active, default: -> { false }
15
+
16
+ def initialize(**options)
17
+ options[:size] = :sm
18
+ options[:color] = options[:active] ? :primary : :secondary
19
+
20
+ super(**options)
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,7 @@
1
+ @layer components {
2
+ .irelia-navigation {
3
+ }
4
+
5
+ .irelia-navigation--default {
6
+ }
7
+ }
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Navigation::Preview < Irelia::ComponentPreview
4
+ # You can specify the container class for the default template
5
+ # self.container_class = "w-1/2 border border-gray-300"
6
+
7
+ def default
8
+ irelia_navigation do |nav|
9
+ nav.with_link(active: true) { "Profile" }
10
+ nav.with_link { "Messages" }
11
+ nav.with_link { "Gallery" }
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ <%= content_tag :div, html_options do %>
2
+ <div class="icon">
3
+ <%= helpers.irelia_icon { icon_class } %>
4
+ </div>
5
+ <div class="text">
6
+ <% if title %><h5><%= title %></h5><% end %>
7
+ <span><%= content %></span>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Notification::Component < Irelia::Component
4
+ option :variant, default: proc { :notice }, in: %i[notice success warning error]
5
+ option :title, default: -> { nil }, required: false
6
+
7
+ def icon_class
8
+ icons = {
9
+ notice: "fa fa-info-circle",
10
+ success: "fa fa-check-circle",
11
+ warning: "fa fa-exclamation-triangle",
12
+ alert: "fa fa-exclamation-circle"
13
+ }
14
+
15
+ icons[variant]
16
+ end
17
+
18
+ def variants
19
+ class_names(
20
+ "irelia-notification",
21
+ "irelia-notification--notice": variant == :notice,
22
+ "irelia-notification--success": variant == :success,
23
+ "irelia-notification--warning": variant == :warning,
24
+ "irelia-notification--alert": variant == :alert
25
+ )
26
+ end
27
+ end
@@ -0,0 +1,41 @@
1
+ @layer components {
2
+ .irelia-notification {
3
+ @apply relative flex rounded py-4 px-6 w-full shadow-sm;
4
+
5
+ .icon {
6
+ @apply flex items-center justify-center pr-6;
7
+
8
+ .fa {
9
+ @apply w-6 h-6;
10
+ }
11
+ }
12
+
13
+ .text {
14
+ @apply flex flex-col gap-y-0.5 w-full;
15
+
16
+ h5 {
17
+ @apply font-semibold leading-none tracking-tight;
18
+ }
19
+
20
+ span {
21
+ @apply text-sm opacity-80;
22
+ }
23
+ }
24
+ }
25
+
26
+ .irelia-notification--notice {
27
+ @apply bg-neutral-100 text-neutral-600;
28
+ }
29
+
30
+ .irelia-notification--success {
31
+ @apply bg-green-50 text-green-600;
32
+ }
33
+
34
+ .irelia-notification--warning {
35
+ @apply bg-yellow-50 text-yellow-600;
36
+ }
37
+
38
+ .irelia-notification--alert {
39
+ @apply bg-red-50 text-red-600;
40
+ }
41
+ }
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Irelia::Notification::Preview < Irelia::ComponentPreview
4
+ # You can specify the container class for the default template
5
+ # self.container_class = "w-1/2 border border-gray-300"
6
+
7
+ def default
8
+ irelia_notification { "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }
9
+ end
10
+
11
+ def success
12
+ irelia_notification(variant: :success) { "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }
13
+ end
14
+
15
+ def warning
16
+ irelia_notification(variant: :warning) { "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }
17
+ end
18
+
19
+ def alert
20
+ irelia_notification(variant: :alert) { "Lorem ipsum dolor sit amet, consectetur adipiscing elit." }
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ <%= content_tag :header, html_options do %>
2
+ <div class="irelia-page-header__inner">
3
+ <h1><%= title %></h1>
4
+ <% if subline %>
5
+ <p><%= subline %></p>
6
+ <% end %>
7
+ </div>
8
+ <div class="irelia-page-header__action-buttons">
9
+ <%= render(Irelia::Stack::Component.new) do %>
10
+ <% buttons.each do |button| %>
11
+ <%= button %>
12
+ <% end %>
13
+ <% end %>
14
+ </div>
15
+ <% end %>