Skip to content

Commit 2bf96e1

Browse files
committed
fix(truncate-notifications): Replace <div> series with <ul>
1 parent 77fba1e commit 2bf96e1

3 files changed

Lines changed: 52 additions & 23 deletions

File tree

app/assets/stylesheets/notifications.scss

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,42 @@ span.notifications {
2727
right: -0.25rem;
2828
}
2929
}
30+
31+
// Notifications details
32+
.notification-container-type {
33+
position: relative;
34+
}
35+
36+
.notification-dossiers {
37+
margin: 0;
38+
padding-left: 0;
39+
}
40+
41+
.notification-dossier {
42+
margin-top: 0.25rem;
43+
padding: 0;
44+
}
45+
46+
.notification-dossier:not(:last-child)::after {
47+
content: '';
48+
margin: 0 1rem;
49+
width: 1px;
50+
height: 0.875rem;
51+
background-color: var(--text-default-grey);
52+
}
53+
54+
.notification-dossier-contenu {
55+
font-size: 0.875rem;
56+
line-height: 1.25rem;
57+
}
58+
59+
.notification-indicator {
60+
position: absolute;
61+
right: 0;
62+
top: 0;
63+
padding-left: 1rem;
64+
list-style: none;
65+
background-image: linear-gradient(to right,
66+
transparent 5%,
67+
var(--background-alt-grey) 60%);
68+
}

app/javascript/controllers/truncate_notifications_controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class TruncateNotificationsController extends ApplicationController {
66
this.calculateNotificationContainerWidth();
77

88
const notifications = document.querySelectorAll<HTMLElement>(
9-
'.notification-dossiers'
9+
'.notification-container-type'
1010
);
1111
notifications.forEach((notificationType) => {
1212
const notificationDossiers = Array.from(
@@ -55,7 +55,7 @@ export class TruncateNotificationsController extends ApplicationController {
5555
) {
5656
if (truncateContainer == false) {
5757
if (hiddenCount > 0) {
58-
indicator!.textContent = `... +${hiddenCount}`;
58+
indicator!.innerHTML = `<span aria-hidden="true">…</span> +${hiddenCount}`;
5959
}
6060
notification.style.overflow = 'hidden';
6161
} else {

app/views/instructeurs/procedures/_notifications_list_body.html.erb

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,28 @@
1212
</h4>
1313

1414
<% dossiers_by_notification_type.each do |notification_type, dossiers| %>
15-
<div class="flex align-center fr-mt-1w notification-container-type">
15+
<div class="flex align-start fr-mt-1w notification-container-type">
1616
<div class="fr-col-3 fr-pr-1w notification-badge">
1717
<%= tag_notification(notification_type, generic: true) %>
1818
</div>
1919

20-
<div class="fr-col-9 flex align-center notification-dossiers">
20+
<ul class="fr-col-9 flex wrap notification-dossiers">
2121
<% dossiers.each_with_index do |dossier, dossier_index| %>
22-
<div class="flex align-center notification-dossier">
22+
<li class="flex align-center notification-dossier">
2323
<% if statut != 'supprimes' %>
24-
<div class="fr-link fr-link--sm fr-mr-1w">
25-
<%= link_to dossier.id, instructeur_dossier_path(procedure_id, dossier.id) %>
26-
</div>
24+
<%= link_to dossier.id, instructeur_dossier_path(procedure_id, dossier.id), class: "notification-dossier-contenu fr-link" %>
2725
<% else %>
28-
<span class="fr-mr-1w fr-text--sm fr-mb-0">
26+
<span class="notification-dossier-contenu">
2927
<%= dossier.id %>
3028
</span>
3129
<% end %>
32-
33-
<div class="fr-mb-0">
34-
<span class="no-wrap fr-text--sm">
35-
<%= dossier.owner_name %>
36-
</span>
37-
</div>
38-
39-
<% if dossier_index != (dossiers.size - 1) %>
40-
<div class="fr-mx-2w">|</div>
41-
<% end %>
42-
</div>
30+
<span class="notification-dossier-contenu fr-ml-1w">
31+
<%= dossier.owner_name %>
32+
</span>
33+
</li>
4334
<% end %>
44-
45-
<span class="no-wrap fr-text--sm fr-text--bold fr-mb-0 notification-indicator"></span>
46-
</div>
35+
</ul>
36+
<span class="fr-text--sm fr-text--bold notification-indicator"></span>
4737
</div>
4838
<% end %>
4939
<% end %>

0 commit comments

Comments
 (0)