sforkowany z mirror/soapbox
Add custom Toggle component (wrapper around react-toggle)
rodzic
04463b8aaf
commit
8ad66ec45a
|
@ -0,0 +1,14 @@
|
|||
import React from 'react';
|
||||
import ReactToggle, { ToggleProps } from 'react-toggle';
|
||||
|
||||
/** Wrapper around react-toggle. */
|
||||
const Toggle: React.FC<ToggleProps> = ({ icons = false, ...rest }) => {
|
||||
return (
|
||||
<ReactToggle
|
||||
icons={icons}
|
||||
{...rest}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default Toggle;
|
|
@ -1,11 +1,11 @@
|
|||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||
import Toggle from 'react-toggle';
|
||||
|
||||
import { updateNotificationSettings } from 'soapbox/actions/accounts';
|
||||
import { patchMe } from 'soapbox/actions/me';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import List, { ListItem } from 'soapbox/components/list';
|
||||
import Toggle from 'soapbox/components/toggle';
|
||||
import { useAppSelector, useAppDispatch, useOwnAccount, useFeatures } from 'soapbox/hooks';
|
||||
import { normalizeAccount } from 'soapbox/normalizers';
|
||||
import resizeImage from 'soapbox/utils/resize_image';
|
||||
|
|
|
@ -2,7 +2,8 @@ import PropTypes from 'prop-types';
|
|||
import React from 'react';
|
||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import Toggle from 'react-toggle';
|
||||
|
||||
import Toggle from 'soapbox/components/toggle';
|
||||
|
||||
export default class SettingToggle extends ImmutablePureComponent {
|
||||
|
||||
|
@ -26,7 +27,6 @@ export default class SettingToggle extends ImmutablePureComponent {
|
|||
id={id}
|
||||
checked={settings.getIn(settingPath)}
|
||||
onChange={this.onChange}
|
||||
icons={false}
|
||||
onKeyDown={this.onKeyDown}
|
||||
/>
|
||||
);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable';
|
||||
import React, { useState, useEffect, useMemo } from 'react';
|
||||
import { defineMessages, useIntl, FormattedMessage } from 'react-intl';
|
||||
import Toggle from 'react-toggle';
|
||||
|
||||
import { updateConfig } from 'soapbox/actions/admin';
|
||||
import { uploadMedia } from 'soapbox/actions/media';
|
||||
import snackbar from 'soapbox/actions/snackbar';
|
||||
import List, { ListItem } from 'soapbox/components/list';
|
||||
import Toggle from 'soapbox/components/toggle';
|
||||
import {
|
||||
Column,
|
||||
CardHeader,
|
||||
|
|
Ładowanie…
Reference in New Issue