Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@launchpad-ui/icons
Advanced tools
An element that supplements content and represents an action or feature within LaunchDarkly.
An element that supplements content and represents an action or feature within LaunchDarkly.
$ yarn add @launchpad-ui/icons
# or
$ npm install @launchpad-ui/icons
By default, the Icon
component expects the package's provided sprite.svg
file to be located in /static/sprite.svg
of your app. The name
prop specifies which icon to render.
import { Icon } from '@launchpad-ui/icons';
const MyIcon = () => <Icon name="info" />;
A custom path to the sprite can be set via the IconContext
provider. For example, if importing a static asset returns a resolved URL (like in Vite or Remix) you can do the following in your app to load the icons:
import { IconContext } from '@launchpad-ui/icons';
import icons from '@launchpad-ui/icons/sprite.svg';
import { createRoot } from 'react-dom/client';
const domNode = document.getElementById('root');
const root = createRoot(domNode);
root.render(
<IconContext.Provider value={{ path: icons }}>
<App />
</IconContext.Provider>
);
Unfortunately SVG sprites cannot be accessed cross-domain. If you are hosting the sprite file in a CDN or different domain you will have to fetch the file and inject it into the document to access the icons directly.
First set the Icon
context path to an empty string to indicate the symbols are available in the DOM:
import { IconContext } from '@launchpad-ui/icons';
import { createRoot } from 'react-dom/client';
const domNode = document.getElementById('root');
const root = createRoot(domNode);
root.render(
<IconContext.Provider value={{ path: '' }}>
<App />
</IconContext.Provider>
);
Then fetch and inject the sprite for Icon
to render icons correctly:
fetch('https://cdn.example.com/sprite.svg')
.then(async (response) => response.text())
.then((data) => {
const div = document.createElement('div');
div.id = 'lp-icons-sprite';
div.style.display = 'none';
div.innerHTML = data;
document.body.appendChild(div);
})
.catch((err) => {
console.log('Failed to fetch sprite', err);
});
To minimize latency, you can preload the sprite file accordingly:
<link
rel="preload"
href="https://cdn.example.com/sprite.svg"
as="fetch"
type="image/svg+xml"
crossorigin
/>
FAQs
An element that supplements content and represents an action or feature within LaunchDarkly.
The npm package @launchpad-ui/icons receives a total of 0 weekly downloads. As such, @launchpad-ui/icons popularity was classified as not popular.
We found that @launchpad-ui/icons demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.