Skip to content

Commit bea6290

Browse files
authored
Merge pull request #51 from pheralb/next
v1.3.0
2 parents 405635d + 534a409 commit bea6290

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4653
-1615
lines changed

library/.swcrc

Lines changed: 0 additions & 26 deletions
This file was deleted.

library/README.md

Lines changed: 245 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
<div align="center">
2-
<a href="https://react-symbols.vercel.app/">
2+
<a href="https://react-symbols.pheralb.dev">
33
<img src="https://raw.githubusercontent.com/pheralb/react-symbols/main/website/public/images/og.png" alt="React-Symbols Screenshot" />
44
</a>
55

66
<p></p>
77

8-
<a href="https://react-symbols.vercel.app">Website</a>
8+
<a href="https://react-symbols.pheralb.dev">Website</a>
99
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1010
<a href="#-getting-started">Getting Started</a>
1111
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
12+
<a href="#️-utilities">Utilities</a>
13+
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1214
<a href="#-license">License</a>
1315
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1416
<a href="#-contribute">Contribute</a>
1517
<span>&nbsp;&nbsp;&nbsp;&nbsp;</span>
1618
<a href="https://marketplace.visualstudio.com/items?itemName=miguelsolorio.symbols">VSCode Theme</a>
1719

18-
![React Badge](https://img.shields.io/badge/React-61DAFB?logo=react&logoColor=000&style=flat)
19-
![SWC Badge](https://img.shields.io/badge/SWC-F8C457?logo=swc&logoColor=000&style=flat)
20+
![React Badge](https://img.shields.io/badge/Library-61DAFB?logo=react&logoColor=000&style=flat)
21+
![React Router Badge](https://img.shields.io/badge/Website-CA4245?logo=reactrouter&logoColor=fff&style=flat)
2022
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpheralb%2Freact-symbols%2Fbadge%3Fref%3Dmain&style=flat)](https://actions-badge.atrox.dev/pheralb/react-symbols/goto?ref=main)
2123
![GitHub releases](https://img.shields.io/github/release/pheralb/react-symbols)
2224
![GitHub stars](https://img.shields.io/github/stars/pheralb/react-symbols)
@@ -27,12 +29,12 @@
2729

2830
## 🧑‍🚀 Introduction
2931

30-
[**React-Symbols**](https://react-symbols.vercel.app/) is a library for React with the icons of the VSCode theme [**Symbols**](https://marketplace.visualstudio.com/items?itemName=miguelsolorio.symbols) created by [Miguel Solorio (@miguelsolorio)](https://github.com/miguelsolorio):
32+
[**React-Symbols**](https://react-symbols.pheralb.dev/) is a library for React with the icons of the VSCode theme [**Symbols**](https://marketplace.visualstudio.com/items?itemName=miguelsolorio.symbols) created by [Miguel Solorio (@miguelsolorio)](https://github.com/miguelsolorio):
3133

32-
- 📦 **+100** files & folders icons.
34+
- 📦 **+200** files & folders icons.
3335
- ☁️ Support for **React Server Components** (RSC).
3436
- 🍃 **Lightweight** & **tree-shakable**.
35-
- 💙 Built with **Typescript**.
37+
- 💙 Built with **TypeScript**.
3638
- 🚀 **SVG optimized** and **minified**.
3739

3840
## 🚀 Getting Started
@@ -57,15 +59,50 @@ bun add @react-symbols/icons
5759

5860
### - Usage
5961

62+
**Using file and folder icons:**
63+
6064
```jsx
61-
import { Angular, Astro, Document } from "@react-symbols/icons";
65+
import { Astro, FolderBlue } from "@react-symbols/icons";
6266

6367
const MyComponent = () => {
6468
return (
6569
<>
6670
<Angular width={128} height={128} />
67-
<Astro width={128} height={128} />
68-
<Document width={128} height={128} />
71+
<FolderBlue width={128} height={128} />
72+
</>
73+
);
74+
};
75+
76+
export default MyComponent;
77+
```
78+
79+
**Only file icons:**
80+
81+
```jsx
82+
import { Astro, Docker } from "@react-symbols/icons/files";
83+
84+
const MyComponent = () => {
85+
return (
86+
<>
87+
<Angular width={128} height={128} />
88+
<Docker width={128} height={128} />
89+
</>
90+
);
91+
};
92+
93+
export default MyComponent;
94+
```
95+
96+
**Only folder icons:**
97+
98+
```jsx
99+
import { FolderConfig, FolderApp } from "@react-symbols/icons/folders";
100+
101+
const MyComponent = () => {
102+
return (
103+
<>
104+
<FolderConfig width={128} height={128} />
105+
<FolderApp width={128} height={128} />
69106
</>
70107
);
71108
};
@@ -100,6 +137,201 @@ const MyComponent = () => {
100137
export default MyComponent;
101138
```
102139

140+
## ⚙️ Utilities
141+
142+
### `FileIcon`
143+
144+
Get the [file icon](https://react-symbols.pheralb.dev) component for a given file name or extension.
145+
146+
**`getIconForFile`** function:
147+
148+
```tsx
149+
import { getIconForFile } from "@react-symbols/icons/utils";
150+
151+
const Page = () => {
152+
return (
153+
<main>
154+
{getIconForFile({
155+
fileName: "example.ts",
156+
})}
157+
</main>
158+
);
159+
};
160+
```
161+
162+
**`FileIcon`** component:
163+
164+
```tsx
165+
import { FileIcon } from "@react-symbols/icons/utils";
166+
167+
const Page = () => {
168+
return (
169+
<main>
170+
<FileIcon fileName="example.ts" />
171+
</main>
172+
);
173+
};
174+
```
175+
176+
**Options**:
177+
178+
- `fileName` (`string`): The name of the file (e.g., "example.ts", "index.html"). [The full list of extensions can be found here](https://github.com/pheralb/react-symbols/blob/main/library/src/utils/extensions/fileExtensionIcons.tsx). If does not match any file extension, the `DefaultFileIcon` component will be rendered.
179+
180+
```tsx
181+
import { FileIcon } from "@react-symbols/icons/utils";
182+
183+
<FileIcon fileName="example.ts" />;
184+
```
185+
186+
- `autoAssign` (`boolean`, optional): If `true`, the utility will automatically assign the icon based on the file name (e.g., "vite.config.js" -> Vite icon). [The full list of file names can be found here](https://github.com/pheralb/react-symbols/blob/main/library/src/utils/extensions/fileNameIcons.tsx). If does not match any file name, it will fallback to the file extension mapping.
187+
188+
```tsx
189+
import { FileIcon } from "@react-symbols/icons/utils";
190+
191+
<FileIcon fileName="package.json" autoAssign={true} />;
192+
```
193+
194+
- `editFileExtensionData` (`ExtensionType`, optional): An object that allows you to extend or override the default file extension to icon mapping.
195+
196+
```tsx
197+
import { Js } from "@react-symbols/icons/files";
198+
import { FileIcon } from "@react-symbols/icons/utils";
199+
200+
<FileIcon
201+
fileName="customfile.ts"
202+
editFileExtensionData={{
203+
ts: Js,
204+
}}
205+
/>;
206+
```
207+
208+
- `editFileNameData` (`ExtensionType`, optional. Activate `autoAssign` first): An object that allows you to extend or override the default file name to icon mapping.
209+
210+
```tsx
211+
import { Ts } from "@react-symbols/icons/files";
212+
import { FileIcon } from "@react-symbols/icons/utils";
213+
214+
<FileIcon
215+
autoAssign={true}
216+
fileName="eslint.config.ts"
217+
editFileNameData={{
218+
"eslint.config.ts": Ts,
219+
}}
220+
/>;
221+
```
222+
223+
- `SVGProps<SVGSVGElement>`: SVG properties to customize the icon.
224+
225+
```tsx
226+
import { FileIcon } from "@react-symbols/icons/utils";
227+
228+
<FileIcon fileName="myfile.ts" width={48} height={48} />;
229+
```
230+
231+
### `FolderIcon`
232+
233+
Get the [folder icon](https://react-symbols.pheralb.dev/folders) component for a given folder name.
234+
235+
**`getIconForFolder`** function:
236+
237+
```tsx
238+
import { getIconForFolder } from "@react-symbols/icons/utils";
239+
240+
const Page = () => {
241+
return (
242+
<main>
243+
{getIconForFolder({
244+
folderName: "node_modules",
245+
})}
246+
</main>
247+
);
248+
};
249+
```
250+
251+
**`FolderIcon`** component:
252+
253+
```tsx
254+
import { FolderIcon } from "@react-symbols/icons/utils";
255+
256+
const Page = () => {
257+
return (
258+
<main>
259+
<FolderIcon folderName="node_modules" />
260+
</main>
261+
);
262+
};
263+
```
264+
265+
**Options**:
266+
267+
- `folderName` (`string`): The name of the folder (e.g., "src", "config"). [The full list of folder names can be found here](https://github.com/pheralb/react-symbols/blob/main/library/src/utils/extensions/folderNameIcons.tsx). If does not match any folder name, the `DefaultFolderIcon` component will be used.
268+
269+
```tsx
270+
import { FolderIcon } from "@react-symbols/icons/utils";
271+
272+
<FolderIcon folderName="src" />;
273+
```
274+
275+
- `editFolderNameData` (`ExtensionType`, optional): An object that allows you to extend or override the default folder name to icon mapping.
276+
277+
```tsx
278+
import { FolderIcon } from "@react-symbols/icons/utils";
279+
import { FolderAngular } from "@react-symbols/icons/folders";
280+
281+
<FolderIcon
282+
editFolderNameData={{
283+
app: FolderAngular,
284+
}}
285+
/>;
286+
```
287+
288+
- `SVGProps<SVGSVGElement>`: SVG properties to customize the icon.
289+
290+
```tsx
291+
import { FolderIcon } from "@react-symbols/icons/utils";
292+
293+
<FolderIcon folderName="app" width={48} height={48} />;
294+
```
295+
296+
### `ExtensionType`
297+
298+
Type definition for extending or overriding the default file/folder name to icon mapping.
299+
300+
```ts
301+
import type { ExtensionType } from "@react-symbols/icons/utils";
302+
303+
const moreExtensions: ExtensionType = {
304+
"customfile.ext": CustomFileIcon,
305+
customfolder: CustomFolderIcon,
306+
};
307+
```
308+
309+
### Icons for file explorers
310+
311+
- `DefaultFileIcon`: The default icon component for unknown files.
312+
313+
```tsx
314+
import { DefaultFileIcon } from "@react-symbols/icons/utils";
315+
316+
<DefaultFileIcon width={48} height={48} />;
317+
```
318+
319+
- `DefaultFolderIcon`: The default icon component for unknown folders.
320+
321+
```tsx
322+
import { DefaultFolderIcon } from "@react-symbols/icons/utils";
323+
324+
<DefaultFolderIcon width={48} height={48} />;
325+
```
326+
327+
- `DefaultFolderOpenedIcon`: The default icon component for opened folders.
328+
329+
```tsx
330+
import { DefaultFolderOpenedIcon } from "@react-symbols/icons/utils";
331+
332+
<DefaultFolderOpenedIcon width={48} height={48} />;
333+
```
334+
103335
## 📦 Stack
104336

105337
This is a monorepo project created with:
@@ -113,7 +345,7 @@ This is a monorepo project created with:
113345

114346
**For library:**
115347

116-
- [SWC](https://swc.rs/) - Rust-based platform for the Web.
348+
- [tsdown](https://tsdown.dev/) - The elegant bundler for libraries powered by Rolldown.
117349
- [React 19](https://reactjs.org/) - A JavaScript library for building user interfaces.
118350
- [Typescript](https://www.typescriptlang.org/) - TypeScript is JavaScript with syntax for types.
119351

@@ -122,9 +354,8 @@ This is a monorepo project created with:
122354
- [React Router v7](https://reactrouter.com/) - Create modern, resilient user experiences with web fundamentals.
123355
- [Typescript](https://www.typescriptlang.org/) - TypeScript is JavaScript with syntax for types.
124356
- [Tailwind CSS](https://tailwindcss.com/) - A utility-first CSS framework for rapidly building custom designs.
125-
- [tw-animate-css](https://github.com/Wombosvideo/tw-animate-css) - A collection of Tailwind CSS v4.0 utilities for creating beautiful animations.
126357
- [shadcn/ui + Radix UI](https://ui.shadcn.com/) - An opinionated toast component for React.
127-
- [Sonner](https://sonner.emilkowal.ski/) - An opinionated toast component for React.
358+
- [pheralb/toast](https://toast.pheralb.dev/) - An accessible and beautiful toast library for React.
128359

129360
## 🙌 Contribute
130361

@@ -160,4 +391,4 @@ and open [**localhost:5173**](http://localhost:5173) with your browser to see th
160391

161392
## 🔑 License
162393

163-
- [MIT License](https://github.com/pheralb/react-symbols/blob/main/LICENSE).
394+
[MIT License](https://github.com/pheralb/react-symbols/blob/main/LICENSE).

0 commit comments

Comments
 (0)