Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gapo_aria/icon

Package Overview
Dependencies
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gapo_aria/icon - npm Package Compare versions

Comparing version 0.0.1-alpha.0 to 0.0.1-alpha.1

3

dist/main.js

@@ -35,4 +35,3 @@ var $azlKc$react = require("react");

try {
ImportedIconRef.current = // @ts-ignore
(await import(`@gapo_ui/icon/assets/${name}.svg`)).ReactComponent;
ImportedIconRef.current = (await import(`@gapo_ui/icon/assets/${name}.svg`)).ReactComponent;
if (onCompleted) onCompleted(name, ImportedIconRef.current);

@@ -39,0 +38,0 @@ } catch (err) {

@@ -19,4 +19,3 @@ import {useRef as $bQ1LR$useRef, useState as $bQ1LR$useState, useEffect as $bQ1LR$useEffect} from "react";

try {
ImportedIconRef.current = // @ts-ignore
(await import(`@gapo_ui/icon/assets/${name}.svg`)).ReactComponent;
ImportedIconRef.current = (await import(`@gapo_ui/icon/assets/${name}.svg`)).ReactComponent;
if (onCompleted) onCompleted(name, ImportedIconRef.current);

@@ -23,0 +22,0 @@ } catch (err) {

{
"name": "@gapo_aria/icon",
"version": "0.0.1-alpha.0",
"version": "0.0.1-alpha.1",
"description": "Gapo UI components in React",

@@ -20,3 +20,3 @@ "license": "Apache-2.0",

},
"gitHead": "bf3c659dd0f3001e24f67f2a2dceed809a5a01d2"
"gitHead": "48d5fd201c78288a862186f05aca04dfa80a8b9f"
}

@@ -1,5 +0,5 @@

import {useState, useRef, useEffect} from 'react';
import { useState, useRef, useEffect } from 'react'
interface DynamicSVGImportOptions {
onCompleted?: (name, ref)=> void,
onCompleted?: (name, ref) => void
onError?: (err) => void

@@ -9,37 +9,38 @@ }

interface DynamicSVGImportAria {
error: any,
loading: any,
error: any
loading: any
SvgIcon: any
}
export function useDynamicSVGImport(name: string, options:DynamicSVGImportOptions = {}):DynamicSVGImportAria {
const ImportedIconRef = useRef();
const [loading, setLoading] = useState(false);
const [error, setError] = useState();
export function useDynamicSVGImport(
name: string,
options: DynamicSVGImportOptions = {}
): DynamicSVGImportAria {
const ImportedIconRef = useRef()
const [loading, setLoading] = useState(false)
const [error, setError] = useState()
const {onCompleted, onError} = options;
const { onCompleted, onError } = options
useEffect(() => {
setLoading(true);
setLoading(true)
const importIcon = async () => {
try {
ImportedIconRef.current = (
// @ts-ignore
await import(`@gapo_ui/icon/assets/${name}.svg`)
).ReactComponent;
ImportedIconRef.current = // @ts-ignore
(await import(`@gapo_ui/icon/assets/${name}.svg`)).ReactComponent
if (onCompleted) {
onCompleted(name, ImportedIconRef.current);
onCompleted(name, ImportedIconRef.current)
}
} catch (err) {
if (onError) {
onError(err);
onError(err)
}
setError(err);
setError(err)
} finally {
setLoading(false);
setLoading(false)
}
};
importIcon();
}, [name, onCompleted, onError]);
}
importIcon()
}, [name, onCompleted, onError])
return {error, loading, SvgIcon: ImportedIconRef.current};
return { error, loading, SvgIcon: ImportedIconRef.current }
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc