Skip to content

Commit 9cb8020

Browse files
committed
Add basic navigation bar
1 parent c735597 commit 9cb8020

File tree

12 files changed

+113
-153
lines changed

12 files changed

+113
-153
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"name": "pterodactyl-panel",
33
"dependencies": {
4+
"@fortawesome/fontawesome-svg-core": "^1.2.19",
5+
"@fortawesome/free-solid-svg-icons": "^5.9.0",
6+
"@fortawesome/react-fontawesome": "^0.1.4",
47
"@hot-loader/react-dom": "^16.8.6",
58
"axios": "^0.18.0",
69
"brace": "^0.11.1",
Lines changed: 19 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,38 @@
1-
.nav {
2-
@apply .bg-primary-600 .border-b .border-t .border-primary-700;
3-
height: 56px;
1+
#navigation {
2+
@apply .w-full .bg-neutral-900 .shadow-md;
43

5-
& .logo {
6-
@apply .mr-8 .font-sans .font-thin .text-3xl .text-white .inline-block;
7-
8-
& a {
9-
color: inherit;
10-
text-decoration: none;
11-
}
12-
13-
@screen xsx {
14-
@apply .hidden;
15-
}
16-
}
17-
18-
& .search-box {
19-
@apply .mr-2;
20-
21-
& > .search-input {
22-
@apply .text-sm .p-2 .ml-8 .rounded .border .border-primary-600 .bg-white .text-neutral-900 .w-96;
23-
transition: border 150ms ease-in;
24-
25-
&:focus {
26-
@apply .border-primary-700;
27-
}
28-
29-
&.has-search-results {
30-
@apply .border-b-0 .rounded-b-none;
31-
}
32-
}
33-
34-
& .search-results {
35-
@apply .absolute .bg-white .border .border-primary-700 .border-t-0 .rounded .rounded-t-none .p-2 .ml-8 .z-50 .w-96;
36-
37-
& a {
38-
@apply .block .no-underline .p-2 .rounded;
39-
40-
&:not(.no-hover):hover {
41-
@apply .bg-neutral-50;
42-
}
43-
}
44-
}
4+
& > div {
5+
@apply .mx-auto .w-full .flex .items-center;
456
}
467

47-
& .menu {
48-
@apply .flex .h-full .items-center;
8+
& #logo {
9+
@apply .flex-1;
4910

5011
& > a {
51-
transition: background-color 150ms linear;
52-
@apply .block .flex .self-stretch .items-center .no-underline .text-white .font-light .text-sm .px-5;
12+
@apply .text-2xl .font-header .px-4 .no-underline .text-neutral-200;
13+
transition: color 150ms linear;
5314

5415
&:hover {
55-
@apply .bg-primary-700;
16+
@apply .text-neutral-100;
5617
}
5718
}
5819
}
59-
}
60-
61-
.sidenav {
62-
ul {
63-
@apply .list-reset;
6420

65-
& li {
66-
@apply .block;
21+
& .right-navigation {
22+
@apply .flex .h-full .items-center .justify-center;
6723

68-
& > a {
69-
transition: border-left-color 250ms linear, color 250ms linear;
70-
@apply .block .px-4 .py-3 .border-l-3 .border-neutral-100 .no-underline .text-neutral-400 .font-medium;
71-
72-
&:hover, &.router-link-exact-active, &.router-link-active {
73-
@apply .text-neutral-800;
74-
}
75-
76-
&.router-link-exact-active, &.router-link-active {
77-
@apply .border-primary-500 .cursor-default;
78-
}
24+
& > a {
25+
@apply .flex .items-center .h-full .no-underline .text-neutral-300 .px-6;
26+
transition: background-color 150ms linear, color 150ms linear, box-shadow 150ms ease-in;
7927

80-
&::-moz-focus-inner {
81-
@apply .border-none;
82-
}
28+
&.active, &:hover {
29+
@apply .text-neutral-100 .bg-black;
30+
box-shadow: inset 0 -2px config('colors.cyan-700');
8331
}
8432

85-
/**
86-
* Because of how the router works the first sidebar link is always active
87-
* since that is the container for all of the server things. Override the
88-
* style for active links if its the first one and not an exact route match.
89-
*/
90-
&:first-of-type > a {
91-
&.router-link-active:not(.router-link-exact-active) {
92-
@apply .border-neutral-100 .text-neutral-400 .cursor-pointer;
93-
}
33+
&.active {
34+
box-shadow: inset 0 -2px config('colors.cyan-500');
9435
}
9536
}
9637
}
9738
}
98-
/*
99-
.sidenav {
100-
@apply .py-2;
101-
102-
a {
103-
@apply .block .py-3 .px-6 .text-neutral-900 .no-underline .border .border-transparent;
104-
105-
&:hover, &.router-link-exact-active {
106-
@apply .border-neutral-400 .bg-neutral-50;
107-
108-
border-left: 1px solid transparent;
109-
border-right: 1px solid transparent;
110-
}
111-
112-
&.router-link-exact-active + a:hover {
113-
border-top: 1px solid transparent;
114-
}
115-
}
116-
}
117-
*/

resources/scripts/components/App.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import * as React from 'react';
22
import { hot } from 'react-hot-loader/root';
33
import { BrowserRouter as Router, Route } from 'react-router-dom';
44
import AuthenticationRouter from '@/routers/AuthenticationRouter';
5-
import AccountRouter from '@/routers/AccountRouter';
65
import ServerOverviewContainer from '@/components/ServerOverviewContainer';
76
import { StoreProvider } from 'easy-peasy';
87
import { store } from '@/state';
98
import TransitionRouter from '@/TransitionRouter';
9+
import DashboardRouter from '@/routers/DashboardRouter';
1010

1111
interface WindowWithUser extends Window {
1212
PterodactylUser?: {
@@ -41,9 +41,8 @@ const App = () => {
4141
<Router basename={'/'}>
4242
<div className={'mx-auto w-auto'}>
4343
<TransitionRouter basename={'/'}>
44-
<Route exact path="/" component={ServerOverviewContainer}/>
44+
<Route path="/" component={DashboardRouter}/>
4545
<Route path="/auth" component={AuthenticationRouter}/>
46-
<Route path="/account" component={AccountRouter}/>
4746
</TransitionRouter>
4847
</div>
4948
</Router>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as React from 'react';
2+
import { Link, NavLink } from 'react-router-dom';
3+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
4+
import { faLayerGroup } from '@fortawesome/free-solid-svg-icons/faLayerGroup';
5+
import { faUserCircle } from '@fortawesome/free-solid-svg-icons/faUserCircle';
6+
import { faSignOutAlt } from '@fortawesome/free-solid-svg-icons/faSignOutAlt';
7+
import { faSwatchbook } from '@fortawesome/free-solid-svg-icons/faSwatchbook';
8+
9+
export default () => (
10+
<div id={'navigation'}>
11+
<div className={'mx-auto w-full flex items-center'} style={{ maxWidth: '1200px', height: '3.5rem' }}>
12+
<div id={'logo'}>
13+
<Link to={'/'}>
14+
Pterodactyl
15+
</Link>
16+
</div>
17+
<div className={'right-navigation'}>
18+
<NavLink to={'/'} exact={true}>
19+
<FontAwesomeIcon icon={faLayerGroup}/>
20+
</NavLink>
21+
<NavLink to={'/account'}>
22+
<FontAwesomeIcon icon={faUserCircle}/>
23+
</NavLink>
24+
{process.env.NODE_ENV !== 'production' &&
25+
<NavLink to={'/design'}>
26+
<FontAwesomeIcon icon={faSwatchbook}/>
27+
</NavLink>
28+
}
29+
<NavLink to={'/auth/logout'}>
30+
<FontAwesomeIcon icon={faSignOutAlt}/>
31+
</NavLink>
32+
</div>
33+
</div>
34+
</div>
35+
);

resources/scripts/components/account/AccountOverviewContainer.tsx renamed to resources/scripts/components/dashboard/AccountOverviewContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import ContentBox from '@/components/elements/ContentBox';
3-
import UpdatePasswordForm from '@/components/account/forms/UpdatePasswordForm';
4-
import UpdateEmailAddressForm from '@/components/account/forms/UpdateEmailAddressForm';
3+
import UpdatePasswordForm from '@/components/dashboard/forms/UpdatePasswordForm';
4+
import UpdateEmailAddressForm from '@/components/dashboard/forms/UpdateEmailAddressForm';
55

66
export default () => {
77
return (
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
3+
export default () => (
4+
<div>
5+
<p>Dashboard</p>
6+
</div>
7+
);

resources/scripts/components/account/DesignElementsContainer.tsx renamed to resources/scripts/components/dashboard/DesignElementsContainer.tsx

File renamed without changes.

resources/scripts/components/account/forms/UpdateEmailAddressForm.tsx renamed to resources/scripts/components/dashboard/forms/UpdateEmailAddressForm.tsx

File renamed without changes.

resources/scripts/components/account/forms/UpdatePasswordForm.tsx renamed to resources/scripts/components/dashboard/forms/UpdatePasswordForm.tsx

File renamed without changes.

resources/scripts/routers/AccountRouter.tsx

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)