@@ -10,6 +10,7 @@ import CarbonAds from './CarbonsAds';
10
10
import { useTheme } from 'next-themes' ;
11
11
import ExternalLinkIcon from '../public/icons/external-link-black.svg' ;
12
12
import Image from 'next/image' ;
13
+
13
14
const DocLink = ( {
14
15
uri,
15
16
label,
@@ -30,11 +31,14 @@ const DocLink = ({
30
31
return (
31
32
< Link
32
33
href = { uri }
33
- className = { classnames ( 'text-sm block py-1 pl-2' , {
34
- ' font-medium' : ! isActive ,
35
- 'text-primary dark:text-[#007bff] text-bold border-l-2 border-l-primary font-semibold' :
36
- isActive ,
37
- } ) }
34
+ className = { classnames (
35
+ 'text-sm block py-1 pl-2 transition-transform duration-300 hover:scale-105 hover:text-[#007bff]' ,
36
+ {
37
+ 'font-medium' : ! isActive ,
38
+ 'text-primary dark:text-[#007bff] font-bold border-l-2 border-l-primary' :
39
+ isActive ,
40
+ } ,
41
+ ) }
38
42
onClick = { ( ) => {
39
43
if ( onClick ) onClick ( ) ;
40
44
setOpen ( false ) ;
@@ -65,11 +69,13 @@ const DocLinkBlank = ({
65
69
return (
66
70
< Link
67
71
href = { uri }
68
- className = { classnames ( 'flex text-sm py-1 pl-2' , {
69
- 'font-medium' : ! isActive ,
70
- 'text-primary text-bold border-l-2 border-l-primary font-semibold' :
71
- isActive ,
72
- } ) }
72
+ className = { classnames (
73
+ 'flex text-sm py-1 pl-2 transition-transform duration-300 hover:scale-105 hover:text-[#007bff]' ,
74
+ {
75
+ 'font-medium' : ! isActive ,
76
+ 'text-primary font-bold border-l-2 border-l-primary' : isActive ,
77
+ } ,
78
+ ) }
73
79
target = '_blank'
74
80
rel = 'noopener noreferrer'
75
81
onClick = { ( ) => {
@@ -94,13 +100,15 @@ const DocLinkBlank = ({
94
100
</ Link >
95
101
) ;
96
102
} ;
103
+
97
104
const SegmentSubtitle = ( { label } : { label : string } ) => {
98
105
return (
99
106
< div className = 'text-sm italic text-slate-900 dark:text-slate-400 mt-2 mb-2' >
100
107
{ label }
101
108
</ div >
102
109
) ;
103
110
} ;
111
+
104
112
const getDocsPath = [
105
113
'/docs' ,
106
114
'/overview/what-is-jsonschema' ,
@@ -188,7 +196,7 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
188
196
return (
189
197
< div className = 'max-w-[1400px] mx-auto flex flex-col items-center' >
190
198
< section >
191
- < div className = 'bg-primary dark:bg-slate-900 w-full h-12 mt-[4.5rem] z-150 flex relative flex-col justify-center items-center lg:hidden ' >
199
+ < div className = 'bg-primary dark:bg-slate-900 w-full h-12 mt-[4.5rem] z-150 flex relative flex-col justify-center items-center lg:hidden' >
192
200
< div
193
201
className = 'z-[150] flex w-full bg-primary dark:bg-slate-900 justify-between items-center'
194
202
onMouseDown = { ( e ) => e . stopPropagation ( ) }
@@ -199,7 +207,7 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
199
207
} }
200
208
>
201
209
{ getDocsPath . includes ( pathWtihoutFragment ) && (
202
- < h3 className = 'text-white ml-12' > Introduction</ h3 >
210
+ < h3 className = 'text-white ml-12' > Introduction</ h3 >
203
211
) }
204
212
{ getStartedPath . includes ( pathWtihoutFragment ) && (
205
213
< h3 className = 'text-white ml-12' > Get started</ h3 >
@@ -237,7 +245,9 @@ export const SidebarLayout = ({ children }: { children: React.ReactNode }) => {
237
245
</ div >
238
246
239
247
< div
240
- className = { `z-[150] absolute top-10 mt-24 left-0 h-full w-screen bg-white dark:bg-slate-900 dark:shadow-lg transform ${ open ? '-translate-x-0' : '-translate-x-full' } transition-transform duration-300 ease-in-out filter drop-shadow-md ` }
248
+ className = { `z-[150] absolute top-10 mt-24 left-0 h-full w-screen bg-white dark:bg-slate-900 dark:shadow-lg transform ${
249
+ open ? '-translate-x-0' : '-translate-x-full'
250
+ } transition-transform duration-300 ease-in-out filter drop-shadow-md`}
241
251
>
242
252
< div className = 'flex flex-col dark:bg-slate-900' >
243
253
< DocsNav open = { open } setOpen = { setOpen } />
@@ -269,8 +279,6 @@ export const DocsNav = ({
269
279
setOpen : ( open : boolean ) => void ;
270
280
} ) => {
271
281
const router = useRouter ( ) ;
272
-
273
- /* eslint-disable no-constant-condition */
274
282
const [ active , setActive ] = useState ( {
275
283
getDocs : false ,
276
284
getStarted : false ,
@@ -299,7 +307,6 @@ export const DocsNav = ({
299
307
} else if ( getGuidesPath . includes ( pathWtihoutFragment ) ) {
300
308
newActive . getGuides = true ;
301
309
}
302
-
303
310
setActive ( newActive ) ;
304
311
} , [ router . asPath ] ) ;
305
312
@@ -357,9 +364,7 @@ export const DocsNav = ({
357
364
const rotateG = active . getStarted ? 'rotate(180deg)' : 'rotate(0)' ;
358
365
const rotateR = active . getReference ? 'rotate(180deg)' : 'rotate(0)' ;
359
366
const rotateSpec = active . getSpecification ? 'rotate(180deg)' : 'rotate(0)' ;
360
-
361
367
const { resolvedTheme } = useTheme ( ) ;
362
-
363
368
const [ learn_icon , setLearn_icon ] = useState ( '' ) ;
364
369
const [ reference_icon , setReference_icon ] = useState ( '' ) ;
365
370
const [ spec_icon , setSpec_icon ] = useState ( '' ) ;
@@ -384,12 +389,12 @@ export const DocsNav = ({
384
389
return (
385
390
< div id = 'sidebar' className = 'lg:mt-8 w-4/5 mx-auto lg:ml-4' >
386
391
{ /* Introduction */ }
387
- < div className = 'my-2 bg-slate-200 dark:bg-slate-900 border-white border lg:border-hidden p-2 rounded' >
392
+ < div className = 'my-2 bg-slate-200 dark:bg-slate-900 border-white border lg:border-hidden p-2 rounded transition-transform duration-300 hover:scale-95 ' >
388
393
< div
389
394
className = 'flex justify-between w-full items-center'
390
395
onClick = { handleClickDoc }
391
396
>
392
- < div className = 'flex items-center align-middle' >
397
+ < div className = 'flex items-center align-middle' >
393
398
< Image
394
399
src = { `${ overview_icon } ` }
395
400
alt = 'eye icon'
@@ -422,8 +427,7 @@ export const DocsNav = ({
422
427
</ div >
423
428
< div
424
429
className = { classnames (
425
- 'ml-6' ,
426
- 'transition-all duration-500 ease-in-out' ,
430
+ 'ml-6 transition-all duration-500 ease-in-out' ,
427
431
{
428
432
'max-h-0 opacity-0 overflow-hidden' : ! active . getDocs ,
429
433
'max-h-80 opacity-100' : active . getDocs ,
@@ -475,15 +479,14 @@ export const DocsNav = ({
475
479
setOpen = { setOpen }
476
480
/>
477
481
</ div >
478
- </ div > { ' ' }
479
- { /*Closing div: Introduction*/ }
480
- { /* Get started */ }
481
- < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden ' >
482
+ </ div >
483
+ { /* Get Started */ }
484
+ < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden transition-transform duration-300 hover:scale-95' >
482
485
< div
483
486
className = 'flex justify-between w-full items-center'
484
487
onClick = { handleClickGet }
485
488
>
486
- < div className = 'flex items-center align-middle' >
489
+ < div className = 'flex items-center align-middle' >
487
490
< Image
488
491
src = { `${ learn_icon } ` }
489
492
alt = 'compass icon'
@@ -516,8 +519,7 @@ export const DocsNav = ({
516
519
</ div >
517
520
< div
518
521
className = { classnames (
519
- 'ml-6' ,
520
- 'transition-all duration-500 ease-in-out' ,
522
+ 'ml-6 transition-all duration-500 ease-in-out' ,
521
523
{
522
524
'max-h-0 opacity-0 overflow-hidden' : ! active . getStarted ,
523
525
'max-h-80 opacity-100' : active . getStarted ,
@@ -570,15 +572,15 @@ export const DocsNav = ({
570
572
/>
571
573
</ div >
572
574
</ div >
573
- </ div > { ' ' }
575
+ </ div >
574
576
{ /* Closing div: Get started */ }
575
577
{ /* Guides */ }
576
- < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden ' >
578
+ < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden transition-transform duration-300 hover:scale-95 ' >
577
579
< div
578
580
className = 'flex justify-between w-full items-center'
579
581
onClick = { handleClickGuides }
580
582
>
581
- < div className = 'flex items-center align-middle' >
583
+ < div className = 'flex items-center align-middle' >
582
584
< Image
583
585
src = { `${ guides_icon } ` }
584
586
alt = 'grad cap icon'
@@ -628,15 +630,15 @@ export const DocsNav = ({
628
630
</ div >
629
631
{ /*Closing div tag: for implementers*/ }
630
632
</ div >
631
- </ div > { ' ' }
633
+ </ div >
632
634
{ /* Closing div: Guides */ }
633
635
{ /* Reference */ }
634
- < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden ' >
636
+ < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden transition-transform duration-300 hover:scale-95 ' >
635
637
< div
636
638
className = 'flex justify-between w-full items-center'
637
639
onClick = { handleClickReference }
638
640
>
639
- < div className = 'flex items-center align-middle' >
641
+ < div className = 'flex items-center align-middle' >
640
642
< Image
641
643
src = { `${ reference_icon } ` }
642
644
alt = 'book icon'
@@ -670,8 +672,7 @@ export const DocsNav = ({
670
672
{ /*Opening div: inner reference div */ }
671
673
< div
672
674
className = { classnames (
673
- 'ml-6' ,
674
- 'transition-all duration-500 ease-in-out' ,
675
+ 'ml-6 transition-all duration-500 ease-in-out' ,
675
676
{
676
677
'max-h-0 opacity-0 overflow-hidden' : ! active . getReference ,
677
678
'max-h-80 overflow-y-auto opacity-100' : active . getReference ,
@@ -712,7 +713,6 @@ export const DocsNav = ({
712
713
setOpen = { setOpen }
713
714
/>
714
715
< div className = 'pl-4 pb-1 pt-1' >
715
- { ' ' }
716
716
{ /*Opening div: JSON data types*/ }
717
717
< DocLink
718
718
uri = '/understanding-json-schema/reference/array'
@@ -749,7 +749,7 @@ export const DocsNav = ({
749
749
label = 'string'
750
750
setOpen = { setOpen }
751
751
/>
752
- </ div > { ' ' }
752
+ </ div >
753
753
{ /*Closing div: JSON data types*/ }
754
754
< DocLink
755
755
uri = '/understanding-json-schema/reference/schema'
@@ -762,7 +762,6 @@ export const DocsNav = ({
762
762
setOpen = { setOpen }
763
763
/>
764
764
< div className = 'pl-4 pb-1 pt-1' >
765
- { ' ' }
766
765
{ /*Opening div: Schema constraints*/ }
767
766
< DocLink
768
767
uri = '/understanding-json-schema/reference/enum'
@@ -774,7 +773,7 @@ export const DocsNav = ({
774
773
label = 'Constant values'
775
774
setOpen = { setOpen }
776
775
/>
777
- </ div > { ' ' }
776
+ </ div >
778
777
{ /*Closing div: Schema constraints*/ }
779
778
< DocLink
780
779
uri = '/understanding-json-schema/reference/metadata'
@@ -793,8 +792,7 @@ export const DocsNav = ({
793
792
label = 'Comments'
794
793
setOpen = { setOpen }
795
794
/>
796
- </ div > { ' ' }
797
- { /*Closing div: Schema metadata*/ }
795
+ </ div >
798
796
< DocLink
799
797
uri = '/understanding-json-schema/reference/conditionals'
800
798
label = 'Conditional schema validation'
@@ -806,7 +804,6 @@ export const DocsNav = ({
806
804
setOpen = { setOpen }
807
805
/>
808
806
< div className = 'pl-4 pb-1 pt-1' >
809
- { ' ' }
810
807
{ /*Opening div: Schema composition*/ }
811
808
< DocLink
812
809
uri = '/understanding-json-schema/reference/combining'
@@ -818,28 +815,29 @@ export const DocsNav = ({
818
815
label = 'Modular JSON Schema combination'
819
816
setOpen = { setOpen }
820
817
/>
821
- </ div > { ' ' }
818
+ </ div >
822
819
{ /*Closing div: Schema composition*/ }
823
820
< DocLink
824
821
uri = '/understanding-json-schema/reference/non_json_data'
825
822
label = 'Media: string-encoding non-JSON data'
826
823
setOpen = { setOpen }
827
824
/>
825
+ { /*Closing div: Schema composition*/ }
828
826
< DocLinkBlank
829
827
uri = 'https://www.learnjsonschema.com/'
830
828
label = 'Learn JSON Schema'
831
829
setOpen = { setOpen }
832
830
/>
833
831
</ div >
834
- </ div > { ' ' }
832
+ </ div >
835
833
{ /*Closing div: inner reference div */ }
836
834
{ /* Specification */ }
837
- < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden ' >
835
+ < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden transition-transform duration-300 hover:scale-95 ' >
838
836
< div
839
837
className = 'flex justify-between w-full items-center'
840
838
onClick = { handleClickSpec }
841
839
>
842
- < div className = 'flex items-center align-middle' >
840
+ < div className = 'flex items-center align-middle' >
843
841
< Image
844
842
src = { `${ spec_icon } ` }
845
843
alt = 'clipboard icon'
@@ -873,8 +871,7 @@ export const DocsNav = ({
873
871
</ div >
874
872
< div
875
873
className = { classnames (
876
- 'ml-6' ,
877
- 'transition-all duration-500 ease-in-out' ,
874
+ 'ml-6 transition-all duration-500 ease-in-out' ,
878
875
{
879
876
'max-h-0 opacity-0 overflow-hidden' : ! active . getSpecification ,
880
877
'max-h-80 opacity-100 overflow-hidden' : active . getSpecification ,
@@ -883,23 +880,19 @@ export const DocsNav = ({
883
880
id = 'specification'
884
881
>
885
882
< DocLink uri = '/specification' label = 'Overview' setOpen = { setOpen } />
886
-
887
883
< SegmentSubtitle label = 'Versions' />
888
884
< div className = 'pl-4 pb-1 pt-1' >
889
885
< DocLink uri = '/draft/2020-12' label = '2020-12' setOpen = { setOpen } />
890
-
891
886
< DocLink uri = '/draft/2019-09' label = '2019-09' setOpen = { setOpen } />
892
887
< DocLink uri = '/draft-07' label = 'draft-07' setOpen = { setOpen } />
893
888
< DocLink uri = '/draft-06' label = 'draft-06' setOpen = { setOpen } />
894
889
< DocLink uri = '/draft-05' label = 'draft-05' setOpen = { setOpen } />
895
890
</ div >
896
-
897
891
< DocLink
898
892
uri = '/specification-links'
899
893
label = 'Specification links'
900
894
setOpen = { setOpen }
901
895
/>
902
-
903
896
< DocLink
904
897
uri = '/specification/migration'
905
898
label = 'Migration'
@@ -910,7 +903,6 @@ export const DocsNav = ({
910
903
label = 'Release notes'
911
904
setOpen = { setOpen }
912
905
/>
913
-
914
906
< DocLink
915
907
uri = '/specification/json-hyper-schema'
916
908
label = 'JSON Hyper-Schema'
0 commit comments