1
1
import { ComponentProps , ReactNode } from 'react' ;
2
2
import { cn } from '../cn' ;
3
3
import { HiveCombinationMark } from '../logos' ;
4
- import { PRODUCTS } from '../products' ;
4
+ import { FOUR_MAIN_PRODUCTS , SIX_HIGHLIGHTED_PRODUCTS } from '../products' ;
5
5
import { IFooterExtendedProps , ILink } from '../types/components' ;
6
6
import { Anchor } from './anchor' ;
7
7
import {
@@ -15,17 +15,21 @@ import {
15
15
16
16
export interface HiveFooterProps extends IFooterExtendedProps {
17
17
description ?: string ;
18
- isHive ?: boolean ;
18
+ /**
19
+ * @deprecated use `items` instead
20
+ */
21
+ resources ?: never ;
22
+ items ?: HiveFooterItems ;
19
23
}
20
24
21
25
export function HiveFooter ( {
22
26
className,
23
27
logo,
24
- resources = [ ] ,
25
28
sameSite,
26
29
description,
27
- isHive = false ,
30
+ items = { } ,
28
31
} : HiveFooterProps ) {
32
+ items = { ...HiveFooter . DEFAULT_ITEMS , ...items } ;
29
33
description ||= 'Open-source GraphQL management platform' ;
30
34
31
35
return (
@@ -43,28 +47,22 @@ export function HiveFooter({
43
47
< p className = "mt-6 lg:mt-8" > { description } </ p >
44
48
</ div >
45
49
< div className = "col-span-full grid grid-flow-row grid-cols-2 justify-stretch gap-6 text-sm sm:col-span-4 sm:grid-cols-3 lg:col-span-3 lg:pb-12 lg:text-base" >
46
- < List heading = "Products" links = { products } />
50
+ < List heading = "Products" links = { productLinks } />
51
+
47
52
< div className = "flex flex-col gap-[inherit]" >
48
- < List heading = "Developer" links = { DEVELOPER } />
49
- { ENTERPRISE . length > 0 && < List heading = "Enterprise" links = { ENTERPRISE } /> }
50
- { resources . length > 0 && < List heading = "Resources" links = { resources } /> }
53
+ < List heading = "Developer" links = { items . developer } />
54
+ < List heading = "Resources" links = { items . resources } />
51
55
</ div >
56
+
52
57
< div className = "flex flex-col gap-[inherit]" >
53
- < List heading = "Company" links = { COMPANY } />
54
- { isHive ? (
55
- < a
56
- href = "https://the-guild.dev/graphql/hive/oss-friends"
58
+ < List heading = "Company" links = { items . company } />
59
+ { items . links ?. map ( ( link , i ) => (
60
+ < Anchor
61
+ key = { i }
57
62
className = "hive-focus -m-2 rounded p-2 font-medium hover:text-blue-700 hover:underline dark:hover:text-blue-100"
58
- >
59
- OSS Friends
60
- </ a >
61
- ) : null }
62
- < a
63
- href = "https://the-guild.dev/graphql/hive#pricing"
64
- className = "hive-focus -m-2 rounded p-2 font-medium hover:text-blue-700 hover:underline dark:hover:text-blue-100"
65
- >
66
- Pricing
67
- </ a >
63
+ { ...link }
64
+ />
65
+ ) ) }
68
66
< a
69
67
className = "hive-focus -m-2 rounded p-2 font-medium hover:text-blue-700 hover:underline dark:hover:text-blue-100"
70
68
href = "https://the-guild.dev/contact"
@@ -80,9 +78,10 @@ export function HiveFooter({
80
78
</ div >
81
79
< CSAStarLink className = "sm:col-start-[-1] lg:col-start-[-2]" />
82
80
</ div >
81
+
83
82
< div className = "col-span-full flex flex-row flex-wrap justify-between gap-x-[inherit] gap-y-8 lg:w-full lg:pb-2 lg:pt-8" >
84
83
< div className = "flex gap-6 lg:order-1" >
85
- { COMMUNITY . map ( ( { icon : Icon , ...iconProps } ) => (
84
+ { SOCIAL_ICONS . map ( ( { icon : Icon , ...iconProps } ) => (
86
85
< Anchor
87
86
key = { iconProps . title }
88
87
className = "hive-focus -m-1 rounded-md p-1 hover:text-blue-700 dark:hover:text-blue-100"
@@ -107,9 +106,11 @@ function List({
107
106
className,
108
107
} : {
109
108
heading : string ;
110
- links : ILink [ ] ;
109
+ links : ILink [ ] | undefined ;
111
110
className ?: string ;
112
111
} ) {
112
+ if ( ! links ?. length ) return null ;
113
+
113
114
return (
114
115
< div className = { cn ( 'flex flex-col gap-y-3 text-nowrap lg:gap-y-4' , className ) } >
115
116
< h3 className = "font-medium dark:text-white" > { heading } </ h3 >
@@ -127,69 +128,73 @@ function List({
127
128
) ;
128
129
}
129
130
130
- const ENTERPRISE : ILink [ ] = [
131
- // {
132
- // children: 'Consumer Stories',
133
- // href: '#TODO!',
134
- // },
135
- // {
136
- // children: 'Why GraphQL',
137
- // href: '#TODO!',
138
- // },
139
- // {
140
- // children: 'Professional Services',
141
- // href: '#TODO!',
142
- // },
143
- // {
144
- // children: 'Commitment to Security',
145
- // href: '#TODO!',
146
- // },
147
- ] ;
131
+ export interface HiveFooterItems {
132
+ developer ?: ILink [ ] ;
133
+ company ?: ILink [ ] ;
134
+ resources ?: ILink [ ] ;
135
+ links ?: ILink [ ] ;
136
+ }
148
137
149
- const DEVELOPER : ILink [ ] = [
150
- {
151
- children : 'Documentation' ,
152
- title : 'Read the docs' ,
153
- href : '/docs' ,
154
- } ,
155
- {
156
- children : 'Hive Status' ,
157
- title : 'Check Hive status' ,
158
- href : 'https://status.graphql-hive.com/' ,
159
- } ,
160
- {
161
- children : 'Hive Updates' ,
162
- title : 'Read most recent developments from Hive' ,
163
- href : 'https://the-guild.dev/graphql/hive/product-updates' ,
164
- } ,
165
- {
166
- children : 'Blog' ,
167
- title : 'Read our blog' ,
168
- href : 'https://the-guild.dev/blog' ,
169
- } ,
170
- ] ;
138
+ const DEFAULT_ITEMS : HiveFooterItems = {
139
+ developer : [
140
+ {
141
+ children : 'Documentation' ,
142
+ title : 'Read the docs' ,
143
+ href : '/docs' ,
144
+ } ,
145
+ {
146
+ children : 'Hive Status' ,
147
+ title : 'Check Hive status' ,
148
+ href : 'https://status.graphql-hive.com/' ,
149
+ } ,
150
+ {
151
+ children : 'Hive Updates' ,
152
+ title : 'Read most recent developments from Hive' ,
153
+ href : 'https://the-guild.dev/graphql/hive/product-updates' ,
154
+ } ,
155
+ {
156
+ children : 'Blog' ,
157
+ title : 'Read our blog' ,
158
+ href : 'https://the-guild.dev/blog' ,
159
+ } ,
160
+ ] ,
161
+ company : [
162
+ {
163
+ children : 'About' ,
164
+ title : 'Learn more about us' ,
165
+ href : 'https://the-guild.dev/about-us' ,
166
+ } ,
167
+ {
168
+ children : 'Brand Assets' ,
169
+ title : 'Brand Assets' ,
170
+ href : 'https://the-guild.dev/logos' ,
171
+ } ,
172
+ {
173
+ children : 'Newsletter' ,
174
+ title : 'Newsletter' ,
175
+ href : 'https://the-guild.dev/newsletter' ,
176
+ } ,
177
+ ] ,
178
+ resources : [ ] ,
179
+ links : [
180
+ {
181
+ children : 'OSS Friends' ,
182
+ href : 'https://the-guild.dev/graphql/hive/oss-friends' ,
183
+ } ,
184
+ {
185
+ children : 'Pricing' ,
186
+ href : 'https://the-guild.dev/graphql/hive#pricing' ,
187
+ } ,
188
+ ] ,
189
+ } ;
171
190
172
- const COMPANY : ILink [ ] = [
173
- {
174
- children : 'About' ,
175
- title : 'Learn more about us' ,
176
- href : 'https://the-guild.dev/about-us' ,
177
- } ,
178
- {
179
- children : 'Brand Assets' ,
180
- title : 'Brand Assets' ,
181
- href : 'https://the-guild.dev/logos' ,
182
- } ,
183
- {
184
- children : 'Newsletter' ,
185
- title : 'Newsletter' ,
186
- href : 'https://the-guild.dev/newsletter' ,
187
- } ,
188
- ] ;
191
+ HiveFooter . DEFAULT_ITEMS = DEFAULT_ITEMS ;
189
192
190
- const COMMUNITY : ( Omit < ILink , 'children' > & {
193
+ interface SocialLink extends Omit < ILink , 'children' > {
191
194
icon : ( props : ComponentProps < 'svg' > ) => ReactNode ;
192
- } ) [ ] = [
195
+ }
196
+
197
+ const SOCIAL_ICONS : SocialLink [ ] = [
193
198
{
194
199
icon : GitHubIcon ,
195
200
title : 'Check our GitHub account' ,
@@ -217,22 +222,13 @@ const COMMUNITY: (Omit<ILink, 'children'> & {
217
222
} ,
218
223
] ;
219
224
220
- const products = [
221
- PRODUCTS . HIVE ,
222
- PRODUCTS . MESH ,
223
- PRODUCTS . YOGA ,
224
- PRODUCTS . CODEGEN ,
225
- PRODUCTS . INSPECTOR ,
226
- PRODUCTS . SCALARS ,
227
- PRODUCTS . ENVELOP ,
228
- PRODUCTS . ESLINT ,
229
- PRODUCTS . SOFA ,
230
- // TODO: All libraries, go to /explore page
231
- ] . map ( ( { name, href, title } ) => ( {
232
- children : name ,
233
- href,
234
- title,
235
- } ) ) ;
225
+ const productLinks = [ ...FOUR_MAIN_PRODUCTS , ...SIX_HIGHLIGHTED_PRODUCTS ] . map (
226
+ ( { name, href, title } ) => ( {
227
+ children : name ,
228
+ href,
229
+ title,
230
+ } ) ,
231
+ ) ;
236
232
237
233
function DecorationArch ( props : React . SVGProps < SVGSVGElement > ) {
238
234
return (
0 commit comments