From c638c1566ecd026c5db30810e7409d73d5182433 Mon Sep 17 00:00:00 2001 From: SleepWalker Date: Sat, 7 Dec 2019 21:43:08 +0200 Subject: [PATCH] Replace classnames with clsx --- .../app/components/accounts/AccountSwitcher.tsx | 15 ++++++--------- packages/app/components/contact/ContactForm.tsx | 4 ++-- .../app/components/dev/apps/ApplicationsIndex.tsx | 4 ++-- .../components/dev/apps/list/ApplicationItem.tsx | 4 ++-- .../components/languageSwitcher/LanguageList.tsx | 6 +++--- .../languageSwitcher/LanguageSwitcher.tsx | 6 +++--- .../changeLanguageLink/ChangeLanguageLink.tsx | 4 ++-- .../multiFactorAuth/instructions/Instructions.tsx | 6 +++--- .../multiFactorAuth/instructions/OsTile.tsx | 4 ++-- .../profile/multiFactorAuth/keyForm/KeyForm.tsx | 9 ++------- .../passwordRequestForm/PasswordRequestForm.js | 4 ++-- packages/app/components/ui/Panel.tsx | 4 ++-- packages/app/components/ui/form/Button.tsx | 4 ++-- packages/app/components/ui/form/Captcha.tsx | 4 ++-- packages/app/components/ui/form/Checkbox.tsx | 4 ++-- packages/app/components/ui/form/Dropdown.js | 4 ++-- packages/app/components/ui/form/Form.tsx | 4 ++-- packages/app/components/ui/form/Input.tsx | 10 ++++------ packages/app/components/ui/form/Radio.tsx | 4 ++-- packages/app/components/ui/form/TextArea.tsx | 4 ++-- .../app/components/ui/loader/ComponentLoader.tsx | 9 +++------ packages/app/components/ui/loader/ImageLoader.tsx | 4 ++-- packages/app/components/ui/popup/PopupStack.tsx | 2 +- packages/app/components/ui/stepper/Stepper.tsx | 6 +++--- packages/app/components/userbar/LoggedInPanel.tsx | 11 ++++------- packages/app/package.json | 2 +- packages/app/pages/root/RootPage.tsx | 4 ++-- packages/app/pages/rules/RulesPage.tsx | 6 +++--- yarn.lock | 10 +++++----- 29 files changed, 73 insertions(+), 89 deletions(-) diff --git a/packages/app/components/accounts/AccountSwitcher.tsx b/packages/app/components/accounts/AccountSwitcher.tsx index 0fb3945..dffd6cd 100644 --- a/packages/app/components/accounts/AccountSwitcher.tsx +++ b/packages/app/components/accounts/AccountSwitcher.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { Link } from 'react-router-dom'; import { FormattedMessage as Message } from 'react-intl'; import loader from 'app/services/loader'; @@ -62,7 +62,7 @@ export class AccountSwitcher extends React.Component { return (
{ {highlightActiveAccount ? (
{ {activeAccount.username}
{activeAccount.email}
@@ -112,12 +109,12 @@ export class AccountSwitcher extends React.Component { ) : null} {available.map((account, index) => (
diff --git a/packages/app/components/dev/apps/ApplicationsIndex.tsx b/packages/app/components/dev/apps/ApplicationsIndex.tsx index 355200b..3b3ebbf 100644 --- a/packages/app/components/dev/apps/ApplicationsIndex.tsx +++ b/packages/app/components/dev/apps/ApplicationsIndex.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { FormattedMessage as Message } from 'react-intl'; import { Helmet } from 'react-helmet'; import { LinkButton } from 'app/components/ui/form'; @@ -109,7 +109,7 @@ function Loader({ noApps }: { noApps: boolean }) { />
diff --git a/packages/app/components/dev/apps/list/ApplicationItem.tsx b/packages/app/components/dev/apps/list/ApplicationItem.tsx index d8de7e6..38f935a 100644 --- a/packages/app/components/dev/apps/list/ApplicationItem.tsx +++ b/packages/app/components/dev/apps/list/ApplicationItem.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FormattedMessage as Message } from 'react-intl'; import { Link } from 'react-router-dom'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { SKIN_LIGHT, COLOR_BLACK, COLOR_RED } from 'app/components/ui'; import { Input, Button } from 'app/components/ui/form'; import { OauthAppResponse } from 'app/services/api/oauth'; @@ -63,7 +63,7 @@ export default class ApplicationItem extends React.Component< return (
(
@@ -77,7 +77,7 @@ class LanguageSwitcher extends React.Component<
{
) => void; }) { return ( -
+
{label}
{label}
diff --git a/packages/app/components/profile/multiFactorAuth/keyForm/KeyForm.tsx b/packages/app/components/profile/multiFactorAuth/keyForm/KeyForm.tsx index a0da4c1..9e29977 100644 --- a/packages/app/components/profile/multiFactorAuth/keyForm/KeyForm.tsx +++ b/packages/app/components/profile/multiFactorAuth/keyForm/KeyForm.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { FormattedMessage as Message } from 'react-intl'; import { ImageLoader } from 'app/components/ui/loader'; import profileForm from 'app/components/profile/profileForm.scss'; @@ -31,12 +31,7 @@ export default function KeyForm({
-

+

diff --git a/packages/app/components/profile/passwordRequestForm/PasswordRequestForm.js b/packages/app/components/profile/passwordRequestForm/PasswordRequestForm.js index d3c97b7..cc7cc1c 100644 --- a/packages/app/components/profile/passwordRequestForm/PasswordRequestForm.js +++ b/packages/app/components/profile/passwordRequestForm/PasswordRequestForm.js @@ -3,7 +3,7 @@ import React, { Component } from 'react'; import { FormattedMessage as Message } from 'react-intl'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { Form, Button, Input, FormModel } from 'app/components/ui/form'; import popupStyles from 'app/components/ui/popup/popup.scss'; @@ -32,7 +32,7 @@ export default class PasswordRequestForm extends Component {

-
+
diff --git a/packages/app/components/ui/Panel.tsx b/packages/app/components/ui/Panel.tsx index 9b371cc..619f5d5 100644 --- a/packages/app/components/ui/Panel.tsx +++ b/packages/app/components/ui/Panel.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { omit } from 'app/functions'; import styles from './panel.scss'; @@ -89,7 +89,7 @@ export class PanelBodyHeader extends React.Component< close = ; } - const className = classNames(styles[`${type}BodyHeader`], { + const className = clsx(styles[`${type}BodyHeader`], { [styles.isClosed]: this.state.isClosed, }); diff --git a/packages/app/components/ui/form/Button.tsx b/packages/app/components/ui/form/Button.tsx index 0ebdcef..ffff214 100644 --- a/packages/app/components/ui/form/Button.tsx +++ b/packages/app/components/ui/form/Button.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import classNames from 'classnames'; +import clsx from 'clsx'; import buttons from 'app/components/ui/buttons.scss'; import { COLOR_GREEN } from 'app/components/ui'; import { MessageDescriptor } from 'react-intl'; @@ -35,7 +35,7 @@ export default class Button extends FormComponent< return ( {this.renderError()} diff --git a/packages/app/components/ui/form/Checkbox.tsx b/packages/app/components/ui/form/Checkbox.tsx index ec29bd8..4930e6c 100644 --- a/packages/app/components/ui/form/Checkbox.tsx +++ b/packages/app/components/ui/form/Checkbox.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { MessageDescriptor } from 'react-intl'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { SKIN_DARK, COLOR_GREEN, Color, Skin } from 'app/components/ui'; import { omit } from 'app/functions'; @@ -29,7 +29,7 @@ export default class Checkbox extends FormInputComponent<{ return (
{ return (
- ); + icon = ; } if (showCopyIcon) { copyIcon = (
{new Array(5).fill(0).map((_, index) => (
))} diff --git a/packages/app/components/ui/loader/ImageLoader.tsx b/packages/app/components/ui/loader/ImageLoader.tsx index a4e2719..d0eee58 100644 --- a/packages/app/components/ui/loader/ImageLoader.tsx +++ b/packages/app/components/ui/loader/ImageLoader.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import classNames from 'classnames'; +import clsx from 'clsx'; import { ComponentLoader } from 'app/components/ui/loader'; import { SKIN_LIGHT } from 'app/components/ui'; @@ -59,7 +59,7 @@ export default class ImageLoader extends React.Component< )}
diff --git a/packages/app/components/ui/popup/PopupStack.tsx b/packages/app/components/ui/popup/PopupStack.tsx index b3a57ec..c63d935 100644 --- a/packages/app/components/ui/popup/PopupStack.tsx +++ b/packages/app/components/ui/popup/PopupStack.tsx @@ -35,7 +35,7 @@ export class PopupStack extends React.Component<{ return ( +
{new Array(totalSteps).fill(0).map((_, step) => (
(this.el = el)} - className={classNames(styles.loggedInPanel)} - > +
(this.el = el)} className={clsx(styles.loggedInPanel)}>
@@ -58,7 +55,7 @@ export default class LoggedInPanel extends React.Component< -
+
diff --git a/packages/app/pages/rules/RulesPage.tsx b/packages/app/pages/rules/RulesPage.tsx index e3b4b3c..60b1844 100644 --- a/packages/app/pages/rules/RulesPage.tsx +++ b/packages/app/pages/rules/RulesPage.tsx @@ -10,7 +10,7 @@ import messages from './RulesPage.intl.json'; const projectName = ; -import classNames from 'classnames'; +import clsx from 'clsx'; const rules = [ { @@ -105,7 +105,7 @@ export default class RulesPage extends Component<{ {rules.map((block, sectionIndex) => (

{block.items.map((item, ruleIndex) => (