Skip to content

Commit

Permalink
feat(ui): add TOC component (#2689)
Browse files Browse the repository at this point in the history
* feat(ui): add TOC Component

* update snapshots

* add hook test
  • Loading branch information
UnbearableBear authored May 7, 2020
1 parent 78440d0 commit e550f90
Show file tree
Hide file tree
Showing 18 changed files with 677 additions and 181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3153,7 +3153,7 @@ exports[`<Answer /> should renders related content 1`] = `
class="c30"
>
<span
class="sc-fznYue c40"
class="sc-fzonjX c40"
>
Outils
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ exports[`<RelatedItems /> should render 1`] = `
class="c7"
>
<span
class="sc-fznYue c18"
class="sc-fzonjX c18"
>
Modèles de documents
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4750,7 +4750,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 1-4
</span>
Expand Down Expand Up @@ -4779,7 +4779,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 4-1
</span>
Expand Down Expand Up @@ -4808,7 +4808,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 4-2
</span>
Expand Down Expand Up @@ -4837,7 +4837,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-8
</span>
Expand Down Expand Up @@ -4945,7 +4945,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-13
</span>
Expand Down Expand Up @@ -4974,7 +4974,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-14
</span>
Expand Down Expand Up @@ -5003,7 +5003,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-15
</span>
Expand Down Expand Up @@ -5032,7 +5032,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-16
</span>
Expand Down Expand Up @@ -5061,7 +5061,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-17
</span>
Expand Down Expand Up @@ -5090,7 +5090,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-18
</span>
Expand Down Expand Up @@ -5119,7 +5119,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-21
</span>
Expand Down Expand Up @@ -5148,7 +5148,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-22
</span>
Expand Down Expand Up @@ -5177,7 +5177,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-24
</span>
Expand Down Expand Up @@ -5206,7 +5206,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-25
</span>
Expand Down Expand Up @@ -5235,7 +5235,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-28
</span>
Expand Down Expand Up @@ -5264,7 +5264,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 3-29
</span>
Expand Down Expand Up @@ -5372,7 +5372,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-1
</span>
Expand Down Expand Up @@ -5401,7 +5401,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-2
</span>
Expand Down Expand Up @@ -5430,7 +5430,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-3
</span>
Expand Down Expand Up @@ -5459,7 +5459,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-4
</span>
Expand Down Expand Up @@ -5488,7 +5488,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-5
</span>
Expand Down Expand Up @@ -5517,7 +5517,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-6
</span>
Expand Down Expand Up @@ -5546,7 +5546,7 @@ exports[`<Convention /> renders 1`] = `
class="c36"
>
<span
class="sc-fznYue c37"
class="sc-fzonjX c37"
>
Article 12-7
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ exports[`<Highlights /> should render 1`] = `
class="c12"
>
<span
class="sc-fznYue c13"
class="sc-fzonjX c13"
>
Santé, sécurité et conditions de travail
</span>
Expand Down Expand Up @@ -415,7 +415,7 @@ exports[`<Highlights /> should render 1`] = `
class="c12"
>
<span
class="sc-fznYue c13"
class="sc-fzonjX c13"
>
Santé, sécurité et conditions de travail
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ exports[`<SearchResults/> should render results 1`] = `
class="c6"
>
<span
class="sc-fznYue c7"
class="sc-fzonjX c7"
>
test theme content
</span>
Expand Down Expand Up @@ -724,7 +724,7 @@ exports[`<SearchResults/> should render results 1`] = `
class="c6"
>
<span
class="sc-fznYue c7"
class="sc-fzonjX c7"
>
Outils
</span>
Expand Down Expand Up @@ -781,7 +781,7 @@ exports[`<SearchResults/> should render results 1`] = `
class="c6"
>
<span
class="sc-fznYue c7"
class="sc-fzonjX c7"
>
Outils externes
</span>
Expand Down Expand Up @@ -861,7 +861,7 @@ exports[`<SearchResults/> should render results 1`] = `
class="c6"
>
<span
class="sc-fznYue c7"
class="sc-fzonjX c7"
>
test root content
</span>
Expand Down Expand Up @@ -941,7 +941,7 @@ exports[`<SearchResults/> should render results 1`] = `
class="c6"
>
<span
class="sc-fznYue c7"
class="sc-fzonjX c7"
>
test theme content
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,7 +969,7 @@ exports[`<FicheServicePublic /> should render 1`] = `
class="c27"
>
<span
class="sc-fznYue c28"
class="sc-fzonjX c28"
>
Modèle de document
</span>
Expand Down Expand Up @@ -1795,7 +1795,7 @@ exports[`<FicheServicePublic /> should render 1`] = `
class="c27"
>
<span
class="sc-fznYue c28"
class="sc-fzonjX c28"
>
Modèle de document
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ exports[`<ServiceEnLigne /> should render 1`] = `
class="c3"
>
<span
class="sc-fznYue c4"
class="sc-fzonjX c4"
>
Se retrouve dans en entête
</span>
Expand Down
2 changes: 2 additions & 0 deletions packages/react-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@svgr/cli": "^5.4.0",
"@svgr/core": "^5.4.0",
"@testing-library/react": "^10.0.4",
"@testing-library/react-hooks": "3.2.1",
"babel-jest": "^25.5.1",
"babel-loader": "^8.1.0",
"eslint": "^6.8.0",
Expand All @@ -62,6 +63,7 @@
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-test-renderer": "16.x",
"rollup": "^2.8.2",
"rollup-plugin-babel": "^4.4.0",
"styled-components": "^5.1.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/react-ui/src/GlobalStyles/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ HTMLCollection [
a:visited{-webkit-text-decoration-color:#7994d4;text-decoration-color:#7994d4;}
a[target="_blank"]:not(.no-after):after,a[href^="http://"]:not(.no-after):not([href*="social.gouv.fr"]):after,a[href^="https://"]:not(.no-after):not([href*="social.gouv.fr"]):after{position:relative;top:2px;width:16px;height:23px;margin-left:5px;content:url("/static/assets/icons/external.svg");}
@media print{a[target="_blank"]:not(.no-after):after,a[href^="http://"]:not(.no-after):not([href*="social.gouv.fr"]):after,a[href^="https://"]:not(.no-after):not([href*="social.gouv.fr"]):after{margin-left:0;content:" (" attr(href) ") ";}}
:target::before{position:relative;z-index:-1;display:block;height:11rem;margin-top:-11rem;visibility:hidden;content:"";pointer-events:none;}
@media (max-width:600px){:target::before{height:6rem;margin-top:-6rem;}}
:target::before{position:relative;z-index:-1;display:block;height:14rem;margin-top:-14rem;visibility:hidden;content:"";pointer-events:none;}
@media (max-width:600px){:target::before{height:12rem;margin-top:-12rem;}}
ul,ol{display:block;margin:1rem 0;padding:0 0 0 2rem;}
ul{list-style-type:disc;}
ul ul{list-style-type:circle;}
Expand Down
8 changes: 4 additions & 4 deletions packages/react-ui/src/GlobalStyles/components/Links.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ export default createGlobalStyle`
position: relative;
z-index: -1;
display: block;
height: 11rem; /* Fixed header's height */
margin-top: -11rem; /* Fixed header's negative height */
height: 14rem; /* Fixed header's height */
margin-top: -14rem; /* Fixed header's negative height */
visibility: hidden;
content: "";
pointer-events: none;
@media (max-width: ${breakpoints.mobile}) {
height: 6rem;
margin-top: -6rem;
height: 12rem;
margin-top: -12rem;
}
}
`;
Loading

0 comments on commit e550f90

Please sign in to comment.