![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.
@locmod/icon-name-type
Advanced tools
CLI to generate TS file with IconName type.
Image a React (NextJS) project with following structure.
Icons stored by groups in folders named by icon size.
public/
images/
icons/
16/
chevron.svg
clockwise.svg
24/
arrow-left.svg
arrow-right.svg
There is an Icon
component which accepts icon name
property.
type IconName = '16/chevron' | '16/clockwise' | '24/arrow-left' | '24/arrow-right'
type IconProps = {
name: IconName
}
const Icon: React.FC<IconProps> = ({ name }) => (
<img src={`/images/svg/${name}`} />
)
To automate process and avoid handwriting IconName
type this package exists.
icon-name-type
call will generate icons.d.ts
file with content
export type IconName = '16/chevron' | '16/clockwise' | '24/arrow-left' | '24/arrow-right'
The Icon
component's code can be simplified
import type { IconType } from './icons'
type IconProps = {
name: IconName
}
const Icon: React.FC<IconProps> = ({ name }) => (
<img src={`/images/svg/${name}`} />
)
icon-name-type --i ./public/images/svg --o ./src/components/Icon
icon-name-type --i .. --o .. --watch
Add this to your package.json scripts
"build-icons": "icon-name-type --i ./public/images/svg --o ./src/components/ui/Icon",
"watch-icons": "npm run build-icons -- --watch",
FAQs
This is a script to generate TS file with IconName type
The npm package @locmod/icon-name-type receives a total of 56 weekly downloads. As such, @locmod/icon-name-type popularity was classified as not popular.
We found that @locmod/icon-name-type demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.