From 9ab49a08b17bbfe39c3fbcb83179c6713a6f8c40 Mon Sep 17 00:00:00 2001 From: Lisa Durand Date: Wed, 9 Oct 2024 15:35:58 +0200 Subject: [PATCH] remove old badge css and only use DSFR --- app/assets/stylesheets/badges.scss | 34 ------------------- ...teur_expert_navigation_component.html.haml | 2 +- .../dossiers/_header_top.html.haml | 4 +-- app/views/invites/_dropdown.html.haml | 2 +- app/views/root/patron.html.haml | 5 --- app/views/shared/_tab_item.html.haml | 2 +- ...ucteur_expert_navigation_component_spec.rb | 4 +-- spec/system/experts/expert_spec.rb | 4 +-- 8 files changed, 9 insertions(+), 48 deletions(-) delete mode 100644 app/assets/stylesheets/badges.scss diff --git a/app/assets/stylesheets/badges.scss b/app/assets/stylesheets/badges.scss deleted file mode 100644 index f1e19da3a..000000000 --- a/app/assets/stylesheets/badges.scss +++ /dev/null @@ -1,34 +0,0 @@ -@import "colors"; -@import "constants"; - -.badge { - padding: 0 5px; - font-size: 14px; - font-weight: bold; - text-align: center; - white-space: nowrap; - border-radius: 100px; - background-color: rgba(0, 0, 0, 0.08); - vertical-align: top; - - &.baseline { - vertical-align: baseline; - } - - &.warning { - background-color: $orange; - color: #FFFFFF; - } -} - -.badge-group { - display: flex; - - .fr-badge { - margin-right: $default-spacer; - } - - .fr-badge:last-child { - margin-right: 0; - } -} diff --git a/app/components/main_navigation/instructeur_expert_navigation_component/instructeur_expert_navigation_component.html.haml b/app/components/main_navigation/instructeur_expert_navigation_component/instructeur_expert_navigation_component.html.haml index ee0d7dbb6..47c160cf1 100644 --- a/app/components/main_navigation/instructeur_expert_navigation_component/instructeur_expert_navigation_component.html.haml +++ b/app/components/main_navigation/instructeur_expert_navigation_component/instructeur_expert_navigation_component.html.haml @@ -9,6 +9,6 @@ = link_to expert_all_avis_path, class: 'fr-nav__link', aria: aria_current_for(:avis) do = Avis.model_name.human(count: 10) - if helpers.current_expert.avis_summary[:unanswered] > 0 - %span.badge.warning= helpers.current_expert.avis_summary[:unanswered] + %span.fr-badge.fr-badge--new.fr-badge--no-icon= helpers.current_expert.avis_summary[:unanswered] = render MainNavigation::AnnouncesLinkComponent.new diff --git a/app/views/instructeurs/dossiers/_header_top.html.haml b/app/views/instructeurs/dossiers/_header_top.html.haml index e752a54bb..c71d2346b 100644 --- a/app/views/instructeurs/dossiers/_header_top.html.haml +++ b/app/views/instructeurs/dossiers/_header_top.html.haml @@ -1,11 +1,11 @@ #header-top.fr-container - .flex.fr-mb-3w + .flex %div %h1.fr-h3.fr-mb-1w = "Dossier nº #{dossier.id}" = link_to dossier.procedure.libelle.truncate_words(10), instructeur_procedure_path(dossier.procedure), title: dossier.procedure.libelle, class: "fr-link" - .fr-mt-2w.badge-group + .fr-mt-2w.fr-badge-group = procedure_badge(dossier.procedure) = status_badge(dossier.state) diff --git a/app/views/invites/_dropdown.html.haml b/app/views/invites/_dropdown.html.haml index 3d7de5a12..e2da2ffab 100644 --- a/app/views/invites/_dropdown.html.haml +++ b/app/views/invites/_dropdown.html.haml @@ -5,7 +5,7 @@ = dsfr_icon('fr-icon-user-add-fill', :sm, :mr) - if invites.present? = t('views.invites.dropdown.view_invited_people') - %span.badge= invites.size + %span.fr-badge.fr-ml-1v= invites.size - else - if dossier.read_only? = t('views.invites.dropdown.invite_to_view') diff --git a/app/views/root/patron.html.haml b/app/views/root/patron.html.haml index 968b94d70..e6b2dd10e 100644 --- a/app/views/root/patron.html.haml +++ b/app/views/root/patron.html.haml @@ -153,11 +153,6 @@ %span.label.refused .label.refused %span.label.without-continuation .label.without-continuation - %h1 Badges - - %span.badge 1 - %span.badge.warning 1 - %h1 Cards .card diff --git a/app/views/shared/_tab_item.html.haml b/app/views/shared/_tab_item.html.haml index cd4103ef8..a9de4a2a7 100644 --- a/app/views/shared/_tab_item.html.haml +++ b/app/views/shared/_tab_item.html.haml @@ -3,5 +3,5 @@ %span.notifications{ 'aria-label': 'notifications' } = link_to(url, 'aria-selected': active ? true : nil, class: 'fr-tabs__tab', role: 'tab' ) do - if badge.present? - %span.badge.fr-mr-1w= badge + %span.fr-badge.fr-badge--blue-ecume.fr-mr-1w= badge = label diff --git a/spec/components/main_navigation/instructeur_expert_navigation_component_spec.rb b/spec/components/main_navigation/instructeur_expert_navigation_component_spec.rb index 486af1473..309430144 100644 --- a/spec/components/main_navigation/instructeur_expert_navigation_component_spec.rb +++ b/spec/components/main_navigation/instructeur_expert_navigation_component_spec.rb @@ -68,7 +68,7 @@ describe MainNavigation::InstructeurExpertNavigationComponent, type: :component it 'renders a link to expert all avis with current page class' do expect(subject).to have_link('Avis', href: component.helpers.expert_all_avis_path) expect(subject).to have_selector('a[aria-current="true"]', text: 'Avis') - expect(subject).not_to have_selector('span.badge') + expect(subject).not_to have_selector('span.fr-badge') end it 'does not have Démarches link' do @@ -79,7 +79,7 @@ describe MainNavigation::InstructeurExpertNavigationComponent, type: :component let(:unanswered) { 2 } it 'renders an unanswered avis badge for the expert' do - expect(subject).to have_selector('span.badge.warning', text: '2') + expect(subject).to have_selector('span.fr-badge', text: '2') end end diff --git a/spec/system/experts/expert_spec.rb b/spec/system/experts/expert_spec.rb index 7ad4e7685..433bead97 100644 --- a/spec/system/experts/expert_spec.rb +++ b/spec/system/experts/expert_spec.rb @@ -72,7 +72,7 @@ describe 'Inviting an expert:', js: true do expect(page).to have_text('1 avis à donner') expect(page).to have_text('0 avis donnés') - expect(page).to have_selector('.badge', text: 1) + expect(page).to have_selector('.fr-badge', text: 1) expect(page).to have_selector('.notifications') click_on '1 avis à donner' @@ -93,7 +93,7 @@ describe 'Inviting an expert:', js: true do expect(page).to have_text('0 avis à donner') expect(page).to have_text('1 avis donné') - expect(page).not_to have_selector('.badge', text: 1) + expect(page).not_to have_selector('.fr-badge', text: 1) expect(page).not_to have_selector('.notifications') end