File tree Expand file tree Collapse file tree 5 files changed +121
-4
lines changed Expand file tree Collapse file tree 5 files changed +121
-4
lines changed Original file line number Diff line number Diff line change 8
8
"logo" : " /uploads/tinaDocsLogo.svg" ,
9
9
"navObjects" : [
10
10
{
11
- "href" : " https://tina.io/tinadocs/docs" ,
12
- "label" : " Documentation" ,
13
- "_template" : " navLink"
11
+ "label" : " Products" ,
12
+ "items" : [
13
+ {
14
+ "labelLeft" : " TinaCMS" ,
15
+ "hrefLeft" : " /" ,
16
+ "labelRight" : " Docs" ,
17
+ "hrefRight" : " /docs"
18
+ },
19
+ {
20
+ "labelLeft" : " TinaDocs" ,
21
+ "hrefLeft" : " /tinadocs" ,
22
+ "labelRight" : " Docs" ,
23
+ "hrefRight" : " /tinadocs/docs"
24
+ }
25
+ ],
26
+ "_template" : " doubleNavItemDropDown"
14
27
},
15
28
{
16
29
"href" : " /pricing" ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { ModalButton } from "../../ui/modalButton";
10
10
import { DropdownButton } from "../../ui/dropdownButton" ;
11
11
import { GitHubButton } from "../../ui/githubButton" ;
12
12
import { SearchBar } from "../../ui/searchBar" ;
13
+ import { DoubleItemDropDownButton } from "../../ui/doubleItemDropDownButton" ;
13
14
14
15
const NavigationObjectRenderer = ( { navObject } : { navObject : any } ) => {
15
16
const template = navObject . __typename ;
@@ -70,6 +71,8 @@ const NavigationObjectRenderer = ({ navObject }: { navObject: any }) => {
70
71
</ div >
71
72
</ >
72
73
) ;
74
+ case "GlobalHeaderNavObjectsDoubleNavItemDropDown" :
75
+ return < DoubleItemDropDownButton navObject = { navObject } /> ;
73
76
74
77
default :
75
78
return < span className = "text-red-500" > Unknown template: { template } </ span > ;
Original file line number Diff line number Diff line change
1
+ import Link from "next/link" ;
2
+ import { useState } from "react" ;
3
+ import { BiChevronDown } from "react-icons/bi" ;
4
+
5
+ export const DoubleItemDropDownButton = ( { navObject } : { navObject : any } ) => {
6
+ if ( ! navObject || ! navObject . label ) {
7
+ return null ;
8
+ }
9
+
10
+ return (
11
+ < li key = { `$${ navObject . label } ` } className = "group" >
12
+ < div className = "relative group" >
13
+ < span className = "flex items-center cursor-pointer text-neutral-text" >
14
+ { navObject . label }
15
+ < BiChevronDown className = "ml-1 w-3 h-3 transition-transform duration-200 group-hover:rotate-180" />
16
+ </ span >
17
+ { navObject . items && navObject . items . length > 0 && (
18
+ < ul className = "absolute left-0 top-full mt-2 w-48 bg-background border rounded-lg shadow-lg opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-200 z-50" >
19
+ < div className = "py-2" >
20
+ { navObject . items . map ( ( subItem : any , subIndex : any ) => (
21
+ < div
22
+ key = { `${ subIndex } -${ subItem ?. hrefLeft || "no-href" } ` }
23
+ className = "flex items-center gap-2 px-4 py-2"
24
+ >
25
+ < Link
26
+ className = "text-muted-foreground hover:text-accent-foreground text-sm duration-150"
27
+ href = { subItem ?. hrefLeft || "#" }
28
+ >
29
+ { subItem ?. labelLeft || "No Label" }
30
+ </ Link >
31
+ < span className = "text-muted-foreground" > •</ span >
32
+ < Link
33
+ className = "text-muted-foreground hover:text-accent-foreground text-sm duration-150"
34
+ href = { subItem ?. hrefRight || "#" }
35
+ >
36
+ { subItem ?. labelRight || "No Label" }
37
+ </ Link >
38
+ </ div >
39
+ ) ) }
40
+ </ div >
41
+ </ ul >
42
+ ) }
43
+ </ div >
44
+ </ li >
45
+ ) ;
46
+ } ;
Original file line number Diff line number Diff line change @@ -3,6 +3,60 @@ import { ColorPickerInput } from "../fields/color";
3
3
import { iconSchema } from "../fields/icon" ;
4
4
import { buttonVariantsArray } from "@/src/components/ui/button" ;
5
5
6
+ const navDoubleLinkDropdown =
7
+ {
8
+ name : 'doubleNavItemDropDown' ,
9
+ label : 'Double Nav Item Dropdown' ,
10
+ type : 'object' ,
11
+ ui : {
12
+ itemProps : ( item : any ) => {
13
+ return { label : `🥈 ${ item ?. label } ` } ;
14
+ } ,
15
+ } ,
16
+ fields : [
17
+ {
18
+ name : 'label' ,
19
+ label : 'Label' ,
20
+ type : 'string' ,
21
+ } ,
22
+ {
23
+ name : 'items' ,
24
+ label : 'Item' ,
25
+ type : 'object' ,
26
+ list : true ,
27
+ ui : {
28
+ itemProps : ( item : any ) => {
29
+ return {
30
+ label : `🥈 ${ item ?. labelLeft } | ${ item ?. labelRight } ` ,
31
+ } ;
32
+ } ,
33
+ } ,
34
+ fields : [
35
+ {
36
+ name : 'labelLeft' ,
37
+ label : 'Label Left' ,
38
+ type : 'string' ,
39
+ } ,
40
+ {
41
+ name : 'hrefLeft' ,
42
+ label : 'href Left' ,
43
+ type : 'string' ,
44
+ } ,
45
+ {
46
+ name : 'labelRight' ,
47
+ label : 'Label Right' ,
48
+ type : 'string' ,
49
+ } ,
50
+ {
51
+ name : 'hrefRight' ,
52
+ label : 'href Right' ,
53
+ type : 'string' ,
54
+ } ,
55
+ ] ,
56
+ } ,
57
+ ] ,
58
+ }
59
+
6
60
const navLink = {
7
61
name : "navLink" ,
8
62
label : "Nav Link" ,
@@ -152,6 +206,7 @@ const Global: Collection = {
152
206
githubButton ,
153
207
ctaButton ,
154
208
demoModalButton ,
209
+ navDoubleLinkDropdown ,
155
210
] ,
156
211
} ,
157
212
] ,
Load Diff Large diffs are not rendered by default.
You can’t perform that action at this time.
0 commit comments