github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/ui/src/views/app/components/userMenu/index.tsx (about)

     1  // Copyright 2019 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  import React from "react";
    12  import { Link } from "react-router-dom";
    13  import { LOGOUT_PAGE } from "src/routes/login";
    14  
    15  import "./userMenu.styl";
    16  
    17  export interface UserMenuProps {
    18    userName: string;
    19    onLogoutClick: () => void;
    20  }
    21  
    22  export default function UserMenu (props: UserMenuProps) {
    23    const { userName, onLogoutClick } = props;
    24    return (
    25      <div className="user-menu">
    26        <div className="user-menu__item user-menu__username">{userName}</div>
    27        <div className="user-menu__item user-menu__logout-menu-item">
    28          <Link to={LOGOUT_PAGE} onClick={onLogoutClick}>
    29            Logout
    30          </Link>
    31        </div>
    32      </div>
    33    );
    34  }