Skip to content

Commit 4de9d36

Browse files
arturfracalaArtur Fracala
andauthored
feat: add console link to navbar (#1568)
* feat: add console link to navbar * feat: add fixes * feat: add fixes --------- Co-authored-by: Artur Fracala <[email protected]>
1 parent bc46804 commit 4de9d36

File tree

4 files changed

+133
-18
lines changed

4 files changed

+133
-18
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import React from "react";
2+
/** @jsx jsx */ import { jsx, css } from "@emotion/core";
3+
4+
const linkCss = css`
5+
border-radius: 0.25rem;
6+
border-style: solid;
7+
border-width: 1px;
8+
display: none;
9+
font-weight: 500;
10+
line-height: normal;
11+
padding: 0.5rem 1rem;
12+
text-align: center;
13+
text-decoration: none;
14+
transition: background 0.2s, color 0.2s, border 0.2s;
15+
-webkit-user-select: none;
16+
-moz-user-select: none;
17+
user-select: none;
18+
vertical-align: middle;
19+
white-space: nowrap;
20+
color: #ffffff;
21+
border-color: #c9c9cd;
22+
margin-right: 0.5rem;
23+
height: 36px;
24+
25+
&:hover {
26+
text-decoration: none;
27+
color: #424d57;
28+
border-color: #424d57;
29+
background-color: #ffffff;
30+
}
31+
32+
@media (min-width: 1024px) {
33+
display: inline-block;
34+
}
35+
`;
36+
37+
const DeveloperConsole = () => {
38+
return (
39+
<a
40+
href={process.env.NEXT_PUBLIC_CONSOLE_URL}
41+
target="_blank"
42+
rel="noopener noreferrer"
43+
css={linkCss}
44+
>
45+
Developer Console
46+
</a>
47+
);
48+
};
49+
50+
export default DeveloperConsole;

src/components/core/Navbar/Header.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ import React, { useContext, useState } from "react";
22
/** @jsx jsx */ import { jsx, css } from "@emotion/core";
33
import styled from "@emotion/styled";
44
import Link from "next/link";
5-
import dynamic from "next/dynamic";
65
import { useRouter } from "next/router";
76
import Menu from "react-material-icon-svg/dist/Menu";
8-
import Magnify from "react-material-icon-svg/dist/Magnify";
97
import Close from "react-material-icon-svg/dist/Close";
108

119
import { PromotionContext } from "contexts";
@@ -15,6 +13,7 @@ import Search from "components/core/Search";
1513
import Platform from "./Platform";
1614
import APIsSDKs from "./APIsSDKs";
1715
import Resources from "./Resources";
16+
import DeveloperConsole from "./DeveloperConsole";
1817
import MobileMenu from "./MobileMenu/MobileMenu";
1918

2019
const Wrapper = styled.div`
@@ -136,19 +135,6 @@ const ActionsWrapper = styled.div`
136135
align-items: center;
137136
`;
138137

139-
const MagnifyIcon = styled(Magnify)`
140-
display: flex;
141-
margin-right: 8px;
142-
cursor: pointer;
143-
${({ openSearch }) => openSearch && `background-color: #6E6E7C`};
144-
border-radius: 50px;
145-
padding: 4px;
146-
147-
@media (min-width: 1024px) {
148-
display: none;
149-
}
150-
`;
151-
152138
const MenuIcon = styled(Menu)`
153139
display: flex;
154140
margin-right: 16px;
@@ -204,6 +190,7 @@ const Header = () => {
204190
</MenuListWrapper>
205191

206192
<ActionsWrapper>
193+
<DeveloperConsole />
207194
{isNotHomeDirectory && (
208195
<DesktopSearchField className="DocSearch-Button-Desktop">
209196
<Search />

src/components/core/Navbar/MobileMenu/MobileMenu.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@ const Wrapper = styled.div`
2222
}
2323
`;
2424

25+
const DirectLink = styled.a`
26+
display: flex;
27+
justify-content: space-between;
28+
align-items: center;
29+
color: #ffffff;
30+
text-decoration: none;
31+
font-weight: 500;
32+
font-size: 20px;
33+
line-height: 28px;
34+
padding: 26px 24px;
35+
border-top: 1px solid #6e6e7c;
36+
border-bottom: 1px solid #6e6e7c;
37+
38+
&:hover {
39+
background-color: #62626d;
40+
color: #ffffff;
41+
text-decoration: none;
42+
}
43+
`;
44+
2545
const items = [
2646
{
2747
header: "Platform",
@@ -35,7 +55,7 @@ const items = [
3555
],
3656
},
3757
{
38-
header: "Recources",
58+
header: "Resources",
3959
sections: [
4060
{ title: "", items: resources },
4161
{ title: "Connect", items: connects },
@@ -54,6 +74,13 @@ const MobileMenu = () => {
5474
sections={item.sections}
5575
/>
5676
))}
77+
<DirectLink
78+
href={process.env.NEXT_PUBLIC_CONSOLE_URL}
79+
target="_blank"
80+
rel="noopener noreferrer"
81+
>
82+
Developer Console
83+
</DirectLink>
5784
</Wrapper>
5885
);
5986
};

src/components/core/SideNav/SideNav.js

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import HomeItem from "./HomeItem";
1010
import MenuItem from "./MenuItem";
1111
import NestedMenu from "./NestedMenu";
1212
import { getStableVersion } from "../../../utils";
13+
import Console from "react-material-icon-svg/dist/Console";
1314

1415
const Wrapper = styled.aside`
1516
border-right: 1px solid #e2e2e4;
@@ -51,12 +52,11 @@ const MenuWrapper = styled.div`
5152
overflow: scroll;
5253
height: calc(100% - 90px);
5354
@media (min-width: 768px) {
54-
height: calc(100% - 60px);
55+
height: calc(100% - 80px);
5556
position: fixed;
5657
5758
display: flex;
5859
flex-direction: column;
59-
height: 100%;
6060
max-height: 100vh;
6161
position: -webkit-sticky;
6262
position: sticky;
@@ -65,6 +65,45 @@ const MenuWrapper = styled.div`
6565
}
6666
`;
6767

68+
const DeveloperConsoleLink = styled.a`
69+
display: flex;
70+
align-items: center;
71+
color: #62626d;
72+
text-decoration: none;
73+
margin-right: 10px;
74+
font-weight: 500;
75+
font-size: 16px;
76+
border-radius: 0px 8px 8px 0px;
77+
margin-top: 0;
78+
79+
&:hover {
80+
background-color: #f6f6f7;
81+
color: #4284f5;
82+
text-decoration: none;
83+
84+
svg {
85+
fill: #4284f5;
86+
}
87+
}
88+
89+
@media (min-width: 768px) {
90+
margin-top: auto;
91+
}
92+
`;
93+
94+
const LinkArea = styled.div`
95+
display: flex;
96+
align-items: center;
97+
padding: 6px 16px 6px 18px;
98+
width: 100%;
99+
`;
100+
101+
const IconWrapper = styled.div`
102+
display: flex;
103+
align-items: center;
104+
margin-right: 8px;
105+
`;
106+
68107
const openIconStyle = {
69108
transform: "rotate(270deg)",
70109
transition: "transform 300ms",
@@ -121,6 +160,18 @@ const SideNav = ({
121160
/>
122161
))
123162
)}
163+
<DeveloperConsoleLink
164+
href={process.env.NEXT_PUBLIC_CONSOLE_URL}
165+
target="_blank"
166+
rel="noopener noreferrer"
167+
>
168+
<LinkArea>
169+
<IconWrapper>
170+
<Console fill="#424D57" width="20px" height="20px" />
171+
</IconWrapper>
172+
Developer Console
173+
</LinkArea>
174+
</DeveloperConsoleLink>
124175
</MenuWrapper>
125176
</Wrapper>
126177
);

0 commit comments

Comments
 (0)