mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-03 14:57:22 +03:00
Implemented left menu
This commit is contained in:
parent
5a7ac69aff
commit
3ea33d0e38
5 changed files with 74 additions and 7 deletions
|
@ -1,8 +1,31 @@
|
|||
import React from 'react';
|
||||
import { NavLink } from 'react-router-dom';
|
||||
import './AsideMenu.scss';
|
||||
|
||||
export default function AsideMenu() {
|
||||
export default function AsideMenu({ selectedServer }) {
|
||||
const serverId = selectedServer ? selectedServer.id : '';
|
||||
|
||||
return (
|
||||
<aside className="aside-menu col-md-2 col-sm-2">Aside menu</aside>
|
||||
<aside className="aside-menu col-md-2 col-sm-2">
|
||||
<nav className="nav flex-column aside-menu__nav">
|
||||
<NavLink
|
||||
className="aside-menu__item"
|
||||
activeClassName="aside-menu__item--selected"
|
||||
to={`/server/${serverId}/list-short-urls/1`}
|
||||
isActive={match => match && match.params.serverId === serverId}
|
||||
>
|
||||
List short URLs
|
||||
</NavLink>
|
||||
<NavLink
|
||||
className="aside-menu__item"
|
||||
activeClassName="aside-menu__item--selected"
|
||||
to={`/server/${serverId}/create-short-url`}
|
||||
>
|
||||
Create short code
|
||||
</NavLink>
|
||||
<span className="aside-menu__item--divider" />
|
||||
<span className="aside-menu__item aside-menu__item--danger">Delete this server</span>
|
||||
</nav>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -13,3 +13,39 @@
|
|||
background-color: #f7f7f7;
|
||||
border-right: 1px solid #eee;
|
||||
}
|
||||
|
||||
.aside-menu__nav {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.aside-menu__item {
|
||||
padding: 10px 20px;
|
||||
margin: 0 -15px;
|
||||
text-decoration: none !important;
|
||||
cursor: pointer;
|
||||
}
|
||||
.aside-menu__item:hover {
|
||||
background-color: $lightHoverColor;
|
||||
}
|
||||
|
||||
.aside-menu__item--selected {
|
||||
color: #fff;
|
||||
background-color: $mainColor;
|
||||
}
|
||||
.aside-menu__item--selected:hover {
|
||||
color: #fff;
|
||||
background-color: $mainColor;
|
||||
}
|
||||
|
||||
.aside-menu__item--divider {
|
||||
border-bottom: 1px solid #eee;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.aside-menu__item--danger {
|
||||
color: $dangerColor;
|
||||
}
|
||||
.aside-menu__item--danger:hover {
|
||||
color: #fff;
|
||||
background-color: $dangerColor;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import React from 'react';
|
||||
import { Route, Switch } from 'react-router-dom';
|
||||
import { connect } from 'react-redux';
|
||||
import ShortUrls from '../short-urls/ShortUrls';
|
||||
import AsideMenu from './AsideMenu';
|
||||
|
||||
export default function MenuLayout() {
|
||||
export function MenuLayout(props) {
|
||||
return (
|
||||
<div className="row">
|
||||
<AsideMenu />
|
||||
<AsideMenu {...props} />
|
||||
<div className="col-md-10 offset-md-2 col-sm-9 offset-sm-3">
|
||||
<Switch>
|
||||
<Route
|
||||
|
@ -19,3 +20,8 @@ export default function MenuLayout() {
|
|||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(state => ({
|
||||
selectedServer: state.selectedServer,
|
||||
shortUrlsListParams: state.shortUrlsListParams,
|
||||
}))(MenuLayout);
|
||||
|
|
|
@ -15,10 +15,10 @@ import './ShortUrlsList.scss';
|
|||
|
||||
export class ShortUrlsList extends React.Component {
|
||||
componentDidMount() {
|
||||
const { match } = this.props;
|
||||
this.props.listShortUrls(match.params.serverId, {
|
||||
const { match: { params } } = this.props;
|
||||
this.props.listShortUrls(params.serverId, {
|
||||
...this.props.shortUrlsListParams,
|
||||
page: match.params.page
|
||||
page: params.page
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ $xlgMin: 1200px;
|
|||
|
||||
// Colors
|
||||
$mainColor: #4696e5;
|
||||
$lightHoverColor: #eee;
|
||||
$dangerColor: #dc3545;
|
||||
|
||||
// Misc
|
||||
$headerHeight: 57px;
|
||||
|
|
Loading…
Reference in a new issue