Compare commits
2 Commits
56d271d0df
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58bd1160c1 | ||
|
|
debaf567ea |
@@ -12,7 +12,13 @@ describe("CelexSelector", () => {
|
|||||||
expect(getByLabelText("Select example:")).toBeInTheDocument();
|
expect(getByLabelText("Select example:")).toBeInTheDocument();
|
||||||
expect(getByRole("combobox")).toBeInTheDocument();
|
expect(getByRole("combobox")).toBeInTheDocument();
|
||||||
|
|
||||||
const options = getAllByRole("option");
|
const [def, ...options] = getAllByRole("option");
|
||||||
|
|
||||||
|
// First option is the disabled placeholder option
|
||||||
|
expect(def).toHaveValue("");
|
||||||
|
expect(def).toHaveTextContent("Select an example");
|
||||||
|
expect(def).toBeDisabled();
|
||||||
|
|
||||||
expect(options).toHaveLength(examples.length);
|
expect(options).toHaveLength(examples.length);
|
||||||
for (const i in examples) {
|
for (const i in examples) {
|
||||||
expect(options[i]).toHaveValue(examples[i].id);
|
expect(options[i]).toHaveValue(examples[i].id);
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
.toc {
|
.toc {
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
min-width: 25vw;
|
flex: 1 0 25vw;
|
||||||
flex: 1 auto;
|
|
||||||
|
|
||||||
&.hidden {
|
&.hidden {
|
||||||
flex: 0 0;
|
display: none;
|
||||||
min-width: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transition: flex-basis 0.1s ease-in-out;
|
||||||
|
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
overflow-x: wrap;
|
overflow-x: wrap;
|
||||||
height: 100vh;
|
|
||||||
|
|
||||||
.tocDivision {
|
.tocDivision {
|
||||||
margin-block: 0.5rem;
|
margin-block: 0.5rem;
|
||||||
|
|||||||
@@ -55,15 +55,17 @@ function TOC({ toc }: TOCProps) {
|
|||||||
const [isVisible, setIsVisible] = useState(true);
|
const [isVisible, setIsVisible] = useState(true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav className={[styles.toc, isVisible ? "" : styles.hidden].join(" ")}>
|
<>
|
||||||
<button
|
<button
|
||||||
onClick={() => setIsVisible(!isVisible)}
|
onClick={() => setIsVisible(!isVisible)}
|
||||||
className={styles.toggleButton}
|
className={styles.toggleButton}
|
||||||
>
|
>
|
||||||
{isVisible ? "<" : ">"}
|
{isVisible ? "<" : ">"}
|
||||||
</button>
|
</button>
|
||||||
{toc.map((division) => renderDivision(division))}
|
<nav className={[styles.toc, isVisible ? "" : styles.hidden].join(" ")}>
|
||||||
</nav>
|
{toc.map((division) => renderDivision(division))}
|
||||||
|
</nav>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export default TOC;
|
export default TOC;
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
export const examples = [
|
export const examples = [
|
||||||
{ name: "GDPR", id: "32016R0679" },
|
{ name: "GDPR", id: "32016R0679" },
|
||||||
{ name: "AI Act", id: "32024R1689" },
|
{ name: "AI Act", id: "32024R1689" },
|
||||||
|
{ name: "Cybersecurity Act", id: "32019R0881" },
|
||||||
{ name: "Cyber Resilience Act", id: "32024R2847" },
|
{ name: "Cyber Resilience Act", id: "32024R2847" },
|
||||||
|
{ name: "Medical Device Regulation", id: "32017R0745" },
|
||||||
|
{ name: "NIS 2 Directive", id: "32022L2555" },
|
||||||
|
{ name: "Digital Services Act", id: "32022R2065" },
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user