mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 17:05:43 +01:00
implemented logout and rename login module to auth
This commit is contained in:
@@ -1,15 +1,22 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import PrimaryNavigationLink from "./PrimaryNavigationLink";
|
||||
import PrimaryNavigationAction from "./PrimaryNavigationAction";
|
||||
|
||||
type Props = {};
|
||||
type Props = {
|
||||
onLogout: () => void
|
||||
};
|
||||
|
||||
class PrimaryNavigation extends React.Component<Props> {
|
||||
render() {
|
||||
return (
|
||||
<nav className="tabs is-boxed">
|
||||
<ul>
|
||||
<PrimaryNavigationLink to="/users">Users</PrimaryNavigationLink>
|
||||
<PrimaryNavigationLink to="/users" label="Users" />
|
||||
<PrimaryNavigationAction
|
||||
onClick={this.props.onLogout}
|
||||
label="Logout"
|
||||
/>
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
|
||||
20
scm-ui/src/components/PrimaryNavigationAction.js
Normal file
20
scm-ui/src/components/PrimaryNavigationAction.js
Normal file
@@ -0,0 +1,20 @@
|
||||
//@flow
|
||||
import * as React from "react";
|
||||
|
||||
type Props = {
|
||||
label: string,
|
||||
onClick: () => void
|
||||
};
|
||||
|
||||
class PrimaryNavigationAction extends React.Component<Props> {
|
||||
render() {
|
||||
const { label, onClick } = this.props;
|
||||
return (
|
||||
<li>
|
||||
<a onClick={onClick}>{label}</a>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default PrimaryNavigationAction;
|
||||
@@ -4,16 +4,16 @@ import { Route, Link } from "react-router-dom";
|
||||
|
||||
type Props = {
|
||||
to: string,
|
||||
activeOnlyWhenExact?: boolean,
|
||||
children?: React.Node
|
||||
label: string,
|
||||
activeOnlyWhenExact?: boolean
|
||||
};
|
||||
|
||||
class PrimaryNavigationLink extends React.Component<Props> {
|
||||
renderLink = (route: any) => {
|
||||
const { to, children } = this.props;
|
||||
const { to, label } = this.props;
|
||||
return (
|
||||
<li className={route.match ? "is-active" : ""}>
|
||||
<Link to={to}>{children}</Link>
|
||||
<Link to={to}>{label}</Link>
|
||||
</li>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user