power-compass 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +25 -0
  3. data/app/assets/stylesheets/compass/layout.scss +41 -0
  4. data/app/assets/stylesheets/compass/navigation/_all.scss +6 -0
  5. data/app/assets/stylesheets/compass/navigation/_header.scss +168 -0
  6. data/app/assets/stylesheets/compass/navigation/_label.scss +31 -0
  7. data/app/assets/stylesheets/compass/navigation/_main-page-content.scss +61 -0
  8. data/app/assets/stylesheets/compass/navigation/_recent-crumbs.scss +17 -0
  9. data/app/assets/stylesheets/compass/navigation/_sidebar.scss +123 -0
  10. data/app/assets/stylesheets/compass/navigation/_spinner.scss +27 -0
  11. data/app/components/compass/application_component.rb +8 -0
  12. data/app/components/compass/layout/banner.html.erb +3 -0
  13. data/app/components/compass/layout/banner.rb +14 -0
  14. data/app/components/compass/layout/breadcrumb_item.html.erb +20 -0
  15. data/app/components/compass/layout/breadcrumb_item.rb +19 -0
  16. data/app/components/compass/layout/breadcrumbs.html.erb +14 -0
  17. data/app/components/compass/layout/breadcrumbs.rb +9 -0
  18. data/app/components/compass/layout/content_container_component.html.erb +3 -0
  19. data/app/components/compass/layout/content_container_component.rb +9 -0
  20. data/app/components/compass/layout/header/dropdown_menu.html.erb +15 -0
  21. data/app/components/compass/layout/header/dropdown_menu.rb +36 -0
  22. data/app/components/compass/layout/header/logo.html.erb +8 -0
  23. data/app/components/compass/layout/header/logo.rb +17 -0
  24. data/app/components/compass/layout/header/search_input.html.erb +1 -0
  25. data/app/components/compass/layout/header/search_input.rb +11 -0
  26. data/app/components/compass/layout/header/tasks_menu.html.erb +3 -0
  27. data/app/components/compass/layout/header/tasks_menu.rb +12 -0
  28. data/app/components/compass/layout/header.html.erb +23 -0
  29. data/app/components/compass/layout/header.rb +32 -0
  30. data/app/components/compass/layout/impersonation_banner.html.erb +3 -0
  31. data/app/components/compass/layout/impersonation_banner.rb +9 -0
  32. data/app/components/compass/layout/sidebar.html.erb +5 -0
  33. data/app/components/compass/layout/sidebar.rb +9 -0
  34. data/app/components/compass/layout.html.erb +51 -0
  35. data/app/components/compass/layout.rb +44 -0
  36. data/app/components/concerns/compass/config_props.rb +20 -0
  37. data/app/controllers/compass/application_controller.rb +6 -11
  38. data/app/controllers/compass/info_controller.rb +12 -0
  39. data/config/routes.rb +2 -0
  40. data/lib/compass/configuration.rb +1 -0
  41. data/lib/compass/engine.rb +16 -0
  42. data/lib/compass/search/provider.rb +1 -4
  43. data/lib/compass/version.rb +1 -1
  44. data/vendor/assets/stylesheets/compass/layout.css +843 -0
  45. metadata +57 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b310dc5041bdff68ef213139f0d1c1a05059382b47430f31e9b6024b9e7d6720
4
- data.tar.gz: a2e420b773128a5027bf199e5c6384b17ff6fec9bcbaf6ba9ff3427cb35eb9e7
3
+ metadata.gz: 6de7fc7a9466e382286e7ca098f1604b7feed4888f75c14007e074fd5a21d476
4
+ data.tar.gz: a69c7fc91b7505b16a31e36fd46a0899cf66968a2ef23993c6871152c05fd5be
5
5
  SHA512:
