dsfr-view-components 0.4.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef54774bdcf1ad2c6169da53867dc97bc45ee11759826a6892bde1f48d8d3928
4
- data.tar.gz: 3fea1dab55f0be17c46214bd45c1cf93f9c0cd967d8b27a754a8c7dda9db46c8
3
+ metadata.gz: 5b8bcd91cfd60c731b3126b8fd7d579761e678223d0eca8f5b0deb0f57676fbd
4
+ data.tar.gz: 46c41f71a1cb4124aa1f0e7d010dcb6860f48f1cdcb658d139f1fec5487485ef
5
5
  SHA512:
6
- metadata.gz: e82dac0aecf55ef15275bab28fc97dd345b22911292b451d5f5a390d4c99f8169708b1261a52db629cca7b1c59c420632f9b1e67ae829c75f52c6328b13eb488
7
- data.tar.gz: ba573c5bf3ce60a132be6155047435fd32f98f0d55309269a1f37704e361154a100117746c978c80c70a8c1ab42580959d0ced78ee6a12a4e8ed2542fca47e3a
6
+ metadata.gz: bced111925a7864ce903d7da305f3042b6bae805f63965bb853e78ccfb9f8c70ba45e43bbb30193f19737cbc79933e242852f53400af3cfaee3fc21e8088a04f
7
+ data.tar.gz: 14262298cafdae8095901976f108350224eb5e366dd5c5487959ee2cf8b5bdb2135029ae88b6fe39da2c7fed76df40f773872905a71232228509a33ef41c18d8
@@ -0,0 +1,28 @@
1
+ class DsfrComponent::HeaderComponent::OperatorImageComponent < DsfrComponent::Base
2
+ # @param title [String] Le title du lien vers la page d'accueil du site
3
+ # @param src [String] L'attribut src qui sera passé au tag img
4
+ # @param alt [String] Le texte alternatif qui sera passé au tag img. Il doit impérativement contenir le texte présent dans l’image.
5
+ def initialize(title:, src:, alt:, classes: [], html_attributes: {})
6
+ @title = title
7
+ @src = src
8
+ @alt = alt
9
+
10
+ super(classes: classes, html_attributes: html_attributes)
11
+ end
12
+
13
+ def call
14
+ tag.div(class: "fr-header__operator") do
15
+ tag.a(href: "/", title: title) do
16
+ tag.img(class: "fr-responsive-img", src: src, alt: alt, style: "max-width:9.0625rem;")
17
+ end
18
+ end
19
+ end
20
+
21
+ def default_attributes
22
+ {}
23
+ end
24
+
25
+ private
26
+
27
+ attr_reader :title, :src, :alt
28
+ end
@@ -8,6 +8,10 @@
8
8
  <p class="fr-logo"><%= logo_text %></p>
9
9
  </div>
10
10
 
11
+ <% if operator_image? %>
12
+ <%= operator_image %>
13
+ <% end %>
14
+
11
15
  <% if search? || tool_links? || direct_links? %>
12
16
  <div class="fr-header__navbar">
13
17
  <% if search? %>
@@ -25,14 +29,16 @@
25
29
  <% end %>
26
30
  </div>
27
31
 
28
- <div class="fr-header__service">
29
- <a href="/" title="Accueil - <%= title %>">
30
- <p class="fr-header__service-title"><%= title %></p>
31
- </a>
32
- <% if tagline %>
33
- <p class="fr-header__service-tagline"><%= tagline %></p>
34
- <% end %>
35
- </div>
32
+ <% if title %>
33
+ <div class="fr-header__service">
34
+ <a href="/" title="Accueil - <%= title %>">
35
+ <p class="fr-header__service-title"><%= title %></p>
36
+ </a>
37
+ <% if tagline %>
38
+ <p class="fr-header__service-tagline"><%= tagline %></p>
39
+ <% end %>
40
+ </div>
41
+ <% end %>
36
42
  </div>
37
43
 
38
44
  <% if tool_links? || search? %>
@@ -68,7 +74,7 @@
68
74
  </div>
69
75
 
70
76
  <% if tool_links? || direct_links? %>
71
- <div class="fr-header__menu fr-modal" id="modal-header-menu" aria-labelledby="button-header-menu">
77
+ <div class="fr-header__menu fr-modal" id="modal-header-menu" aria-labelledby="button-header-menu" role="navigation">
72
78
  <div class="fr-container">
73
79
  <button class="fr-btn--close fr-btn" aria-controls="modal-header-menu" title="Fermer">
74
80
  Fermer
@@ -1,5 +1,6 @@
1
1
  class DsfrComponent::HeaderComponent < DsfrComponent::Base
2
2
  renders_one :search
3
+ renders_one :operator_image, "DsfrComponent::HeaderComponent::OperatorImageComponent"
3
4
  renders_many :tool_links, "DsfrComponent::HeaderComponent::ToolLinkComponent"
4
5
  renders_many :direct_links, types: {
5
6
  simple: "DsfrComponent::HeaderComponent::DirectLinkComponent",
@@ -9,7 +10,7 @@ class DsfrComponent::HeaderComponent < DsfrComponent::Base
9
10
  # @param logo_text [String] Ce texte obligatoire sera affiché en dessous de la Marianne et au dessus de la devise française. C’est généralement un nom de ministère ou d’administration.
10
11
  # @param title [String] Le nom du service numérique, titre principal du site.
11
12
  # @param tagline [String] La description du service numérique, sous-titre du site (optionnelle).
12
- def initialize(logo_text:, title:, tagline: nil, classes: [], html_attributes: {})
13
+ def initialize(logo_text:, title: nil, tagline: nil, classes: [], html_attributes: {})
13
14
  @logo_text = logo_text
14
15
  @title = title
15
16
  @tagline = tagline
@@ -1,5 +1,5 @@
1
1
  module Dsfr
2
2
  module Components
3
- VERSION = '0.4.0'.freeze
3
+ VERSION = '1.5.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsfr-view-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - BetaGouv developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-24 00:00:00.000000000 Z
11
+ date: 2024-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-attributes-utils
@@ -416,6 +416,7 @@ files:
416
416
  - app/components/dsfr_component/header_component.rb
417
417
  - app/components/dsfr_component/header_component/direct_link_component.rb
418
418
  - app/components/dsfr_component/header_component/direct_link_dropdown_component.rb
419
+ - app/components/dsfr_component/header_component/operator_image_component.rb
419
420
  - app/components/dsfr_component/header_component/tool_link_component.rb
420
421
  - app/components/dsfr_component/modal_component.html.erb
421
422
  - app/components/dsfr_component/modal_component.rb