sdr_view_components 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/app/components/sdr_view_components/structure/header_component.html.erb +10 -10
- data/app/components/sdr_view_components/structure/header_component.rb +11 -23
- data/app/components/sdr_view_components/structure/header_rosette_component.rb +13 -0
- data/app/components/sdr_view_components/structure/header_subtitle_component.rb +22 -0
- data/app/components/sdr_view_components/structure/header_sul_logo_component.rb +24 -0
- data/app/components/sdr_view_components/structure/header_title_component.rb +20 -0
- data/lib/sdr_view_components/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a2b7362cc8e33e3efb9056117bdd8b3303cfa9df131f3af3d614b3afe8293d8
|
|
4
|
+
data.tar.gz: 86178a05243b29b9a6a4bf6e0c4f085ac180f43fed956fecb287b6c81883c52e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 99eeb9d90b6d7d469aaaa869faa48cc3fa3054c71b25bfefbb96b3eab53c5ae5a6c45c4b4dd79633f46afc4035f83493200b23252b07d6a3588976c1e7c05215
|
|
7
|
+
data.tar.gz: 25611e8779d1992f4828a3a71a37307e3f4f202acc32d498e179d6eed0609604987b806fd681517574ebe3aa66498c3ac894b5762f751981d33b0acf3d522abb
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%=
|
|
1
|
+
<%= render style_override_component %>
|
|
2
2
|
|
|
3
3
|
<header>
|
|
4
4
|
<div class="identity-bar">
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
<a class="su-brand-bar__logo" href="https://www.stanford.edu">Stanford University</a>
|
|
7
7
|
</div>
|
|
8
8
|
</div>
|
|
9
|
-
<%= tag.nav class:
|
|
9
|
+
<%= tag.nav class: collapsible_navbar_classes do %>
|
|
10
10
|
<div class="container">
|
|
11
|
-
<%= sul_logo %>
|
|
11
|
+
<%= render SdrViewComponents::Structure::HeaderSulLogoComponent.new(sul_logo:) %>
|
|
12
12
|
<button
|
|
13
13
|
class="navbar-toggler navbar-toggler-right collapsed"
|
|
14
14
|
type="button"
|
|
@@ -35,30 +35,30 @@
|
|
|
35
35
|
<div class="container">
|
|
36
36
|
<div class="d-flex flex-wrap align-items-end pt-3 pb-1 pb-md-3 gap-2">
|
|
37
37
|
<div class="d-flex align-items-end gap-2 flex-grow-1">
|
|
38
|
-
|
|
38
|
+
<%= render SdrViewComponents::Structure::HeaderRosetteComponent.new if rosette %>
|
|
39
39
|
<div class="me-1 flex-grow-1">
|
|
40
|
-
<%= title %>
|
|
41
|
-
<%= subtitle %>
|
|
40
|
+
<%= render SdrViewComponents::Structure::HeaderTitleComponent.new(title:) %>
|
|
41
|
+
<%= render SdrViewComponents::Structure::HeaderSubtitleComponent.new(subtitle:) %>
|
|
42
42
|
</div>
|
|
43
43
|
</div>
|
|
44
|
-
|
|
44
|
+
<%= tag.div class: navbar_classes do %>
|
|
45
45
|
<nav class="collapse navbar-collapse align-items-start justify-content-md-end navbar-expand-md d-md-flex flex-column flex-md-row" aria-label="browse" id="user-util-collapse">
|
|
46
46
|
<% if secondary_navigation_links.any? %>
|
|
47
|
-
<hr class="d-md-none vw-100 my-0">
|
|
47
|
+
<hr class="d-md-none text-white vw-100 my-0">
|
|
48
48
|
<ul class="navbar-nav justify-content-md-end gap-0 gap-md-4 w-100 fw-semibold">
|
|
49
49
|
<% secondary_navigation_links.each do |link| %>
|
|
50
50
|
<%= link %>
|
|
51
51
|
<% end %>
|
|
52
52
|
</ul>
|
|
53
53
|
<% end %>
|
|
54
|
-
<hr class="d-md-none vw-100 my-0">
|
|
54
|
+
<hr class="d-md-none text-white vw-100 my-0">
|
|
55
55
|
<ul class="navbar-nav d-md-none gap-0 w-100">
|
|
56
56
|
<% primary_navigation_links.each do |link| %>
|
|
57
57
|
<%= link %>
|
|
58
58
|
<% end %>
|
|
59
59
|
</ul>
|
|
60
60
|
</nav>
|
|
61
|
-
|
|
61
|
+
<% end %>
|
|
62
62
|
</div>
|
|
63
63
|
</div>
|
|
64
64
|
<% end %>
|
|
@@ -18,53 +18,41 @@ module SdrViewComponents
|
|
|
18
18
|
dark: 'bg-dark sky-dark'
|
|
19
19
|
}.freeze
|
|
20
20
|
|
|
21
|
-
# param title [String] The main application title text.
|
|
21
|
+
# param title [String] The main application title text (Required).
|
|
22
22
|
# param subtitle [String, nil] An optional subtitle text.
|
|
23
23
|
# param variant [Symbol] One of :light, :dark, :white - determines color scheme.
|
|
24
24
|
# param background_color [String, nil] Optional RGB color value for background (i.e. '1, 104, 149').
|
|
25
25
|
# Used only when variant is :dark.
|
|
26
|
+
# param rosette [Boolean] Whether to show the rosette logo.
|
|
26
27
|
# param sul_logo [String, nil] Optional URL for SUL logo image. (polychrome, stacked-lg, stacked-mobile)
|
|
27
|
-
def initialize(title:, subtitle: nil, variant: :light, background_color: nil, sul_logo: nil)
|
|
28
|
+
def initialize(title:, subtitle: nil, variant: :light, background_color: nil, rosette: true, sul_logo: nil) # rubocop:disable Metrics/ParameterLists
|
|
28
29
|
@title = title
|
|
29
30
|
@subtitle = subtitle
|
|
30
31
|
@variant = variant
|
|
31
32
|
@background_color = background_color
|
|
33
|
+
@rosette = rosette
|
|
32
34
|
@sul_logo = sul_logo
|
|
33
35
|
super()
|
|
34
36
|
end
|
|
35
37
|
|
|
36
|
-
attr_reader :
|
|
38
|
+
attr_reader :background_color, :rosette, :subtitle, :sul_logo, :title, :variant
|
|
37
39
|
|
|
38
40
|
def masthead_classes
|
|
39
41
|
merge_classes('masthead', VARIANT_MASTHEAD_CLASS[variant])
|
|
40
42
|
end
|
|
41
43
|
|
|
42
|
-
def
|
|
44
|
+
def collapsible_navbar_classes
|
|
43
45
|
merge_classes('navbar navbar-expand-md', VARIANT_NAVBAR_CLASS[variant])
|
|
44
46
|
end
|
|
45
47
|
|
|
46
|
-
def
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
render SdrViewComponents::Structure::StyleOverrideDarkComponent.new(background_color:)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def subtitle
|
|
53
|
-
return if @subtitle.blank?
|
|
54
|
-
|
|
55
|
-
tag.span @subtitle, class: 'h4 d-block my-1'
|
|
48
|
+
def navbar_classes
|
|
49
|
+
merge_classes('navbars ms-md-auto', VARIANT_NAVBAR_CLASS[variant])
|
|
56
50
|
end
|
|
57
51
|
|
|
58
|
-
def
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
link_to 'Stanford University Libraries', 'https://library.stanford.edu', class: logo_classes
|
|
62
|
-
end
|
|
52
|
+
def style_override_component
|
|
53
|
+
return SdrViewComponents::Structure::StyleOverrideLightComponent.new unless variant == :dark
|
|
63
54
|
|
|
64
|
-
|
|
65
|
-
tag.div(class: 'h1 my-0') do
|
|
66
|
-
link_to @title, '/'
|
|
67
|
-
end
|
|
55
|
+
SdrViewComponents::Structure::StyleOverrideDarkComponent.new(background_color:)
|
|
68
56
|
end
|
|
69
57
|
end
|
|
70
58
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Structure
|
|
5
|
+
# Component for rendering page header rosette logo.
|
|
6
|
+
class HeaderRosetteComponent < BaseComponent
|
|
7
|
+
# Render the SUL Rosette logo in the header.
|
|
8
|
+
def call
|
|
9
|
+
tag.span class: 'rosette-logo me-1 align-self-start flex-shrink-0', aria: { hidden: 'true' }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Structure
|
|
5
|
+
# Component for rendering page header subtitle.
|
|
6
|
+
class HeaderSubtitleComponent < BaseComponent
|
|
7
|
+
# param subtitle [String] Subtitle text.
|
|
8
|
+
def initialize(subtitle:)
|
|
9
|
+
@subtitle = subtitle
|
|
10
|
+
super()
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
tag.span @subtitle, class: 'h4 d-block my-1'
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def render?
|
|
18
|
+
@subtitle.present?
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Structure
|
|
5
|
+
# Component for rendering page header sul logo.
|
|
6
|
+
class HeaderSulLogoComponent < BaseComponent
|
|
7
|
+
# param sul_logo [String, nil] Optional class for SUL logo image. (polychrome, stacked-lg, stacked-mobile)
|
|
8
|
+
def initialize(sul_logo: nil)
|
|
9
|
+
@sul_logo = sul_logo
|
|
10
|
+
super()
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
link_to 'Stanford University Libraries', 'https://library.stanford.edu', class: logo_classes
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def logo_classes
|
|
20
|
+
merge_classes('mb-0 navbar-brand navbar-logo', @sul_logo)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Structure
|
|
5
|
+
# Component for rendering page header title.
|
|
6
|
+
class HeaderTitleComponent < BaseComponent
|
|
7
|
+
# param title [String] Header title text - Required.
|
|
8
|
+
def initialize(title:)
|
|
9
|
+
@title = title
|
|
10
|
+
super()
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def call
|
|
14
|
+
tag.div(class: 'h1 my-0') do
|
|
15
|
+
link_to @title, '/'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sdr_view_components
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Aaron Collier
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2025-12-
|
|
10
|
+
date: 2025-12-05 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -107,6 +107,10 @@ files:
|
|
|
107
107
|
- app/components/sdr_view_components/structure/footer_component.rb
|
|
108
108
|
- app/components/sdr_view_components/structure/header_component.html.erb
|
|
109
109
|
- app/components/sdr_view_components/structure/header_component.rb
|
|
110
|
+
- app/components/sdr_view_components/structure/header_rosette_component.rb
|
|
111
|
+
- app/components/sdr_view_components/structure/header_subtitle_component.rb
|
|
112
|
+
- app/components/sdr_view_components/structure/header_sul_logo_component.rb
|
|
113
|
+
- app/components/sdr_view_components/structure/header_title_component.rb
|
|
110
114
|
- app/components/sdr_view_components/structure/style_override_dark_component.html.erb
|
|
111
115
|
- app/components/sdr_view_components/structure/style_override_dark_component.rb
|
|
112
116
|
- app/components/sdr_view_components/structure/style_override_light_component.html.erb
|