6
- metadata.gz: b570ab5a2fa7d4da1bf51cac5e2fcaa5e08396dd89a0cb070a6480cca24c4cebbb2f59cc42d3946ab81fbdc554945d1ed9f08574f662e146df5c0127f23c55b1
7
- data.tar.gz: 7239db58aeb179be84317182ba7db0359744d52775eb12cc2ff31460400d02a6b96922dbaa5d0fef1fdb0ae2912a8a6111e6c3b4dbb7f91f2ba2ac4cbe2a4f9c
6
+ metadata.gz: 0d98a62ed219c206e3b99ce5c719d653f798e427ab08daae854bbbc807b431d9697833c3f1c5ea4b1ecbf652f3e3308481bc1ec5e7f750ea63db4aa2d91890ff
7
+ data.tar.gz: 8b0f6976aee4e2358dcac4d2d9fedc8e5a028ba59b3c89e34d9052a45a3c924d2eae3b8b4dca254474f5125070a8c93a49ff8e15d17330fbaf2bf06f77e6c745
data/Rakefile CHANGED
@@ -10,4 +10,29 @@ RSpec::Core::RakeTask.new(:spec)
10
10
  require "rubocop/rake_task"
11
11
  RuboCop::RakeTask.new(:rubocop)
12
12
 
13
+ namespace :compass do
14
+ desc "Vendorize compiled version of compass/layout.scss for production"
15
+ task :compile do
16
+ gem_root = File.expand_path(__dir__)
17
+ dummy_root = File.join(gem_root, "spec", "dummy")
18
+ raise "Dummy app not found at #{dummy_root}" unless File.directory?(dummy_root)
19
+
20
+ Dir.chdir(dummy_root) do
21
+ ENV["RAILS_ENV"] = "development"
22
+ require File.join(dummy_root, "config", "environment")
23
+ env = Sprockets::Railtie.build_environment(Rails.application)
24
+ asset = env["compass/layout.css"]
25
+ raise "Could not compile compass/layout.css" unless asset
26
+
27
+ out = File.join(gem_root, "vendor", "assets", "stylesheets", "compass", "layout.css")
28
+ FileUtils.mkdir_p(File.dirname(out))
29
+ File.write(out, asset.source)
30
+ puts "Wrote #{out}"
31
+ end
32
+ end
33
+ end
34
+
35
+ # Compile the compass/layout.css file before building the gem
36
+ Rake::Task["build"].enhance %w[compass:compile]
37
+
13
38
  task default: %i[rubocop spec]
