Skip to content

Commit 109bed4

Browse files
committed
Add basic navigation bar to server view
1 parent 8ac8a37 commit 109bed4

File tree

6 files changed

+49
-11
lines changed

6 files changed

+49
-11
lines changed

resources/assets/styles/components/navigation.css

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,29 @@
3636
}
3737
}
3838
}
39+
40+
#sub-navigation {
41+
@apply .w-full .bg-neutral-700 .shadow;
42+
43+
.items {
44+
@apply .flex .items-center .text-sm .mx-2;
45+
46+
& > a, & > div {
47+
@apply .inline-block .py-3 .px-4 .text-neutral-300 .no-underline;
48+
transition: color 150ms linear, box-shadow 150ms ease-in;
49+
50+
&:not(:first-of-type) {
51+
@apply .ml-2;
52+
}
53+
54+
&.active, &:hover {
55+
@apply .text-neutral-100;
56+
box-shadow: inset 0 -2px config('colors.cyan-700');
57+
}
58+
59+
&.active {
60+
box-shadow: inset 0 -2px config('colors.cyan-500');
61+
}
62+
}
63+
}
64+
}

resources/scripts/TransitionRouter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { Route, Switch } from 'react-router';
2+
import { Route } from 'react-router';
33
import { CSSTransition, TransitionGroup } from 'react-transition-group';
44

55
type Props = Readonly<{

resources/scripts/components/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ const App = () => {
4141
<div className={'mx-auto w-auto'}>
4242
<BrowserRouter basename={'/'}>
4343
<Switch>
44-
<Route path="/" component={DashboardRouter}/>
44+
<Route path="/server/:id" component={ServerRouter}/>
4545
<Route path="/auth" component={AuthenticationRouter}/>
46-
<Route path="/server/:id/" component={ServerRouter}/>
46+
<Route path="/" component={DashboardRouter}/>
4747
</Switch>
4848
</BrowserRouter>
4949
</div>
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import React from 'react';
22

33
export default () => (
4-
null
4+
<div className={'my-10'}>
5+
Test
6+
</div>
57
);

resources/scripts/routers/DashboardRouter.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import DashboardContainer from '@/components/dashboard/DashboardContainer';
77
import TransitionRouter from '@/TransitionRouter';
88

99
export default ({ location }: RouteComponentProps) => (
10-
<div>
10+
<React.Fragment>
1111
<NavigationBar/>
1212
<TransitionRouter>
1313
<div className={'w-full mx-auto'} style={{ maxWidth: '1200px' }}>
@@ -18,5 +18,5 @@ export default ({ location }: RouteComponentProps) => (
1818
</Switch>
1919
</div>
2020
</TransitionRouter>
21-
</div>
21+
</React.Fragment>
2222
);
Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
import * as React from 'react';
2-
import { Route, RouteComponentProps, Switch } from 'react-router-dom';
2+
import { NavLink, Route, RouteComponentProps, Switch } from 'react-router-dom';
33
import NavigationBar from '@/components/NavigationBar';
44
import ServerConsole from '@/components/server/ServerConsole';
55
import TransitionRouter from '@/TransitionRouter';
66

7-
export default ({ location }: RouteComponentProps) => (
8-
<div>
7+
export default ({ match, location }: RouteComponentProps) => (
8+
<React.Fragment>
99
<NavigationBar/>
10+
<div id={'sub-navigation'}>
11+
<div className={'mx-auto'} style={{ maxWidth: '1200px' }}>
12+
<div className={'items'}>
13+
<NavLink to={`${match.url}`} exact>Console</NavLink>
14+
<NavLink to={`${match.url}/files`}>File Manager</NavLink>
15+
<NavLink to={`${match.url}/databases`}>Databases</NavLink>
16+
<NavLink to={`${match.url}/users`}>User Management</NavLink>
17+
</div>
18+
</div>
19+
</div>
1020
<TransitionRouter>
1121
<div className={'w-full mx-auto'} style={{ maxWidth: '1200px' }}>
1222
<Switch location={location}>
13-
<Route path={`/`} component={ServerConsole} exact/>
23+
<Route path={`${match.path}`} component={ServerConsole} exact/>
1424
</Switch>
1525
</div>
1626
</TransitionRouter>
17-
</div>
27+
</React.Fragment>
1828
);

0 commit comments

Comments
 (0)