irelia 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -10
- data/Rakefile +18 -4
- data/app/assets/config/irelia_manifest.js +2 -2
- data/app/assets/dist/javascripts/irelia.js +1 -0
- data/app/assets/dist/stylesheets/irelia.css +1 -0
- data/app/assets/src/main.js +2 -0
- data/app/assets/src/main.pcss +245 -0
- data/app/components/index.js +7 -0
- data/app/components/index.pcss +38 -0
- data/app/components/irelia/app_shell/component.html.erb +18 -0
- data/app/components/irelia/app_shell/component.rb +14 -0
- data/app/components/irelia/app_shell/index.pcss +20 -0
- data/app/{frontend/components/page/header → components/irelia/app_shell}/preview.rb +1 -1
- data/app/components/irelia/app_shell/previews/default.html.erb +21 -0
- data/app/components/irelia/avatar/component.html.erb +3 -0
- data/app/components/irelia/avatar/component.rb +16 -0
- data/app/components/irelia/avatar/index.pcss +8 -0
- data/{lib/generators/view_component/templates/preview.rb.tt → app/components/irelia/avatar/preview.rb} +1 -1
- data/app/components/irelia/breadcrumbs/component.html.erb +12 -0
- data/app/components/irelia/breadcrumbs/component.rb +18 -0
- data/app/components/irelia/breadcrumbs/index.pcss +16 -0
- data/app/{frontend/components/page/container → components/irelia/breadcrumbs}/preview.rb +1 -1
- data/app/components/irelia/button/component.html.erb +27 -0
- data/app/components/irelia/button/component.rb +40 -0
- data/app/components/irelia/button/index.pcss +57 -0
- data/app/components/irelia/button/preview.rb +79 -0
- data/app/components/irelia/card/component.html.erb +5 -0
- data/app/components/irelia/card/component.rb +15 -0
- data/app/components/irelia/card/index.pcss +9 -0
- data/app/components/irelia/card/preview.rb +18 -0
- data/app/components/irelia/component.rb +55 -0
- data/app/components/irelia/component_preview.rb +7 -0
- data/app/components/irelia/container/component.rb +30 -0
- data/app/components/irelia/container/index.pcss +45 -0
- data/app/components/irelia/container/preview.rb +18 -0
- data/app/components/irelia/div/component.html.erb +3 -0
- data/app/components/irelia/div/component.rb +15 -0
- data/app/components/irelia/div/index.pcss +7 -0
- data/app/components/irelia/divider/component.html.erb +7 -0
- data/app/components/irelia/divider/component.rb +10 -0
- data/app/components/irelia/divider/index.pcss +15 -0
- data/app/components/irelia/dropdown/component.html.erb +17 -0
- data/app/components/irelia/dropdown/component.rb +52 -0
- data/app/components/irelia/dropdown/controller.js +14 -0
- data/app/components/irelia/dropdown/index.pcss +37 -0
- data/app/components/irelia/dropdown/preview.rb +42 -0
- data/app/components/irelia/dropdown/previews/direction_up.html.erb +10 -0
- data/app/components/irelia/empty_collection/component.html.erb +19 -0
- data/app/components/irelia/empty_collection/component.rb +15 -0
- data/app/components/irelia/empty_collection/index.pcss +23 -0
- data/app/components/irelia/empty_collection/preview.rb +9 -0
- data/app/components/irelia/flex/component.html.erb +3 -0
- data/app/components/irelia/flex/component.rb +21 -0
- data/app/components/irelia/flex/index.pcss +37 -0
- data/app/components/irelia/form/base/component.rb +51 -0
- data/app/components/irelia/form/base/index.pcss +7 -0
- data/app/components/irelia/form/email_field/component.html.erb +3 -0
- data/app/components/irelia/form/email_field/component.rb +10 -0
- data/app/components/irelia/form/email_field/index.pcss +7 -0
- data/app/{frontend/components/page/breadcrumbs → components/irelia/form/email_field}/preview.rb +1 -1
- data/app/components/irelia/form/email_field/previews/default.html.erb +3 -0
- data/app/components/irelia/form/group/component.html.erb +19 -0
- data/app/components/irelia/form/group/component.rb +26 -0
- data/app/components/irelia/form/group/index.pcss +32 -0
- data/app/components/irelia/form/password_field/component.html.erb +3 -0
- data/app/components/irelia/form/password_field/component.rb +10 -0
- data/app/components/irelia/form/password_field/index.pcss +7 -0
- data/app/components/irelia/form/password_field/preview.rb +9 -0
- data/app/components/irelia/form/password_field/previews/default.html.erb +3 -0
- data/app/components/irelia/form/select/component.html.erb +3 -0
- data/app/components/irelia/form/select/component.rb +18 -0
- data/app/components/irelia/form/select/index.pcss +7 -0
- data/app/components/irelia/form/select/preview.rb +9 -0
- data/app/components/irelia/form/select/previews/default.html.erb +3 -0
- data/app/components/irelia/form/text_field/component.html.erb +3 -0
- data/app/components/irelia/form/text_field/component.rb +10 -0
- data/app/components/irelia/form/text_field/index.pcss +7 -0
- data/app/components/irelia/form/text_field/preview.rb +9 -0
- data/app/components/irelia/form/text_field/previews/default.html.erb +3 -0
- data/app/components/irelia/html/component.html.erb +3 -0
- data/app/components/irelia/html/component.rb +10 -0
- data/app/components/irelia/html/index.pcss +16 -0
- data/app/components/irelia/html/preview.rb +9 -0
- data/app/components/irelia/icon/component.rb +18 -0
- data/app/components/irelia/icon/index.pcss +7 -0
- data/app/components/irelia/icon/preview.rb +10 -0
- data/app/components/irelia/icon/previews/font_awesome.html.erb +23 -0
- data/app/components/irelia/modal/component.html.erb +28 -0
- data/app/components/irelia/modal/component.rb +29 -0
- data/app/components/irelia/modal/controller.js +50 -0
- data/app/components/irelia/modal/index.pcss +41 -0
- data/app/{frontend/components/navbar/select_account → components/irelia/modal}/preview.rb +5 -2
- data/app/components/irelia/modal/previews/remote_content.html.erb +6 -0
- data/app/components/irelia/modal/previews/static_content.html.erb +4 -0
- data/app/components/irelia/navbar/brand/component.rb +25 -0
- data/app/components/irelia/navbar/brand/index.pcss +9 -0
- data/app/components/irelia/navbar/brand/preview.rb +10 -0
- data/app/components/irelia/navbar/component.html.erb +10 -0
- data/app/components/irelia/navbar/component.rb +20 -0
- data/app/components/irelia/navbar/index.pcss +13 -0
- data/app/components/irelia/navbar/navigation/component.html.erb +5 -0
- data/app/components/irelia/navbar/navigation/component.rb +15 -0
- data/app/components/irelia/navbar/navigation/index.pcss +9 -0
- data/app/components/irelia/navbar/navigation/link/component.html.erb +5 -0
- data/app/components/irelia/navbar/navigation/link/component.rb +18 -0
- data/app/components/irelia/navbar/navigation/link/index.pcss +13 -0
- data/app/components/irelia/navbar/navigation/link/preview.rb +10 -0
- data/app/components/irelia/navbar/navigation/preview.rb +15 -0
- data/app/components/irelia/navbar/preview.rb +17 -0
- data/app/components/irelia/navbar/previews/default.html.erb +19 -0
- data/app/components/irelia/navbar/previews/full_width.html.erb +19 -0
- data/app/components/irelia/navbar/previews/navigation_right.html.erb +19 -0
- data/app/components/irelia/navbar/section/component.html.erb +3 -0
- data/app/components/irelia/navbar/section/component.rb +13 -0
- data/app/components/irelia/navbar/section/index.pcss +8 -0
- data/app/components/irelia/navbar/separator/component.rb +14 -0
- data/app/components/irelia/navbar/separator/index.pcss +8 -0
- data/app/components/irelia/navigation/component.html.erb +7 -0
- data/app/components/irelia/navigation/component.rb +23 -0
- data/app/components/irelia/navigation/index.pcss +7 -0
- data/app/components/irelia/navigation/preview.rb +14 -0
- data/app/components/irelia/notification/component.html.erb +9 -0
- data/app/components/irelia/notification/component.rb +27 -0
- data/app/components/irelia/notification/index.pcss +41 -0
- data/app/components/irelia/notification/preview.rb +22 -0
- data/app/components/irelia/page_header/component.html.erb +15 -0
- data/app/components/irelia/page_header/component.rb +17 -0
- data/app/components/irelia/page_header/index.pcss +36 -0
- data/app/components/irelia/page_header/preview.rb +13 -0
- data/app/components/irelia/sidebar/brand/component.html.erb +6 -0
- data/app/components/irelia/sidebar/brand/component.rb +19 -0
- data/app/components/irelia/sidebar/brand/index.pcss +13 -0
- data/app/components/irelia/sidebar/brand/preview.rb +10 -0
- data/app/components/irelia/sidebar/component.html.erb +8 -0
- data/app/components/irelia/sidebar/component.rb +16 -0
- data/app/components/irelia/sidebar/index.pcss +12 -0
- data/app/components/irelia/sidebar/navigation/component.html.erb +5 -0
- data/app/components/irelia/sidebar/navigation/component.rb +12 -0
- data/app/components/irelia/sidebar/navigation/index.pcss +8 -0
- data/app/components/irelia/sidebar/navigation/link/component.html.erb +10 -0
- data/app/components/irelia/sidebar/navigation/link/component.rb +26 -0
- data/app/components/irelia/sidebar/navigation/link/index.pcss +20 -0
- data/app/components/irelia/sidebar/navigation/link/preview.rb +14 -0
- data/app/components/irelia/sidebar/navigation/preview.rb +16 -0
- data/app/components/irelia/sidebar/preview.rb +9 -0
- data/app/components/irelia/sidebar/previews/default.html.erb +12 -0
- data/app/components/irelia/sidebar/section/component.html.erb +3 -0
- data/app/components/irelia/sidebar/section/component.rb +16 -0
- data/app/components/irelia/sidebar/section/index.pcss +11 -0
- data/app/components/irelia/split_screen/component.html.erb +8 -0
- data/app/components/irelia/split_screen/component.rb +18 -0
- data/app/components/irelia/split_screen/index.pcss +35 -0
- data/app/components/irelia/split_screen/preview.rb +12 -0
- data/app/components/irelia/stack/component.html.erb +3 -0
- data/app/components/irelia/stack/component.rb +21 -0
- data/app/components/irelia/stack/index.pcss +25 -0
- data/app/components/irelia/stack/preview.rb +47 -0
- data/app/components/irelia/stack/previews/default.html.erb +5 -0
- data/app/components/irelia/stack/previews/horizontal.html.erb +5 -0
- data/app/components/irelia/stack/previews/vertical.html.erb +5 -0
- data/app/components/irelia/table/component.html.erb +23 -0
- data/app/components/irelia/table/component.rb +31 -0
- data/app/components/irelia/table/index.pcss +32 -0
- data/app/components/irelia/table/preview.rb +9 -0
- data/app/components/irelia/table/previews/default.html.erb +19 -0
- data/app/components/irelia/table/row/component.html.erb +5 -0
- data/app/components/irelia/table/row/component.rb +34 -0
- data/app/components/irelia/table/row/index.pcss +7 -0
- data/app/helpers/irelia/components_helper.rb +62 -0
- data/app/helpers/irelia/form_helper.rb +9 -0
- data/app/helpers/irelia/head_helper.rb +7 -0
- data/app/views/irelia/_head.html.erb +25 -0
- data/lib/irelia/config.rb +18 -0
- data/lib/irelia/engine.rb +13 -11
- data/lib/irelia/form_builder.rb +48 -0
- data/lib/irelia/options/fixed.rb +26 -0
- data/lib/irelia/options/flex/direction.rb +22 -0
- data/lib/irelia/options/flex/gap.rb +25 -0
- data/lib/irelia/options/flex/grow.rb +21 -0
- data/lib/irelia/options/flex/items.rb +25 -0
- data/lib/irelia/options/flex/justify.rb +27 -0
- data/lib/irelia/options/padding.rb +46 -0
- data/lib/irelia/options/text_formatting.rb +30 -0
- data/lib/irelia/options/width.rb +19 -0
- data/lib/irelia/version.rb +1 -1
- data/lib/irelia.rb +20 -24
- metadata +199 -168
- data/app/frontend/components/application_view_component.rb +0 -5
- data/app/frontend/components/application_view_component_preview.rb +0 -5
- data/app/frontend/components/navbar/button/component.html.erb +0 -8
- data/app/frontend/components/navbar/button/component.rb +0 -13
- data/app/frontend/components/navbar/button/preview.rb +0 -12
- data/app/frontend/components/navbar/container/component.html.erb +0 -5
- data/app/frontend/components/navbar/container/component.rb +0 -8
- data/app/frontend/components/navbar/container/preview.rb +0 -12
- data/app/frontend/components/navbar/dark_mode_switcher/component.html.erb +0 -4
- data/app/frontend/components/navbar/dark_mode_switcher/component.rb +0 -8
- data/app/frontend/components/navbar/dark_mode_switcher/preview.rb +0 -12
- data/app/frontend/components/navbar/menu_items/component.html.erb +0 -3
- data/app/frontend/components/navbar/menu_items/component.rb +0 -8
- data/app/frontend/components/navbar/menu_items/preview.rb +0 -12
- data/app/frontend/components/navbar/navlink/component.html.erb +0 -8
- data/app/frontend/components/navbar/navlink/component.rb +0 -13
- data/app/frontend/components/navbar/navlink/preview.rb +0 -12
- data/app/frontend/components/navbar/right_section/component.html.erb +0 -3
- data/app/frontend/components/navbar/right_section/component.rb +0 -8
- data/app/frontend/components/navbar/right_section/preview.rb +0 -12
- data/app/frontend/components/navbar/select_account/component.html.erb +0 -36
- data/app/frontend/components/navbar/select_account/component.rb +0 -6
- data/app/frontend/components/navbar/separator/component.html.erb +0 -1
- data/app/frontend/components/navbar/separator/component.rb +0 -7
- data/app/frontend/components/navbar/separator/preview.rb +0 -12
- data/app/frontend/components/page/breadcrumbs/component.html.erb +0 -16
- data/app/frontend/components/page/breadcrumbs/component.rb +0 -6
- data/app/frontend/components/page/container/component.html.erb +0 -3
- data/app/frontend/components/page/container/component.rb +0 -4
- data/app/frontend/components/page/header/component.html.erb +0 -12
- data/app/frontend/components/page/header/component.rb +0 -6
- data/app/helpers/navbar_helper.rb +0 -35
- data/app/helpers/page_helper.rb +0 -15
- data/app/javascript/controllers/dark_mode_switcher_controller.js +0 -20
- data/app/javascript/controllers/dropdown_controller.js +0 -3
- data/app/views/devise/registrations/new.html.erb +0 -21
- data/app/views/devise/sessions/new.html.erb +0 -18
- data/app/views/layouts/application.html.erb +0 -11
- data/app/views/layouts/devise.html.erb +0 -23
- data/app/views/layouts/mailer.html.erb +0 -13
- data/app/views/layouts/mailer.text.erb +0 -1
- data/app/views/layouts/teamable.html.erb +0 -31
- data/app/views/shared/_head.html.erb +0 -26
- data/app/views/shared/_navbar.html.erb +0 -30
- data/app/views/shared/_navbar_logo.html.erb +0 -3
- data/app/views/teamable/accounts/new.html.erb +0 -10
- data/app/views/teamable/setup/new.html.erb +0 -8
- data/app/views/teamable/shared/_form.html.erb +0 -4
- data/config/importmap.rb +0 -7
- data/config/initializers/devise.rb +0 -313
- data/config/initializers/simple_form.rb +0 -148
- data/config/initializers/view_component.rb +0 -18
- data/lib/generators/irelia/install_generator.rb +0 -19
- data/lib/generators/templates/irelia.rb +0 -14
- data/lib/generators/view_component/USAGE +0 -15
- data/lib/generators/view_component/templates/component.html.erb.tt +0 -1
- data/lib/generators/view_component/templates/component.rb.tt +0 -8
- data/lib/generators/view_component/templates/component_system_test.rb.tt +0 -13
- data/lib/generators/view_component/templates/component_test.rb.tt +0 -19
- data/lib/generators/view_component/view_component_generator.rb +0 -53
@@ -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
|
+
}
|
@@ -1,9 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class
|
3
|
+
class Irelia::Modal::Preview < Irelia::ComponentPreview
|
4
4
|
# You can specify the container class for the default template
|
5
5
|
# self.container_class = "w-1/2 border border-gray-300"
|
6
|
+
#
|
7
|
+
def static_content
|
8
|
+
end
|
6
9
|
|
7
|
-
def
|
10
|
+
def remote_content
|
8
11
|
end
|
9
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,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,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,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,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,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,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,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,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,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 %>
|