Skip to content

Commit 55b1402

Browse files
committed
fix: verdaccio/jsx-no-style
1 parent 4746f40 commit 55b1402

File tree

5 files changed

+58
-32
lines changed

5 files changed

+58
-32
lines changed

src/components/AutoComplete/AutoComplete.tsx

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { KeyboardEvent } from 'react';
2+
import { css } from 'emotion';
23
import Autosuggest from 'react-autosuggest';
34
import match from 'autosuggest-highlight/match';
45
import parse from 'autosuggest-highlight/parse';
@@ -53,12 +54,14 @@ const renderSuggestion = (suggestion, { query, isHighlighted }): JSX.Element =>
5354
<MenuItem component="div" selected={isHighlighted}>
5455
<div>
5556
{parts.map((part, index) => {
56-
return part.highlight ? (
57-
<a href={suggestion.link} key={String(index)} style={{ fontWeight: fontWeight.semiBold }}>
58-
{part.text}
59-
</a>
60-
) : (
61-
<a href={suggestion.link} key={String(index)} style={{ fontWeight: fontWeight.light }}>
57+
const fw = part.highlight ? fontWeight.semiBold : fontWeight.light;
58+
return (
59+
<a
60+
className={css`
61+
font-weight: ${fw};
62+
`}
63+
href={suggestion.link}
64+
key={String(index)}>
6265
{part.text}
6366
</a>
6467
);

src/components/Header/Header.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { SyntheticEvent, Component, Fragment, ReactElement } from 'react';
22
import { Link } from 'react-router-dom';
3+
import { css } from 'emotion';
34

45
import Button from '@material-ui/core/Button';
56
import IconButton from '@material-ui/core/IconButton';
@@ -141,7 +142,11 @@ class Header extends Component<Props, State> {
141142
const { withoutSearch = false } = this.props;
142143
return (
143144
<LeftSide>
144-
<Link style={{ marginRight: '1em' }} to={'/'}>
145+
<Link
146+
className={css`
147+
margin-right: '1em';
148+
`}
149+
to={'/'}>
145150
{this.renderLogo()}
146151
</Link>
147152
{!withoutSearch && (

src/components/Login/Login.tsx

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import InputLabel from '@material-ui/core/InputLabel';
1010
import Input from '@material-ui/core/Input';
1111
import FormControl from '@material-ui/core/FormControl';
1212
import FormHelperText from '@material-ui/core/FormHelperText';
13+
import { css } from 'emotion';
1314

1415
// @ts-ignore
1516
import classes from './login.scss';
@@ -192,7 +193,13 @@ export default class LoginModal extends Component<Partial<LoginModalProps>, Logi
192193
form: { password },
193194
} = this.state;
194195
return (
195-
<FormControl error={!password.value && !password.pristine} fullWidth={true} required={password.required} style={{ marginTop: '8px' }}>
196+
<FormControl
197+
className={css`
198+
margin-top: '8px';
199+
`}
200+
error={!password.value && !password.pristine}
201+
fullWidth={true}
202+
required={password.required}>
196203
<InputLabel htmlFor={'password'}>{'Password'}</InputLabel>
197204
<Input id={'login--form-password'} onChange={this.handlePasswordChange} placeholder={'Your strong password'} type={'password'} value={password.value} />
198205
{!password.value && !password.pristine && <FormHelperText id={'password-error'}>{password.helperText}</FormHelperText>}

src/components/RegistryInfoContent/RegistryInfoContent.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { Component } from 'react';
2+
import { css } from 'emotion';
23

34
import { Props, State } from './types';
45
import { CommandContainer } from './styles';
@@ -14,7 +15,12 @@ import { NODE_MANAGER } from '../../utils/constants';
1415
function TabContainer({ children }): JSX.Element {
1516
return (
1617
<CommandContainer>
17-
<Typography component="div" style={{ padding: 0, minHeight: 170 }}>
18+
<Typography
19+
className={css`
20+
padding: 0;
21+
min-height: 170;
22+
`}
23+
component="div">
1824
{children}
1925
</Typography>
2026
</CommandContainer>

src/components/Search/Search.tsx

+28-23
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { KeyboardEvent, Component, ReactElement } from 'react';
22
import { withRouter, RouteComponentProps } from 'react-router-dom';
3+
import { css } from 'emotion';
34

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

54+
public render(): ReactElement<HTMLElement> {
55+
const { suggestions, search, loaded, loading, error } = this.state;
56+
57+
return (
58+
<AutoComplete
59+
color={colors.white}
60+
onBlur={this.handleOnBlur}
61+
onChange={this.handleSearch}
62+
onCleanSuggestions={this.handlePackagesClearRequested}
63+
onClick={this.handleClickSearch}
64+
onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
65+
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
66+
startAdornment={this.getAdorment()}
67+
suggestions={suggestions}
68+
suggestionsError={error}
69+
suggestionsLoaded={loaded}
70+
suggestionsLoading={loading}
71+
value={search}
72+
/>
73+
);
74+
}
75+
5376
/**
5477
* Cancel all the requests which are in pending state.
5578
*/
@@ -146,33 +169,15 @@ export class Search extends Component<RouteComponentProps<{}>, State> {
146169
}
147170
};
148171

149-
public render(): ReactElement<HTMLElement> {
150-
const { suggestions, search, loaded, loading, error } = this.state;
151-
152-
return (
153-
<AutoComplete
154-
color={colors.white}
155-
onBlur={this.handleOnBlur}
156-
onChange={this.handleSearch}
157-
onCleanSuggestions={this.handlePackagesClearRequested}
158-
onClick={this.handleClickSearch}
159-
onSuggestionsFetch={debounce(this.handleFetchPackages, CONSTANTS.API_DELAY)}
160-
placeholder={CONSTANTS.PLACEHOLDER_TEXT}
161-
startAdornment={this.getAdorment()}
162-
suggestions={suggestions}
163-
suggestionsError={error}
164-
suggestionsLoaded={loaded}
165-
suggestionsLoading={loading}
166-
value={search}
167-
/>
168-
);
169-
}
170-
171172
private requestList: AbortControllerInterface[];
172173

173174
public getAdorment(): JSX.Element {
174175
return (
175-
<InputAdornment position={'start'} style={{ color: colors.white }}>
176+
<InputAdornment
177+
className={css`
178+
color: ${colors.white};
179+
`}
180+
position={'start'}>
176181
<IconSearch />
177182
</InputAdornment>
178183
);

0 commit comments

Comments
 (0)