@@ -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-primary' ,
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-primary' ,
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,14 @@ export const DocsNav = ({
570
572
/>
571
573
</ div >
572
574
</ div >
573
- </ div > { ' ' }
574
- { /* Closing div: Get started */ }
575
+ </ div >
575
576
{ /* Guides */ }
576
- < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden ' >
577
+ < 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
578
< div
578
579
className = 'flex justify-between w-full items-center'
579
580
onClick = { handleClickGuides }
580
581
>
581
- < div className = 'flex items-center align-middle' >
582
+ < div className = 'flex items-center align-middle' >
582
583
< Image
583
584
src = { `${ guides_icon } ` }
584
585
alt = 'grad cap icon'
@@ -626,17 +627,15 @@ export const DocsNav = ({
626
627
setOpen = { setOpen }
627
628
/>
628
629
</ div >
629
- { /*Closing div tag: for implementers*/ }
630
630
</ div >
631
- </ div > { ' ' }
632
- { /* Closing div: Guides */ }
631
+ </ div >
633
632
{ /* Reference */ }
634
- < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden ' >
633
+ < 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
634
< div
636
635
className = 'flex justify-between w-full items-center'
637
636
onClick = { handleClickReference }
638
637
>
639
- < div className = 'flex items-center align-middle' >
638
+ < div className = 'flex items-center align-middle' >
640
639
< Image
641
640
src = { `${ reference_icon } ` }
642
641
alt = 'book icon'
@@ -667,11 +666,9 @@ export const DocsNav = ({
667
666
/>
668
667
</ svg >
669
668
</ div >
670
- { /*Opening div: inner reference div */ }
671
669
< div
672
670
className = { classnames (
673
- 'ml-6' ,
674
- 'transition-all duration-500 ease-in-out' ,
671
+ 'ml-6 transition-all duration-500 ease-in-out' ,
675
672
{
676
673
'max-h-0 opacity-0 overflow-hidden' : ! active . getReference ,
677
674
'max-h-80 overflow-y-auto opacity-100' : active . getReference ,
@@ -689,31 +686,12 @@ export const DocsNav = ({
689
686
label = 'JSON Schema keywords'
690
687
setOpen = { setOpen }
691
688
/>
692
- { /*<DocLink
693
- uri='/understanding-json-schema'
694
- label='Understanding JSON Schema'
695
- setOpen={setOpen}
696
- />*/ }
697
- { /*<div className='pl-4 pb-1 pt-1'>*/ }
698
- { /*<DocLink
699
- uri='/understanding-json-schema/conventions'
700
- label='Conventions used'
701
- setOpen={setOpen}
702
- />*/ }
703
- { /*<DocLink
704
- uri='/understanding-json-schema/reference'
705
- label='JSON Schema Reference'
706
- setOpen={setOpen}
707
- />
708
- <div className='pl-4 pb-1 pt-1'> Opening div tag: understanding JSON*/ }
709
689
< DocLink
710
690
uri = '/understanding-json-schema/reference/type'
711
691
label = 'JSON data types'
712
692
setOpen = { setOpen }
713
693
/>
714
694
< div className = 'pl-4 pb-1 pt-1' >
715
- { ' ' }
716
- { /*Opening div: JSON data types*/ }
717
695
< DocLink
718
696
uri = '/understanding-json-schema/reference/array'
719
697
label = 'array'
@@ -749,8 +727,7 @@ export const DocsNav = ({
749
727
label = 'string'
750
728
setOpen = { setOpen }
751
729
/>
752
- </ div > { ' ' }
753
- { /*Closing div: JSON data types*/ }
730
+ </ div >
754
731
< DocLink
755
732
uri = '/understanding-json-schema/reference/schema'
756
733
label = 'Dialect and vocabulary declaration'
@@ -762,8 +739,6 @@ export const DocsNav = ({
762
739
setOpen = { setOpen }
763
740
/>
764
741
< div className = 'pl-4 pb-1 pt-1' >
765
- { ' ' }
766
- { /*Opening div: Schema constraints*/ }
767
742
< DocLink
768
743
uri = '/understanding-json-schema/reference/enum'
769
744
label = 'Enumerated values'
@@ -774,15 +749,13 @@ export const DocsNav = ({
774
749
label = 'Constant values'
775
750
setOpen = { setOpen }
776
751
/>
777
- </ div > { ' ' }
778
- { /*Closing div: Schema constraints*/ }
752
+ </ div >
779
753
< DocLink
780
754
uri = '/understanding-json-schema/reference/metadata'
781
755
label = 'Schema annotations and comments'
782
756
setOpen = { setOpen }
783
757
/>
784
758
< div className = 'pl-4 pb-1 pt-1' >
785
- { /*Opening div: Schema metadata*/ }
786
759
< DocLink
787
760
uri = '/understanding-json-schema/reference/annotations'
788
761
label = 'Annotations'
@@ -793,8 +766,7 @@ export const DocsNav = ({
793
766
label = 'Comments'
794
767
setOpen = { setOpen }
795
768
/>
796
- </ div > { ' ' }
797
- { /*Closing div: Schema metadata*/ }
769
+ </ div >
798
770
< DocLink
799
771
uri = '/understanding-json-schema/reference/conditionals'
800
772
label = 'Conditional schema validation'
@@ -806,8 +778,6 @@ export const DocsNav = ({
806
778
setOpen = { setOpen }
807
779
/>
808
780
< div className = 'pl-4 pb-1 pt-1' >
809
- { ' ' }
810
- { /*Opening div: Schema composition*/ }
811
781
< DocLink
812
782
uri = '/understanding-json-schema/reference/combining'
813
783
label = 'Boolean JSON Schema combination'
@@ -818,8 +788,7 @@ export const DocsNav = ({
818
788
label = 'Modular JSON Schema combination'
819
789
setOpen = { setOpen }
820
790
/>
821
- </ div > { ' ' }
822
- { /*Closing div: Schema composition*/ }
791
+ </ div >
823
792
< DocLink
824
793
uri = '/understanding-json-schema/reference/non_json_data'
825
794
label = 'Media: string-encoding non-JSON data'
@@ -831,15 +800,14 @@ export const DocsNav = ({
831
800
setOpen = { setOpen }
832
801
/>
833
802
</ div >
834
- </ div > { ' ' }
835
- { /*Closing div: inner reference div */ }
803
+ </ div >
836
804
{ /* Specification */ }
837
- < div className = 'mb-2 bg-slate-200 dark:bg-slate-900 p-2 rounded border border-white lg:border-hidden ' >
805
+ < 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
806
< div
839
807
className = 'flex justify-between w-full items-center'
840
808
onClick = { handleClickSpec }
841
809
>
842
- < div className = 'flex items-center align-middle' >
810
+ < div className = 'flex items-center align-middle' >
843
811
< Image
844
812
src = { `${ spec_icon } ` }
845
813
alt = 'clipboard icon'
@@ -873,8 +841,7 @@ export const DocsNav = ({
873
841
</ div >
874
842
< div
875
843
className = { classnames (
876
- 'ml-6' ,
877
- 'transition-all duration-500 ease-in-out' ,
844
+ 'ml-6 transition-all duration-500 ease-in-out' ,
878
845
{
879
846
'max-h-0 opacity-0 overflow-hidden' : ! active . getSpecification ,
880
847
'max-h-80 opacity-100 overflow-hidden' : active . getSpecification ,
@@ -883,23 +850,19 @@ export const DocsNav = ({
883
850
id = 'specification'
884
851
>
885
852
< DocLink uri = '/specification' label = 'Overview' setOpen = { setOpen } />
886
-
887
853
< SegmentSubtitle label = 'Versions' />
888
854
< div className = 'pl-4 pb-1 pt-1' >
889
855
< DocLink uri = '/draft/2020-12' label = '2020-12' setOpen = { setOpen } />
890
-
891
856
< DocLink uri = '/draft/2019-09' label = '2019-09' setOpen = { setOpen } />
892
857
< DocLink uri = '/draft-07' label = 'draft-07' setOpen = { setOpen } />
893
858
< DocLink uri = '/draft-06' label = 'draft-06' setOpen = { setOpen } />
894
859
< DocLink uri = '/draft-05' label = 'draft-05' setOpen = { setOpen } />
895
860
</ div >
896
-
897
861
< DocLink
898
862
uri = '/specification-links'
899
863
label = 'Specification links'
900
864
setOpen = { setOpen }
901
865
/>
902
-
903
866
< DocLink
904
867
uri = '/specification/migration'
905
868
label = 'Migration'
@@ -910,7 +873,6 @@ export const DocsNav = ({
910
873
label = 'Release notes'
911
874
setOpen = { setOpen }
912
875
/>
913
-
914
876
< DocLink
915
877
uri = '/specification/json-hyper-schema'
916
878
label = 'JSON Hyper-Schema'
0 commit comments