![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@purpurds/icon
Advanced tools
import { Meta, Stories, ArgTypes, Canvas, Subtitle } from "@storybook/blocks";
import { Meta, Stories, ArgTypes, Canvas, Subtitle } from "@storybook/blocks";
import * as IconStories from "./src/icon.stories"; import packageInfo from "./package.json";
Version {packageInfo.version}
Add the dependency to your consumer app like "@purpurds/purpur": "^x.y.z"
In MyApp.tsx
import "@purpurds/purpur/styles";
In MyComponent.tsx
import { IconAiRobot } from "@purpurds/purpur";
export const MyComponent = () => {
return (
<div>
<IconAiRobot size="xs" />
</div>
);
};
import { Icon, aiRobot } from "@purpurds/purpur";
export const MyComponent = () => {
return (
<div>
<Icon svg={aiRobot} size="xs" />
</div>
);
};
If you don't know beforehand what icon to use, e.g. if it comes from a CMS, you can use a dynamic import. Be aware that this will result in a larger bundle size since all icons have to be included in the bundle.
import React, { useEffect, useState } from "react";
import type { IconBaseProps, IconName } from "@purpurds/icon";
import { DEFAULT_SIZE } from "@purpurds/icon";
import { pascalCase } from "change-case";
export type IconDynamicProps = {
name: IconName;
} & IconBaseProps;
export const IconDynamic = ({
["data-testid"]: dataTestId,
name,
className,
allyTitle,
size = DEFAULT_SIZE,
...props
}: IconDynamicProps) => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const [Component, setComponent] = useState<React.ComponentType<any> | null>(null);
useEffect(() => {
const importComponent = async () => {
try {
const module = await import(`@purpurds/icon/dist/components/${name}.es.js`);
setComponent(() => module[`Icon${pascalCase(name)}`]);
} catch (error) {
// eslint-disable-next-line no-console
console.error(`Error importing component "${name}":`, error);
}
};
importComponent();
}, [name]);
return Component ? (
<Component
allyTitle={allyTitle}
className={className}
size={size}
data-testid={dataTestId}
{...props}
/>
) : null;
};
IconDynamic.displayName = "IconDynamic";
FAQs
import { Meta, Stories, ArgTypes, Canvas, Subtitle } from "@storybook/blocks";
The npm package @purpurds/icon receives a total of 477 weekly downloads. As such, @purpurds/icon popularity was classified as not popular.
We found that @purpurds/icon 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.