Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Undraw-js is a library allow you to add undraw.co illustration to web page with a specifique color
Installation
<script src="https://unpkg.com/undraw-js@1.0/index.min.js"></script>
or use yarn or npm
$ yarn add undraw-js
$ npm i undraw-js
Add some attribute to your img
element
<img data-ujs-name="Ukraine" data-ujs-color="#f00" />
About attributes
Options | Description | Required |
---|---|---|
data-ujs-name | Input here the name of the illustration | yes |
data-ujs-color | Input here the main color code you want | no |
data-ujs-fall-img | The image link to set as the source of the img element if the illustration failed to load. | no |
Add this script to the page
<script>
UndrawJS.init()
</script>
or
import UndrawJs from 'undraw-js'
(new UndrawJs()).init()
You can provide options to Undraw object
const options = {
nameAttr: "data-ujs-name", // Custom attribute of nodes that specifies the name of the illustration
colorAttr: "data-ujs-color", // Custom attribute of nodes that specifies the main color
doneAttr: "data-ujs-done", // Custom attribute of nodes that specifies if the illustration is addded to the node
fallbackAttr: "data-ujs-fall-img", // Custom attribute of nodes that specifies the fall image
defaultColor: "#f00" // To specify a default color
};
UndrawJS.init(options); // or (new UndrawJs()).init(options) for module user
Go to undraw.co find illustration you need and copy its name
Only the illustrations you add to your page are loaded.
Illustration not loaded ? Undraw is constantly evolving. If the illustration does not load, perhaps the version of undraw-js you are using is deployed before the creation of this illustration. To fix this, see if there is a version of undraw-js higher than the version you are using, if it is the last version you are using then wait for a new update. There are over 1300 illustrations that you can use
FAQs
Js library for Undraw illustration
The npm package undraw-js receives a total of 348 weekly downloads. As such, undraw-js popularity was classified as not popular.
We found that undraw-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.