@shish2k/react-faicon 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +29 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Tiny FontAwesome Icon Component for React
|
|
2
|
+
|
|
3
|
+
Because for some reason `@fortawesome/react-fontawesome` bloats my final bundle by 80KB, to render <1KB of SVG tags.
|
|
4
|
+
|
|
5
|
+
This package has fewer features (no animation, no invert-opacity mode, etc). But if all you want is to render an icon, it does that. It uses the same icon data from `@fortawesome/free-solid-svg-icons`, so it should be a drop-in replacement for basic use cases.
|
|
6
|
+
|
|
7
|
+
Example usage:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { FAIcon } from '@shish/react-faicon';
|
|
11
|
+
import { faPlay } from '@fortawesome/free-solid-svg-icons';
|
|
12
|
+
|
|
13
|
+
export function App() {
|
|
14
|
+
return <FAIcon icon={faPlay} />;
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Dev Setup
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Build the library in watch mode:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm run dev
|
|
29
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type FAIconProps = React.SVGProps<SVGSVGElement> & {
|
|
3
|
+
icon: {
|
|
4
|
+
icon: [
|
|
5
|
+
number,
|
|
6
|
+
number,
|
|
7
|
+
string[],
|
|
8
|
+
string,
|
|
9
|
+
string
|
|
10
|
+
];
|
|
11
|
+
prefix: string;
|
|
12
|
+
iconName: string;
|
|
13
|
+
};
|
|
14
|
+
className?: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function FAIcon({ icon, className, ...svgProps }: FAIconProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
function FAIcon({ icon, className = "", ...svgProps }) {
|
|
4
|
+
const [width, height, _aliases, _unicode, svgPathData] = icon.icon;
|
|
5
|
+
return /*#__PURE__*/ jsx("svg", {
|
|
6
|
+
"aria-hidden": "true",
|
|
7
|
+
focusable: "false",
|
|
8
|
+
"data-prefix": icon.prefix,
|
|
9
|
+
"data-icon": icon.iconName,
|
|
10
|
+
className: `fa-${icon.iconName} ${className}`,
|
|
11
|
+
style: {
|
|
12
|
+
boxSizing: "content-box",
|
|
13
|
+
display: "inline-block",
|
|
14
|
+
height: "1em",
|
|
15
|
+
width: "1em",
|
|
16
|
+
overflow: "visible",
|
|
17
|
+
verticalAlign: "-0.125em"
|
|
18
|
+
},
|
|
19
|
+
role: "img",
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
22
|
+
...svgProps,
|
|
23
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
24
|
+
fill: "currentColor",
|
|
25
|
+
d: svgPathData
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export { FAIcon };
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shish2k/react-faicon",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"author": "Shish <shish+npm@shishnet.org>",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "shish/react-faicon",
|
|
7
|
+
"homepage": "https://github.com/shish/react-faicon",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/shish/react-faicon/issues"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"files": [
|
|
20
|
+
"dist"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "rslib build",
|
|
24
|
+
"check": "biome check --write",
|
|
25
|
+
"dev": "rslib build --watch",
|
|
26
|
+
"format": "biome format --write",
|
|
27
|
+
"release": "git tag $npm_package_version && git push && git push --tags && npm publish --tag latest --access public"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@biomejs/biome": "2.3.2",
|
|
31
|
+
"@rsbuild/plugin-react": "^1.4.2",
|
|
32
|
+
"@rslib/core": "^0.18.2",
|
|
33
|
+
"@types/react": "^19.2.6",
|
|
34
|
+
"react": "^19.2.0",
|
|
35
|
+
"typescript": "^5.9.3"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"react": ">=16.9.0",
|
|
39
|
+
"react-dom": ">=16.9.0"
|
|
40
|
+
}
|
|
41
|
+
}
|