MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / Header

Function Header

apps/web/ui/Header/index.tsx:54–169  ·  view source on GitHub ↗
({
  settings,
  channels,
  channelName,
  currentCommunity,
  permissions,
  JoinButton,
  Link,
  InternalLink,
  routerAsPath,
  signOut,
  usePath,
  api,
  handleSelect,
  logoClassName,
  typesense,
  isSubDomainRouting,
}: Props)

Source from the content-addressed store, hash-verified

52}
53
54export default function Header({
55 settings,
56 channels,
57 channelName,
58 currentCommunity,
59 permissions,
60 JoinButton,
61 Link,
62 InternalLink,
63 routerAsPath,
64 signOut,
65 usePath,
66 api,
67 handleSelect,
68 logoClassName,
69 typesense,
70 isSubDomainRouting,
71}: Props) {
72 const brandColor = currentCommunity.brandColor || 'var(--color-navbar)';
73 const fontColor = pickTextColorBasedOnBgColor(brandColor, 'white', 'black');
74 const homeUrl = addHttpsToUrl(settings.homeUrl);
75 const logoUrl = addHttpsToUrl(settings.logoUrl);
76 const borderColor = isWhiteColor(brandColor) ? '#e5e7eb' : brandColor;
77
78 return (
79 <div
80 className={styles.container}
81 style={{
82 backgroundColor: brandColor,
83 borderBottom: `1px solid ${brandColor}`,
84 borderTop: `1px solid ${brandColor}`,
85 }}
86 >
87 <Link
88 className={classNames(styles.logo, logoClassName)}
89 href={homeUrl || '/'}
90 passHref
91 target="_blank"
92 >
93 <Logo src={logoUrl} alt={`${homeUrl} logo`} />
94 </Link>
95 {!!currentCommunity.search?.apiKey &&
96 currentCommunity.search?.engine === 'typesense' &&
97 typesense?.searchClient ? (
98 <TypesenseSearch
99 apiKey={currentCommunity.search?.apiKey}
100 key={`${currentCommunity.search?.apiKey}`}
101 searchClient={typesense.searchClient}
102 settings={settings}
103 routing={typesense.routing}
104 middlewares={typesense.middlewares}
105 isSubDomainRouting={isSubDomainRouting}
106 />
107 ) : (
108 <SearchBar
109 className={styles.search}
110 brandColor={brandColor}
111 channels={channels}

Callers

nothing calls this directly

Calls 3

addHttpsToUrlFunction · 0.90
isWhiteColorFunction · 0.70

Tested by

no test coverage detected