Remove Switch component

This commit is contained in:
Marliana Lara 2020-02-11 13:55:35 -05:00
parent ef3ab29649
commit 446021cf22
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE
8 changed files with 8 additions and 20 deletions

View File

@ -164,7 +164,7 @@ class NotificationList extends Component {
}
this.setState(stateUpdateFunction);
} catch (err) {
this.setState({ toggleError: true });
this.setState({ toggleError: err });
} finally {
this.setState({ toggleLoading: false });
}

View File

@ -8,8 +8,8 @@ import {
DataListItemRow,
DataListItemCells,
DataListCell as PFDataListCell,
Switch,
} from '@patternfly/react-core';
import Switch from '@components/Switch';
import styled from 'styled-components';

View File

@ -1,10 +0,0 @@
import { Switch } from '@patternfly/react-core';
import styled from 'styled-components';
Switch.displayName = 'PFSwitch';
export default styled(Switch)`
display: flex;
flex-wrap: no-wrap;
/* workaround PF bug; used in calculating switch width: */
--pf-c-switch__toggle-icon--Offset: 0.125rem;
`;

View File

@ -1 +0,0 @@
export { default } from './Switch';

View File

@ -3,7 +3,7 @@ import { Link, useHistory, useParams, useLocation } from 'react-router-dom';
import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro';
import { Host } from '@types';
import { Button } from '@patternfly/react-core';
import { Button, Switch } from '@patternfly/react-core';
import { CardBody, CardActionsRow } from '@components/Card';
import AlertModal from '@components/AlertModal';
import ErrorDetail from '@components/ErrorDetail';
@ -11,7 +11,6 @@ import { DetailList, Detail, UserDateDetail } from '@components/DetailList';
import { VariablesDetail } from '@components/CodeMirrorInput';
import { Sparkline } from '@components/Sparkline';
import DeleteButton from '@components/DeleteButton';
import Switch from '@components/Switch';
import { HostsAPI } from '@api';
function HostDetail({ host, i18n, onUpdateHost }) {

View File

@ -34,7 +34,7 @@ class HostsList extends Component {
selected: [],
itemCount: 0,
actions: null,
toggleError: false,
toggleError: null,
toggleLoading: null,
};
@ -83,7 +83,7 @@ class HostsList extends Component {
}
handleHostToggleErrorClose() {
this.setState({ toggleError: false });
this.setState({ toggleError: null });
}
async handleHostDelete() {
@ -112,7 +112,7 @@ class HostsList extends Component {
),
});
} catch (err) {
this.setState({ toggleError: true });
this.setState({ toggleError: err });
} finally {
this.setState({ toggleLoading: null });
}

View File

@ -6,6 +6,7 @@ import {
DataListItem,
DataListItemRow,
DataListItemCells,
Switch,
Tooltip,
} from '@patternfly/react-core';
import { Link } from 'react-router-dom';
@ -16,7 +17,6 @@ import DataListCell from '@components/DataListCell';
import DataListCheck from '@components/DataListCheck';
import ListActionButton from '@components/ListActionButton';
import { Sparkline } from '@components/Sparkline';
import Switch from '@components/Switch';
import VerticalSeparator from '@components/VerticalSeparator';
import { Host } from '@types';

View File

@ -6,6 +6,7 @@ import {
DataListItem,
DataListItemRow,
DataListItemCells,
Switch,
Tooltip,
} from '@patternfly/react-core';
import { Link } from 'react-router-dom';
@ -16,7 +17,6 @@ import DataListCell from '@components/DataListCell';
import DataListCheck from '@components/DataListCheck';
import ListActionButton from '@components/ListActionButton';
import { Sparkline } from '@components/Sparkline';
import Switch from '@components/Switch';
import VerticalSeparator from '@components/VerticalSeparator';
import { Host } from '@types';