2
0
mirror of https://github.com/iconify/iconify.git synced 2025-01-07 15:44:05 +00:00

Few small changes to React component

This commit is contained in:
Vjacheslav Trushkin 2021-05-01 23:39:56 +03:00
parent e9dc3803e4
commit 73cec2ac80
23 changed files with 28 additions and 24 deletions

View File

@ -2,7 +2,6 @@ import React from 'react';
import type { IconifyJSON } from '@iconify/types'; import type { IconifyJSON } from '@iconify/types';
// Core // Core
import { stringToIcon } from '@iconify/core/lib/icon/name';
import type { IconifyIconName } from '@iconify/core/lib/icon/name'; import type { IconifyIconName } from '@iconify/core/lib/icon/name';
import type { import type {
IconifyIconSize, IconifyIconSize,
@ -111,6 +110,7 @@ export {
GetAPIConfig, GetAPIConfig,
IconifyAPIPrepareQuery, IconifyAPIPrepareQuery,
IconifyAPISendQuery, IconifyAPISendQuery,
PartialIconifyAPIConfig,
}; };
/* Browser cache */ /* Browser cache */
@ -353,7 +353,11 @@ class IconComponent extends React.Component<
const icon = this.props.icon; const icon = this.props.icon;
// Icon is an object // Icon is an object
if (typeof icon === 'object' && typeof icon.body === 'string') { if (
typeof icon === 'object' &&
icon !== null &&
typeof icon.body === 'string'
) {
// Stop loading // Stop loading
this._icon = ''; this._icon = '';
this._abortLoading(); this._abortLoading();

View File

@ -1,4 +1,4 @@
import { loadIcons, iconExists } from '../../lib/iconify'; import { loadIcons, iconExists } from '../../dist/iconify';
import { mockAPIData } from '@iconify/core/lib/api/modules/mock'; import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
import { provider, nextPrefix } from './load'; import { provider, nextPrefix } from './load';

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import { Icon, loadIcons, iconExists } from '../../lib/iconify'; import { Icon, loadIcons, iconExists } from '../../dist/iconify';
import { mockAPIData } from '@iconify/core/lib/api/modules/mock'; import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
import { provider, nextPrefix } from './load'; import { provider, nextPrefix } from './load';

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import { Icon, iconExists } from '../../lib/iconify'; import { Icon, iconExists } from '../../dist/iconify';
import { mockAPIData } from '@iconify/core/lib/api/modules/mock'; import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
import { provider, nextPrefix } from './load'; import { provider, nextPrefix } from './load';

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
import { Icon, InlineIcon, loadIcons, iconExists } from '../../lib/iconify'; import { Icon, InlineIcon, loadIcons, iconExists } from '../../dist/iconify';
import { mockAPIData } from '@iconify/core/lib/api/modules/mock'; import { mockAPIData } from '@iconify/core/lib/api/modules/mock';
import { provider, nextPrefix } from './load'; import { provider, nextPrefix } from './load';

View File

@ -1,4 +1,4 @@
import { _api, addAPIProvider } from '../../lib/iconify'; import { _api, addAPIProvider } from '../../dist/iconify';
import { mockAPIModule } from '@iconify/core/lib/api/modules/mock'; import { mockAPIModule } from '@iconify/core/lib/api/modules/mock';
// API provider for tests // API provider for tests

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon, InlineIcon } from '../../lib/iconify'; import { Icon, InlineIcon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon } from '../../lib/iconify'; import { Icon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
describe('Empty icon', () => { describe('Empty icon', () => {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon, InlineIcon } from '../../lib/iconify'; import { Icon, InlineIcon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { InlineIcon } from '../../lib/iconify'; import { InlineIcon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon } from '../../lib/iconify'; import { Icon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconDataWithID = { const iconDataWithID = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon } from '../../lib/iconify'; import { Icon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon, InlineIcon } from '../../lib/iconify'; import { Icon, InlineIcon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { InlineIcon } from '../../lib/iconify'; import { InlineIcon } from '../../dist/iconify';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon, InlineIcon } from '../../lib/offline'; import { Icon, InlineIcon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon } from '../../lib/offline'; import { Icon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
describe('Empty icon', () => { describe('Empty icon', () => {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon, InlineIcon } from '../../lib/offline'; import { Icon, InlineIcon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { InlineIcon } from '../../lib/offline'; import { InlineIcon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon } from '../../lib/offline'; import { Icon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconDataWithID = { const iconDataWithID = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon } from '../../lib/offline'; import { Icon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon, InlineIcon } from '../../lib/offline'; import { Icon, InlineIcon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { Icon, addIcon, addCollection } from '../../lib/offline'; import { Icon, addIcon, addCollection } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {

View File

@ -1,5 +1,5 @@
import React from 'react'; import React from 'react';
import { InlineIcon } from '../../lib/offline'; import { InlineIcon } from '../../dist/offline';
import renderer from 'react-test-renderer'; import renderer from 'react-test-renderer';
const iconData = { const iconData = {