Skip to content

Commit ae3c3d2

Browse files
authored
fix: bug affichage onglet fiche sp (#6817)
* fix: bug affichage onglet fiche sp * clean * snap
1 parent 45f2ace commit ae3c3d2

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

packages/code-du-travail-frontend/src/modules/fiche-service-public/builder/__tests__/__snapshots__/FicheServicePublic.test.tsx.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ exports[`<FicheServicePublic /> should render 1`] = `
5050
CDD
5151
ou en intérim, des dispositions spécifiques de rupture anticipée du contrat de travail sont prévues. Nous vous présentons les informations à connaître.
5252
</p>
53-
<div
54-
class="pos_relative"
55-
>
53+
<div>
5654
<div
5755
class="fr-tabs fr-mb-4w"
5856
data-fr-js-tabs="true"

packages/code-du-travail-frontend/src/modules/fiche-service-public/builder/components/Tabulator.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"use client";
2-
import React, { useState } from "react";
2+
import React from "react";
33
import { filterOutTitle, getTitleInChildren } from "../utils";
44
import { ElementBuilder } from "./ElementBuilder";
55
import Title from "./Title";
66
import { FicheSPDataBlocCas, FicheSPDataListeSituations } from "../type";
7-
import { css } from "@styled-system/css";
87

98
export const Tabulator = ({
109
data,
@@ -13,8 +12,6 @@ export const Tabulator = ({
1312
data: FicheSPDataBlocCas | FicheSPDataListeSituations;
1413
headingLevel: number;
1514
}) => {
16-
const [activeTab, setActiveTab] = useState(0);
17-
1815
// Prepare tabs data
1916
const tabs = data.children.map((tab) => {
2017
const title = getTitleInChildren(tab);
@@ -34,25 +31,19 @@ export const Tabulator = ({
3431
};
3532
});
3633

37-
// Define container styles
38-
const tabsContainerStyle = css({
39-
position: "relative",
40-
});
41-
4234
return (
43-
<div className={tabsContainerStyle}>
44-
<div className={`fr-tabs fr-mb-4w`} data-fr-js-tabs="true">
35+
<div>
36+
<div className="fr-tabs fr-mb-4w" data-fr-js-tabs="true">
4537
<ul className="fr-tabs__list" role="tablist">
4638
{tabs.map((tab, index) => (
4739
<li role="presentation" key={`tab-${index}`}>
4840
<button
4941
id={`tab-${index}`}
50-
className={`fr-tabs__tab fr-tabs__tab--icon-left ${index === activeTab ? "fr-tabs__tab--active" : ""}`}
51-
tabIndex={index === activeTab ? 0 : -1}
42+
className={`fr-tabs__tab fr-tabs__tab--icon-left ${index === 0 ? "fr-tabs__tab--active" : ""}`}
43+
tabIndex={index === 0 ? 0 : -1}
5244
role="tab"
53-
aria-selected={index === activeTab}
45+
aria-selected={index === 0}
5446
aria-controls={`panel-${index}`}
55-
onClick={() => setActiveTab(index)}
5647
>
5748
{tab.label}
5849
</button>
@@ -64,7 +55,7 @@ export const Tabulator = ({
6455
<div
6556
key={`panel-${index}`}
6657
id={`panel-${index}`}
67-
className={`fr-tabs__panel ${index === activeTab ? "fr-tabs__panel--selected" : ""}`}
58+
className={`fr-tabs__panel ${index === 0 ? "fr-tabs__panel--selected" : ""}`}
6859
role="tabpanel"
6960
aria-labelledby={`tab-${index}`}
7061
tabIndex={0}

packages/code-du-travail-frontend/src/modules/fiche-service-public/builder/components/__tests__/__snapshots__/Tabulator.test.tsx.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22

33
exports[`<Tabulator /> should render 1`] = `
44
<div>
5-
<div
6-
class="pos_relative"
7-
>
5+
<div>
86
<div
97
class="fr-tabs fr-mb-4w"
108
data-fr-js-tabs="true"

0 commit comments

Comments
 (0)