@nikaat-crop/es-icons 0.0.9 → 0.2.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 CHANGED
@@ -16,7 +16,7 @@ A comprehensive collection of beautiful and modern SVG icons specifically design
16
16
  </p>
17
17
  </div>
18
18
 
19
- ## 📸 Preview
19
+ ## 📸 Demo
20
20
 
21
21
  <div align="center">
22
22
  <img src="./assets/preview.png" alt="ES Icons Preview" width="100%" />
@@ -94,6 +94,70 @@ import * as Icons from '@nikaat-crop/es-icons';
94
94
 
95
95
  And many more! Check out the [full documentation](https://es-icons.vercel.app/) for a complete list.
96
96
 
97
+ ## ➕ Adding New Icons
98
+
99
+ Want to contribute a new icon to the collection? Follow these simple steps:
100
+
101
+ ### Step 1: Prepare Your SVG
102
+ 1. Place your SVG file in the `src/svgs/` directory
103
+ 2. **Important guidelines:**
104
+ - Set the icon size to **24×24 pixels**
105
+ - Use `#000` (black) for colors that should be customizable from outside
106
+ - Ensure the SVG is optimized and clean
107
+
108
+ ```xml
109
+ <!-- ✅ Good example -->
110
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
111
+ <path d="M12 2L2 7V10C2 16 6 20.5 12 22C18 20.5 22 16 22 10V7L12 2Z" fill="#000"/>
112
+ </svg>
113
+
114
+ <!-- ❌ Avoid fixed colors if you want them to be customizable -->
115
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
116
+ <path d="M12 2L2 7V10C2 16 6 20.5 12 22C18 20.5 22 16 22 10V7L12 2Z" fill="#3B82F6"/>
117
+ </svg>
118
+ ```
119
+
120
+ ### Step 2: Generate React Component
121
+ Run the icon generation script to automatically create the React component:
122
+
123
+ ```bash
124
+ npm run icons:generate
125
+ ```
126
+
127
+ This command will:
128
+ - Convert your SVG to a React component using SVGR
129
+ - Add TypeScript definitions
130
+ - Update the main exports in `src/index.ts`
131
+
132
+ ### Step 3: Update Storybook
133
+ Add your new icon to the Storybook gallery by importing it in `src/stories/icons.stories.tsx`:
134
+
135
+ ```tsx
136
+ // Add your import
137
+ import { YourNewIcon } from '../index';
138
+
139
+ // Add to the icons array
140
+ const icons = [
141
+ // ... existing icons
142
+ { name: 'YourNewIcon', component: YourNewIcon },
143
+ ];
144
+ ```
145
+
146
+ ### Step 4: Test Your Icon
147
+ 1. Start Storybook to preview your icon:
148
+ ```bash
149
+ npm run storybook
150
+ ```
151
+ 2. Verify that your icon displays correctly
152
+ 3. Test that colors can be customized via props
153
+
154
+ ### Step 5: Publish (For Maintainers)
155
+ Once everything looks good, publish the updated package:
156
+
157
+ ```bash
158
+ npm run release
159
+ ```
160
+
97
161
  ## 🎨 Icon Props
98
162
 
99
163
  All icons accept standard SVG props:
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nikaat-crop/es-icons",
3
- "version": "0.0.9",
3
+ "version": "0.2.0",
4
4
  "description": "A comprehensive collection of beautiful and modern SVG icons specifically designed for Skenas (اسکناس) project, featuring 160+ carefully crafted financial and service icons with TypeScript support.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
9
  "release": "node release.js",
10
- "icons:generate": "node script/svgr-convert-only-new.js && node script/update-icon-exports.js && node script/update-storybook.js",
10
+ "icons:generate": "node script/svgr-convert-only-new.js && node script/update-icon-exports.js",
11
11
  "storybook": "storybook dev -p 6006",
12
12
  "build-storybook": "storybook build"
13
13
  },
@@ -1,66 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const ICONS_DIR = path.resolve(__dirname, '../src/icons');
5
- const STORYBOOK_FILE = path.resolve(__dirname, '../src/stories/icons.stories.tsx');
6
- const INDEX_FILE = path.resolve(__dirname, '../src/index.ts');
7
-
8
- function toPascalCase(str) {
9
- return str
10
- .split(/[-_]/)
11
- .map(s => s.charAt(0).toUpperCase() + s.slice(1))
12
- .join('');
13
- }
14
-
15
- function updateStorybook() {
16
- console.log('🔄 Updating storybook with new icons...');
17
-
18
- // Get all .tsx files from icons directory
19
- const iconFiles = fs.readdirSync(ICONS_DIR)
20
- .filter(f => f.endsWith('.tsx'))
21
- .map(f => path.basename(f, '.tsx'));
22
-
23
- // Convert to PascalCase names
24
- const iconNames = iconFiles.map(toPascalCase);
25
- iconNames.sort(); // Sort alphabetically
26
-
27
- // Read current storybook file
28
- let storybookContent = fs.readFileSync(STORYBOOK_FILE, 'utf8');
29
-
30
- // Update imports section
31
- const importStart = storybookContent.indexOf('import {');
32
- const importEnd = storybookContent.indexOf("} from '../index';") + "} from '../index';".length;
33
-
34
- const newImports = `import {\n ${iconNames.join(',\n ')}\n} from '../index';`;
35
-
36
- storybookContent = storybookContent.substring(0, importStart) +
37
- newImports +
38
- storybookContent.substring(importEnd);
39
-
40
- // Update icons array
41
- const arrayStart = storybookContent.indexOf('const icons = [');
42
- const arrayEnd = storybookContent.indexOf('];', arrayStart) + 2;
43
-
44
- const iconEntries = iconNames.map(name =>
45
- ` { name: '${name}', component: ${name} }`
46
- );
47
-
48
- const newIconsArray = `const icons = [\n${iconEntries.join(',\n')}\n ];`;
49
-
50
- storybookContent = storybookContent.substring(0, arrayStart) +
51
- newIconsArray +
52
- storybookContent.substring(arrayEnd);
53
-
54
- // Write updated content back to file
55
- fs.writeFileSync(STORYBOOK_FILE, storybookContent);
56
-
57
- console.log(`✅ Storybook updated with ${iconNames.length} icons`);
58
- console.log('📋 Updated icons:', iconNames.join(', '));
59
- }
60
-
61
- // Run if called directly
62
- if (require.main === module) {
63
- updateStorybook();
64
- }
65
-
66
- module.exports = { updateStorybook };