mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-16 21:56:25 -05:00
fix: applied jsx-max-depth
This commit is contained in:
parent
3bda0cf566
commit
d940da490e
2 changed files with 116 additions and 85 deletions
|
@ -137,21 +137,9 @@ export default class LoginModal extends Component {
|
|||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { visibility, onCancel, error } = this.props;
|
||||
const { form: { username, password } } = this.state;
|
||||
renderNameField = () => {
|
||||
const { form: { username } } = this.state;
|
||||
return (
|
||||
<Dialog
|
||||
fullWidth={true}
|
||||
id={"login--form-container"}
|
||||
maxWidth={"xs"}
|
||||
onClose={onCancel}
|
||||
open={visibility}
|
||||
>
|
||||
<form noValidate={true} onSubmit={this.validateCredentials}>
|
||||
<DialogTitle>Login</DialogTitle>
|
||||
<DialogContent>
|
||||
{this.renderLoginError(error)}
|
||||
<FormControl
|
||||
error={!username.value && !username.pristine}
|
||||
fullWidth={true}
|
||||
|
@ -170,6 +158,12 @@ export default class LoginModal extends Component {
|
|||
</FormHelperText>
|
||||
)}
|
||||
</FormControl>
|
||||
);
|
||||
}
|
||||
|
||||
renderPasswordField = () => {
|
||||
const { form: { password } } = this.state;
|
||||
return (
|
||||
<FormControl
|
||||
error={!password.value && !password.pristine}
|
||||
fullWidth={true}
|
||||
|
@ -190,6 +184,26 @@ export default class LoginModal extends Component {
|
|||
</FormHelperText>
|
||||
)}
|
||||
</FormControl>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { visibility, onCancel, error } = this.props;
|
||||
const { form: { username, password } } = this.state;
|
||||
return (
|
||||
<Dialog
|
||||
fullWidth={true}
|
||||
id={"login--form-container"}
|
||||
maxWidth={"xs"}
|
||||
onClose={onCancel}
|
||||
open={visibility}
|
||||
>
|
||||
<form noValidate={true} onSubmit={this.validateCredentials}>
|
||||
<DialogTitle>Login</DialogTitle>
|
||||
<DialogContent>
|
||||
{this.renderLoginError(error)}
|
||||
{this.renderNameField()}
|
||||
{this.renderPasswordField()}
|
||||
</DialogContent>
|
||||
<DialogActions className={"dialog-footer"}>
|
||||
<Button
|
||||
|
|
|
@ -37,29 +37,15 @@ const getInitialsName = (name: string) =>
|
|||
.reduce((accumulator, currentValue) => accumulator.charAt(0) + currentValue.charAt(0), '')
|
||||
.toUpperCase();
|
||||
|
||||
const Package = ({ name: label, version, time, author: { name, avatar }, description, license, keywords = [] }: IProps): Element<Wrapper> => (
|
||||
<Wrapper className={'package'} to={`detail/${label}`}>
|
||||
<Header>
|
||||
const Package = ({ name: label, version, time, author: { name, avatar }, description, license, keywords = [] }: IProps): Element<Wrapper> => {
|
||||
const renderMainInfo = () => (
|
||||
<MainInfo>
|
||||
<Name>{label}</Name>
|
||||
<Version>{`v${version}`}</Version>
|
||||
</MainInfo>
|
||||
<Overview>
|
||||
{license && (
|
||||
<OverviewItem>
|
||||
<Icon modifiers={spacing('margin', '4px', '5px', '0px', '0px')} name={'license'} pointer={true} />
|
||||
{license}
|
||||
</OverviewItem>
|
||||
)}
|
||||
<OverviewItem>
|
||||
<Icon name={'time'} pointer={true} />
|
||||
<Published modifiers={spacing('margin', '0px', '5px', '0px', '0px')}>{`Published on ${formatDate(time)} •`}</Published>
|
||||
{`${formatDateDistance(time)} ago`}
|
||||
</OverviewItem>
|
||||
</Overview>
|
||||
</Header>
|
||||
<Content>
|
||||
<Field>
|
||||
);
|
||||
|
||||
const renderAuthorInfo = () => (
|
||||
<Author>
|
||||
<Avatar alt={name} src={avatar}>
|
||||
{!avatar && getInitialsName(name)}
|
||||
|
@ -68,12 +54,43 @@ const Package = ({ name: label, version, time, author: { name, avatar }, descrip
|
|||
<Text text={name} weight={'bold'} />
|
||||
</Details>
|
||||
</Author>
|
||||
</Field>
|
||||
{description && (
|
||||
);
|
||||
|
||||
const renderLicenseInfo = () =>
|
||||
license && (
|
||||
<OverviewItem>
|
||||
<Icon modifiers={spacing('margin', '4px', '5px', '0px', '0px')} name={'license'} pointer={true} />
|
||||
{license}
|
||||
</OverviewItem>
|
||||
);
|
||||
|
||||
const renderPublishedInfo = () => (
|
||||
<OverviewItem>
|
||||
<Icon name={'time'} pointer={true} />
|
||||
<Published modifiers={spacing('margin', '0px', '5px', '0px', '0px')}>{`Published on ${formatDate(time)} •`}</Published>
|
||||
{`${formatDateDistance(time)} ago`}
|
||||
</OverviewItem>
|
||||
);
|
||||
|
||||
const renderDescription = () =>
|
||||
description && (
|
||||
<Field>
|
||||
<Description>{description}</Description>
|
||||
</Field>
|
||||
)}
|
||||
);
|
||||
|
||||
return (
|
||||
<Wrapper className={'package'} to={`detail/${label}`}>
|
||||
<Header>
|
||||
{renderMainInfo()}
|
||||
<Overview>
|
||||
{renderLicenseInfo()}
|
||||
{renderPublishedInfo()}
|
||||
</Overview>
|
||||
</Header>
|
||||
<Content>
|
||||
<Field>{renderAuthorInfo()}</Field>
|
||||
{renderDescription()}
|
||||
</Content>
|
||||
{keywords.length > 0 && (
|
||||
<Footer>
|
||||
|
@ -84,5 +101,5 @@ const Package = ({ name: label, version, time, author: { name, avatar }, descrip
|
|||
)}
|
||||
</Wrapper>
|
||||
);
|
||||
|
||||
};
|
||||
export default Package;
|
||||
|
|
Loading…
Reference in a new issue