From f707d3d524d8d16e2bb780764f029d85fc57ecc0 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 26 Jul 2019 13:22:00 +0300 Subject: prop-types -> jsdoc --- vnext/src/ui/Login.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'vnext/src/ui/Login.js') diff --git a/vnext/src/ui/Login.js b/vnext/src/ui/Login.js index 649fadd4..883a4eab 100644 --- a/vnext/src/ui/Login.js +++ b/vnext/src/ui/Login.js @@ -1,10 +1,7 @@ -import React, { useState, useEffect } from 'react'; -import PropTypes from 'prop-types'; +import React, { useEffect } from 'react'; -import ReactRouterPropTypes from 'react-router-prop-types'; import { withRouter } from 'react-router-dom'; -import { UserType } from './Types'; import Icon from './Icon'; import Button from './Button'; import Input from './Input'; @@ -14,6 +11,18 @@ import { me, facebookLink, vkLink } from '../api'; import './Login.css'; +/** + * @typedef {Object} LoginProps + * @property {import('../api').SecureUser} visitor + * @property {import('history').History} history + * @property {import('history').Location} location + * @property {any} onAuth + */ + +/** + * Login page + * @param {LoginProps} props + */ function Login({ visitor, history, location, onAuth }) { useEffect(() => { @@ -26,6 +35,9 @@ function Login({ visitor, history, location, onAuth }) { const [formState, { text, password }] = useFormState(); + /** + * @param {React.SyntheticEvent} event + */ let onSubmit = (event) => { event.preventDefault(); me(formState.values.username, formState.values.password) @@ -66,13 +78,6 @@ function Login({ visitor, history, location, onAuth }) { export default withRouter(Login); -Login.propTypes = { - visitor: UserType, - history: ReactRouterPropTypes.history.isRequired, - location: ReactRouterPropTypes.location, - onAuth: PropTypes.func -}; - const socialButtonsStyle = { display: 'flex', justifyContent: 'space-evenly', -- cgit v1.2.3