@@ -0,0 +1,41 @@
1
+ @import "tokens/index";
2
+
3
+ $navigation-bg: $primary;
4
+ $navigation-height: 60px;
5
+ $navigation-crumbs-height: 30px;
6
+ $full-nav-height: $navigation-height + $navigation-crumbs-height;
7
+ $navigation-zindex: 10010;
8
+
9
+ @import "navigation/all";
10
+
11
+ body {
12
+ margin: 0px;
13
+ min-height: 100%;
14
+ height: auto;
15
+ }
16
+
17
+ html {
18
+ height: 100%;
19
+ }
20
+
21
+ html, body {
22
+ background: $bg_light;
23
+ }
24
+
25
+ // These are here because they were in navigation/_all.scss.
26
+ // They should probably be moved back to, because they're not a compass concern.
27
+ .select2-drop {
28
+ z-index: ($navigation-zindex + 4) !important;
29
+ }
30
+ .popover,
31
+ #colorbox,
32
+ #cboxOverlay,
33
+ #cboxWrapper {
34
+ z-index: ($navigation-zindex + 3) !important;
35
+ }
36
+ .modal {
37
+ z-index: ($navigation-zindex + 2) !important;
38
+ }
39
+ .modal-backdrop {
40
+ z-index: ($navigation-zindex + 1) !important;
41
+ }
@@ -0,0 +1,6 @@
1
+ @import "recent-crumbs";
2
+ @import "label";
3
+ @import "main-page-content";
4
+ @import "sidebar";
5
+ @import "spinner";
6
+ @import "header";
@@ -0,0 +1,168 @@
1
+ @import "tokens/colors";
2
+ @import "tokens/spacing";
3
+ @import "tokens/screen_sizes";
4
+
5
+ @import "tokens/colors";
6
+ @import "tokens/spacing";
7
+
8
+ .nitro-navigation {
9
+ position: sticky;
10
+ position: -webkit-sticky;
11
+ top: 0;
12
+ right: 0;
13
+ width: 100%;
14
+ z-index: $navigation-zindex;
15
+
16
+ .compass-logo {
17
+ display: block;
18
+
19
+ @include break_at($screen-xs-max) {
20
+ display: none;
21
+ }
22
+ }
23
+
24
+ .compass-logo-mobile {
25
+ display: none;
26
+
27
+ @include break_at($screen-xs-max) {
28
+ display: block;
29
+ }
30
+ }
31
+
32
+ .navigation-topbar {
33
+ margin: 0;
34
+ border-bottom: 0;
35
+ position: relative;
36
+ height: 60px;
37
+ box-sizing: border-box;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: space-between;
41
+
42
+ &-left, &-center, &-right {
43
+ position: static;
44
+ padding: 0 $space_lg;
45
+ color: #FFFFFF;
46
+ margin: 2px;
47
+ flex-basis: 33%;
48
+
49
+ @include break_at($screen-md-max) {
50
+ padding: 0 $space_xs;
51
+ }
52
+ }
53
+ }
54
+
55
+ .navigation-topbar-center {
56
+ @include break_at($screen-md-max) {
57
+ flex: 1;
58
+ }
59
+ }
60
+ .navigation-topbar-right {
61
+ color: $white;
62
+ margin: 2px;
63
+
64
+ @include break_at($screen-md-max) {
65
+ flex: 0;
66
+ padding-right: 0px;
67
+ }
68
+
69
+ .impersonating {
70
+ border: 2px solid rgb(255, 112, 52);
71
+ }
72
+
73
+ .dropdown_wrapper {
74
+ .pb_dropdown_container {
75
+ min-width: 280px;
76
+ max-height: calc(100vh - 90px);
77
+
78
+ & > [class*="pb_dropdown_option"][class*="selected"] [class^="pb_body"] {
79
+ color: $text_lt_light !important;
80
+ }
81
+ }
82
+
83
+ div[data-dropdown-custom-trigger] {
84
+ display: block !important;
85
+ }
86
+
87
+ &:has(svg.svg_3x) {
88
+ .pb_dropdown_trigger {
89
+ width: 65px !important;
90
+ }
91
+
92
+ .icon-caret svg.svg_xs {
93
+ position: relative !important;
94
+ right: 10px !important;
95
+ }
96
+ }
97
+
98
+ &:has(svg.svg_2x) {
99
+ .pb_dropdown_trigger {
100
+ width: 45px !important;
101
+ }
102
+
103
+ .icon-caret svg.svg_xs {
104
+ position: relative !important;
105
+ right: 5px !important;
106
+ }
107
+ }
108
+
109
+ .pb_dropdown_trigger img {
110
+ width: 38px;
111
+ border-radius: 1000px;
112
+ }
113
+ }
114
+
115
+ .menu-section-options {
116
+ li {
117
+ padding: 0px;
118
+ svg {
119
+ margin-right: $space_xs;
120
+ }
121
+ }
122
+ a {
123
+ color: $text_lt_light;
124
+ }
125
+ &:hover {
126
+ background-color: $bg_light;
127
+ }
128
+ }
129
+ .pb_dropdown_option_selected_focused,
130
+ .pb_dropdown_option_selected {
131
+ background-color: unset !important;
132
+ }
133
+ [class^="pb_dropdown"] {
134
+ [class*="pb_list_kit"] li {
135
+ padding: 0px !important;
136
+ }
137
+ }
138
+ }
139
+ .navigation-topbar-left {
140
+ @include break_at($screen-md-max) {
141
+ flex: 0;
142
+ padding-left: 0px;
143
+ }
144
+ }
145
+ .nitro-header-breadcrumbs-menu {
146
+ .breadcrumbs-separator {
147
+ width: 1px;
148
+ padding-top: 2px;
149
+ padding-bottom: 2px;
150
+ &::before,
151
+ &::after {
152
+ background: rgba(255, 255, 255, 0.1);
153
+ }
154
+ }
155
+ .breadcrumb-item {
156
+ white-space: nowrap;
157
+ &:hover {
158
+ svg,
159
+ .pb_detail_kit_color_light.dark {
160
+ color: $white !important;
161
+ }
162
+ }
163
+ }
164
+ .breadcrumb-item:first-child {
165
+ min-width: 59px;
166
+ }
167
+ }
168
+ }
@@ -0,0 +1,31 @@
1
+ @import "tokens/screen_sizes";
2
+ @import "tokens/typography";
3
+
4
+ .nitro-navigation {
5
+ .navigation-topbar-label {
6
+ position: absolute;
7
+ left: 60px;
8
+ font-size: 0.75em;
9
+ font-weight: bold;
10
+ color: #FFF;
11
+
12
+ @include break_at($screen-xs-max) {
13
+ left: 40px;
14
+ bottom: 2px;
15
+ font-size: $font_smallest;
16
+ }
17
+
18
+ & > * {
19
+ padding: .15em .8em;
20
+ -webkit-font-smoothing: antialiased;
21
+ -moz-osx-font-smoothing: grayscale;
22
+ line-height: 1;
23
+ white-space: nowrap;
24
+ border-radius: .25em;
25
+
26
+ &:last-child {
27
+ margin-left: 5px;
28
+ }
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,61 @@
1
+ .page-container {
2
+ display: flex;
3
+ flex-direction: column;
4
+ justify-content: flex-start;
5
+ align-items: stretch;
6
+ &.page-container-mobile {
7
+ height: 100%;
8
+ }
9
+ #main-view {
10
+ display: flex;
11
+ flex-direction: row;
12
+ justify-content: flex-start;
13
+ align-items: stretch;
14
+ flex-grow: 1;
15
+ padding: 0;
16
+ margin: 0;
17
+ position: relative;
18
+ .main-page-content {
19
+ flex-grow: 1;
20
+ min-height: 100%;
21
+ overflow-y: visible;
22
+ padding: 30px;
23
+ position: relative;
24
+ overflow-x: auto;
25
+ position: static;
26
+
27
+ .container {
28
+ // For this new layout we need all default responsive bootstrap
29
+ // widths to be max-width instead.
30
+ width: 100%;
31
+ max-width: 1187px;
32
+ }
33
+
34
+ &.full {
35
+ padding: 0;
36
+ }
37
+
38
+ &::after {
39
+ content: "";
40
+ width: 100%;
41
+ display: block;
42
+ float: none;
43
+ clear: both;
44
+ }
45
+ }
46
+
47
+ &.full-width {
48
+ .main-page-content {
49
+ padding: 0;
50
+ }
51
+ }
52
+ }
53
+
54
+ &::after {
55
+ content: "";
56
+ width: 100%;
57
+ display: block;
58
+ float: none;
59
+ clear: both;
60
+ }
61
+ }
@@ -0,0 +1,17 @@
1
+ @import "tokens/opacity";
2
+ @import "tokens/colors";
3
+
4
+ .nitro-navigation {
5
+ $power-navy: #004976;
6
+
7
+ #main-crumbs {
8
+ background: mix($bg_dark, $power-navy);
9
+ padding: 0;
10
+ border: 0;
11
+ border-radius: 0;
12
+ height: $navigation-crumbs-height;
13
+ min-height: $navigation-crumbs-height;
14
+ margin: 0;
15
+ overflow: hidden;
16
+ }
17
+ }
@@ -0,0 +1,123 @@
1
+ @import "tokens/colors";
2
+ @import "tokens/typography";
3
+ @import "tokens/opacity";
4
+ @import "tokens/spacing";
5
+
6
+ $full-nav-height: 92px;
7
+
8
+ .main-page-sidebar {
9
+ transition: width 0.2s ease;
10
+ flex-grow: 0;
11
+ flex-shrink: 0;
12
+ height: calc(100vh - #{$full-nav-height});
13
+ background: white;
14
+ border-right: 1px solid $border_light;
15
+ position: sticky;
16
+ position: -webkit-sticky;
17
+ top: $full-nav-height;
18
+ left: 0;
19
+ z-index: 1000;
20
+ transition: all 0.2s ease-out;
21
+
22
+ .nitro_sidebar {
23
+ height: 100%;
24
+ width: 100%;
25
+ overflow-x: hidden;
26
+ overflow-y: auto;
27
+ scrollbar-width: none;
28
+
29
+ > div:first-child {
30
+ height: 100%; // Needed to vertically center loading state
31
+ }
32
+
33
+ //override needed till updates made in PB
34
+ [class^="pb_nav_list"][class*="_vertical"][class*="_normal"]
35
+ [class*="pb_nav_list_kit_item"][class*="pb_nav_list_item"][class*="_active"][class*="_highlighted_border_none"] {
36
+ box-shadow: inset 3px 0 0 #0056cf !important;
37
+ }
38
+
39
+ .pb_collapsible_content_kit {
40
+ .pb_nav_list_item_link {
41
+ padding-left: 47px !important;
42
+ }
43
+ }
44
+
45
+ .collapsed_nav_icon_container {
46
+ font-size: $font_base + 2;
47
+ }
48
+
49
+ .pb_nav_list_item_text_collapsible {
50
+ overflow: hidden;
51
+ display: -webkit-box;
52
+ line-clamp: 1;
53
+ -webkit-box-orient: vertical;
54
+ }
55
+
56
+ .collapsible_nav_wrapper_active {
57
+ .pb_collapsible_content_kit {
58
+ box-shadow: inset 3px 0 0 $primary !important;
59
+ background-color: $active_light;
60
+ }
61
+ }
62
+ .pb_collapsible_content_kit {
63
+ margin-left: unset !important;
64
+ }
65
+ .pb_nav_list_item_icon_left,
66
+ .pb_nav_list_item_icon_left_collapsible {
67
+ color: $text_lt_light !important;
68
+ font-size: $font_base + 2 !important;
69
+ }
70
+ [class^="pb_nav_list"][class*="_vertical"][class*="_normal"]
71
+ [class*="pb_nav_list_kit_item"][class*="pb_nav_list_item"][class*="_link"]:hover
72
+ [class*="_icon"] {
73
+ color: $primary !important;
74
+ }
75
+ }
76
+ }
77
+
78
+ @mixin mobileDeviceMenu {
79
+ .page-container {
80
+ #main-view {
81
+ .main-page-sidebar {
82
+ position: fixed;
83
+ top: 0;
84
+ left: -420px;
85
+ max-width: 420px;
86
+ height: 100vh;
87
+ z-index: 5000;
88
+ padding-top: $full-nav-height;
89
+
90
+ &-mobile {
91
+ min-height: $navigation-height;
92
+ display: flex;
93
+ color: white;
94
+ }
95
+
96
+ &.mobile-open {
97
+ left: 0;
98
+ width: 100%;
99
+ }
100
+ }
101
+ .main-page-content {
102
+ position: relative;
103
+
104
+ &.mobile-open {
105
+ &::after {
106
+ content: "";
107
+ position: fixed;
108
+ top: 0;
109
+ left: 0;
110
+ width: 100vw;
111
+ height: 100vh;
112
+ background: rgba($text_lt_default, $opacity_3);
113
+ z-index: 4990;
114
+ }
115
+ }
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ @media only screen and (max-width: #{$screen-xs-max}) {
122
+ @include mobileDeviceMenu;
123
+ }
@@ -0,0 +1,27 @@
1
+ @import "tokens/opacity";
2
+ @import "tokens/spacing";
3
+
4
+ .page-container {
5
+ $sky-lighter: #F9FAFB;
6
+ $power-navy: #004976;
7
+
8
+ #spinner {
9
+ position: absolute;
10
+ top: calc(#{$full-nav-height} + #{$space_sm});
11
+ right: $space_sm;
12
+ left: auto;
13
+ bottom: auto;
14
+ z-index: $navigation-zindex + 2;
15
+
16
+ .badge {
17
+ display: inline-block;
18
+ background: rgba($sky-lighter, $opacity_7);
19
+
20
+ svg {
21
+ path {
22
+ fill: $power-navy;
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Compass
4
+ class ApplicationComponent < ::ViewComponent::Base
5
+ include Playbook::Props
6
+ include Playbook::PbKitHelper
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ <%= pb_rails("background", props: background_props) do %>
2
+ <%= content %>
3
+ <% end %>
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Compass
4
+ class Layout
5
+ class Banner < ApplicationComponent
6
+ prop :background
7
+
8
+ def background_props
9
+ others = background || {}
10
+ { display: "block", position: "relative", text_align: "center", **others }
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,20 @@
1
+ <%= pb_rails("flex/flex_item", props: { classname: "breadcrumb-item", cursor: "pointer", height: "100%", padding_x: "xs" }) do %>
2
+ <%= pb_rails("link", props: {
3
+ align_items: "center",
4
+ display: "flex",
5
+ href: url,
6
+ height: "100%",
7
+ justify_content: "center",
8
+ width: "100%",
9
+ text: icon_text
10
+ }) %>
11
+ <% end %>
12
+
13
+ <% if show_separator %>
14
+ <%= pb_rails("section_separator", props: {
15
+ classname: "breadcrumbs-separator",
16
+ height: "100%",
17
+ margin_x: "none",
18
+ orientation: "vertical",
19
+ }) %>
20
+ <% end %>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Compass
4
+ class Layout
5
+ class BreadcrumbItem < ApplicationComponent
6
+ prop :label
7
+ prop :url
8
+ prop :icon
9
+ prop :show_separator
10
+
11
+ def icon_text
12
+ capture do
13
+ concat pb_rails("icon", props: { color: "text_light_dark", icon: }) if icon.present?
14
+ concat pb_rails("detail", props: { color: "light", dark: true, text: label }) if label.present?
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ <%= pb_rails("background", props: {
2
+ background_color: "category_17",
3
+ classname: "nitro-header-breadcrumbs-menu",
4
+ height: "30px",
5
+ id: "main-crumbs",
6
+ min_height: "30px",
7
+ }) do %>
8
+ <%= pb_rails("flex", props: { align: "center", height: "30px", min_height: "30px", vertical: "stretch" }) do %>
9
+ <%= render(Compass::Layout::BreadcrumbItem.new(url: "/", icon: "home", show_separator: true)) %>
10
+ <% breadcrumbs.each_with_index do |breadcrumb, index| %>
11
+ <%= render(Compass::Layout::BreadcrumbItem.new(url: breadcrumb[:url], label: breadcrumb[:label], show_separator: index < breadcrumbs.length - 1)) %>
12
+ <% end %>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Compass
4
+ class Layout
5
+ class Breadcrumbs < ApplicationComponent
6
+ prop :breadcrumbs
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ <div class="new-style">
2
+ <%= content %>
3
+ </div>
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Compass
4
+ class Layout
5
+ class ContentContainerComponent < ApplicationComponent
6
+ prop :content
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ <% if icon.present? %>
2
+ <%= pb_rails("dropdown", props: options) do %>
3
+ <%= pb_rails("dropdown/dropdown_trigger") do %>
4
+ <%= pb_rails("flex", props: { align_items: "center", cursor: "pointer", classname: icon_wrapper_classname }) do %>
5
+ <%= pb_rails(pb_component, props: icon_props) %>
6
+ <%= pb_rails("icon", props: { icon: "caret-down-solid", size: "xs" }) %>
7
+ <% end %>
8
+ <% end %>
9
+ <%= pb_rails("dropdown/dropdown_container", props: { right: { inset: true, value: "xxs" }, padding_y: "sm" }) do %>
10
+ <%= component ? render(component) : content %>
11
+ <% end %>
12
+ <% end %>
13
+ <% else %>
14
+ <%= component ? render(component) : content %>
15
+ <% end %>
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Compass
4
+ class Layout
5
+ class Header
6
+ class DropdownMenu < ApplicationComponent
7
+ prop :icon
8
+ prop :component
9
+ prop :options, default: {}
10
+
11
+ private
12
+
13
+ def image?
14
+ icon&.try(:key?, :url)
15
+ end
16
+
17
+ def pb_component
18
+ image? ? "image" : "icon"
19
+ end
20
+
21
+ def icon_wrapper_classname
22
+ image? ? "image-caret" : "icon-caret"
23
+ end
24
+
25
+ def icon_props
26
+ case icon
27
+ when ::String
28
+ { icon:, size: "2x", fixed_width: true }
29
+ else
30
+ icon
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end