Skip to content
This repository has been archived by the owner on Jan 16, 2022. It is now read-only.

Commit

Permalink
fix: verdaccio/jsx-no-style
Browse files Browse the repository at this point in the history
  • Loading branch information
griffithtp committed Jun 30, 2019
1 parent 4746f40 commit 55b1402
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 32 deletions.
15 changes: 9 additions & 6 deletions src/components/AutoComplete/AutoComplete.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { KeyboardEvent } from 'react';
import { css } from 'emotion';
import Autosuggest from 'react-autosuggest';
import match from 'autosuggest-highlight/match';
import parse from 'autosuggest-highlight/parse';
Expand Down Expand Up @@ -53,12 +54,14 @@ const renderSuggestion = (suggestion, { query, isHighlighted }): JSX.Element =>
<MenuItem component="div" selected={isHighlighted}>
<div>
{parts.map((part, index) => {
return part.highlight ? (
<a href={suggestion.link} key={String(index)} style={{ fontWeight: fontWeight.semiBold }}>
{part.text}
</a>
) : (
<a href={suggestion.link} key={String(index)} style={{ fontWeight: fontWeight.light }}>
const fw = part.highlight ? fontWeight.semiBold : fontWeight.light;
return (
<a
className={css`
font-weight: ${fw};
`}
href={suggestion.link}
key={String(index)}>
{part.text}
</a>
);
Expand Down
7 changes: 6 additions & 1 deletion src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { SyntheticEvent, Component, Fragment, ReactElement } from 'react';
import { Link } from 'react-router-dom';
import { css } from 'emotion';

import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
Expand Down Expand Up @@ -141,7 +142,11 @@ class Header extends Component<Props, State> {
const { withoutSearch = false } = this.props;
return (
<LeftSide>
<Link style={{ marginRight: '1em' }} to={'/'}>
<Link
className={css`
margin-right: '1em';
`}
to={'/'}>
{this.renderLogo()}
</Link>
{!withoutSearch && (
Expand Down
9 changes: 8 additions & 1 deletion src/components/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import InputLabel from '@material-ui/core/InputLabel';
import Input from '@material-ui/core/Input';
import FormControl from '@material-ui/core/FormControl';
import FormHelperText from '@material-ui/core/FormHelperText';
import { css } from 'emotion';

// @ts-ignore
import classes from './login.scss';
Expand Down Expand Up @@ -192,7 +193,13 @@ export default class LoginModal extends Component<Partial<LoginModalProps>, Logi
form: { password },
} = this.state;
return (
<FormControl error={!password.value && !password.pristine} fullWidth={true} required={password.required} style={{ marginTop: '8px' }}>
<FormControl
className={css`
margin-top: '8px';
`}
error={!password.value && !password.pristine}
fullWidth={true}
required={password.required}>
<InputLabel htmlFor={'password'}>{'Password'}</InputLabel>
<Input id={'login--form-password'} onChange={this.handlePasswordChange} placeholder={'Your strong password'} type={'password'} value={password.value} />
{!password.value && !password.pristine && <FormHelperText id={'password-error'}>{password.helperText}</FormHelperText>}
Expand Down
8 changes: 7 additions & 1 deletion src/components/RegistryInfoContent/RegistryInfoContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { Component } from 'react';
import { css } from 'emotion';

import { Props, State } from './types';
import { CommandContainer } from './styles';
Expand All @@ -14,7 +15,12 @@ import { NODE_MANAGER } from '../../utils/constants';
function TabContainer({ children }): JSX.Element {
return (
<CommandContainer>
<Typography component="div" style={{ padding: 0, minHeight: 170 }}>
<Typography
className={css`
padding: 0;
min-height: 170;
`}
component="div">
{children}
</Typography>
</CommandContainer>
Expand Down
51 changes: 28 additions & 23 deletions src/components/Search/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { KeyboardEvent, Component, ReactElement } from 'react';
import { withRouter, RouteComponentProps } from 'react-router-dom';
import { css } from 'emotion';

import { default as IconSearch } from '@material-ui/icons/Search';
import InputAdornment from '@material-ui/core/InputAdornment';
Expand Down Expand Up @@ -50,6 +51,28 @@ export class Search extends Component<RouteComponentProps<{}>, State> {
this.requestList = [];
}

public render(): ReactElement<HTMLElement> {
const { suggestions, search, loaded, loading, error } = this.state;

return (
<AutoComplete
color={colors.white}
onBlur={this.handleOnBlur}
onChange={this.handleSearch}
onCleanSuggestions={this.handlePackagesClearRequested}
onClick={this.handleClickSearch}
onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
startAdornment={this.getAdorment()}
suggestions={suggestions}
suggestionsError={error}
suggestionsLoaded={loaded}
suggestionsLoading={loading}
value={search}
/>
);
}

/**
* Cancel all the requests which are in pending state.
*/
Expand Down Expand Up @@ -146,33 +169,15 @@ export class Search extends Component<RouteComponentProps<{}>, State> {
}
};

public render(): ReactElement<HTMLElement> {
const { suggestions, search, loaded, loading, error } = this.state;

return (
<AutoComplete
color={colors.white}
onBlur={this.handleOnBlur}
onChange={this.handleSearch}
onCleanSuggestions={this.handlePackagesClearRequested}
onClick={this.handleClickSearch}
onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
startAdornment={this.getAdorment()}
suggestions={suggestions}
suggestionsError={error}
suggestionsLoaded={loaded}
suggestionsLoading={loading}
value={search}
/>
);
}

private requestList: AbortControllerInterface[];

public getAdorment(): JSX.Element {
return (
<InputAdornment position={'start'} style={{ color: colors.white }}>
<InputAdornment
className={css`
color: ${colors.white};
`}
position={'start'}>
<IconSearch />
</InputAdornment>
);
Expand Down

0 comments on commit 55b1402

Please sign in to comment.