Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit 65293c6

Browse files
authored
Merge pull request #437 from jlin27/development
Add docs dropdown in header
2 parents 4424324 + 3439125 commit 65293c6

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import * as React from 'react';
2+
import styled from 'styled-components';
3+
import { Heading, Paragraph } from 'ts/components/text';
4+
import { WebsitePaths } from 'ts/types';
5+
import { constants } from 'ts/utils/constants';
6+
7+
import { Link } from '../documentation/shared/link';
8+
9+
const navData = [
10+
{
11+
title: '0x Docs',
12+
description: 'Learn and build with 0x',
13+
url: WebsitePaths.Docs,
14+
},
15+
{
16+
title: '(Alpha Release) 0x Docs',
17+
description: 'Get a sneak peek at our updated documentation',
18+
url: 'https://docs.0x.org/',
19+
shouldOpenInNewTab: true,
20+
},
21+
];
22+
23+
export const DropdownDocs: React.FC = () => (
24+
<List>
25+
{navData.map((item, index) => (
26+
<li key={`productLink-${index}`}>
27+
<Link to={item.url} shouldOpenInNewTab={item.shouldOpenInNewTab}>
28+
<Heading asElement="h3" color="inherit" isNoMargin={true} size="small">
29+
{item.title}
30+
</Heading>
31+
32+
{item.description && (
33+
<Paragraph color="inherit" isNoMargin={true} size="small" isMuted={0.5}>
34+
{item.description}
35+
</Paragraph>
36+
)}
37+
</Link>
38+
</li>
39+
))}
40+
</List>
41+
);
42+
43+
const List = styled.ul`
44+
a {
45+
padding: 15px 30px;
46+
display: block;
47+
color: inherit;
48+
}
49+
`;

ts/components/header.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Link } from 'ts/components/documentation/shared/link';
77
import { Button } from 'ts/components/button';
88
// import { DropdownProducts } from 'ts/components/dropdowns/dropdown_products';
99
// import { DropdownResources } from 'ts/components/dropdowns/dropdown_resources';
10+
import { DropdownDocs } from 'ts/components/dropdowns/dropdown_docs';
1011
import { Hamburger } from 'ts/components/hamburger';
1112
import { Logo } from 'ts/components/logo';
1213
import { MobileNav } from 'ts/components/mobile_nav';
@@ -41,7 +42,8 @@ const navItems: NavItemProps[] = [
4142
{
4243
id: 'docs',
4344
text: 'Developers',
44-
url: WebsitePaths.Docs,
45+
dropdownComponent: DropdownDocs,
46+
dropdownWidth: 270,
4547
},
4648
{
4749
id: 'zrx',

0 commit comments

Comments
 (0)