File size: 1,225 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { DiscordLogo, GithubLogo, Lifebuoy } from 'phosphor-react'
import { EventNames, firePlausibleEvent } from '~/helpers/analytics'

import { NavigationButton, NavigationButtonProps } from '../Buttons/NavButton'

const SUB_NAV: NavigationButtonProps[] = [
  {
    title: 'Github',
    href: 'https://github.com/pmndrs/react-spring',
    isExternal: true,
    Icon: GithubLogo,
  },
  {
    title: 'Discord',
    href: 'https://discord.com/invite/poimandres',
    isExternal: true,
    Icon: DiscordLogo,
  },
  {
    title: 'Support',
    href: 'https://opencollective.com/react-spring',
    isExternal: true,
    Icon: Lifebuoy,
  },
]

export interface HeaderSubNavigationProps {
  showLabels?: boolean
}

export const HeaderSubNavigation = ({
  showLabels = false,
}: HeaderSubNavigationProps) => {
  const handleClick = (label: string) => () => {
    firePlausibleEvent({
      name: EventNames.OutboundLink,
      additionalProps: {
        linkTitle: label,
      },
    })
  }

  return (
    <>
      {SUB_NAV.map(props => (
        <NavigationButton
          key={props.title}
          showLabel={showLabels}
          onClick={handleClick(props.title)}
          {...props}
        />
      ))}
    </>
  )
}