Skip to content

Commit 40d8614

Browse files
committed
Shorthand everything. Added full html e.g.
1 parent 9e4e3c7 commit 40d8614

20 files changed

+930
-27
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Contributing to @pixelarticons/react
1+
# Contributing to @nsommer/pixelart-react
22

3-
Thank you for considering contributing to @pixelarticons/react! This document outlines the process for development and contribution.
3+
Thank you for considering contributing to @nsommer/pixelart-react! This document outlines the process for development and contribution.
44

55
## Development Setup
66

77
1. Clone the repository
88
```bash
9-
git clone https://github.com/yourrepo/pixelarticons-react.git
10-
cd pixelarticons-react
9+
git clone https://github.com/yourrepo/pixelart-react.git
10+
cd pixelart-react
1111
```
1212

1313
2. Install dependencies

README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,66 @@
11
# Pixelarticons React
22

3+
![Pixelarticons React](./cover.png)
4+
35
React components for [pixelarticons](https://github.com/halfmage/pixelarticons).
46

7+
## Icon Gallery
8+
9+
<p align="center">
10+
<img src="./examples/icon-gallery.png" alt="Pixelarticons Gallery" width="800" />
11+
</p>
12+
13+
**New!** [View the full interactive gallery with all 486 icons](https://gitntg.github.io/pixelarticons-react/examples/gallery-generator.html)
14+
15+
## 🚨 Version 2.0.0 Migration Guide 🚨
16+
17+
The package has been renamed from `@nicholuassommer/pixelarticons-react` to `@nsommer/pixelart-react` for simplicity.
18+
19+
This is a fork of the original (and amazing) package from halfmage.
20+
-Please visit https://github.com/halfmage/pixelarticons for the original repo.
21+
-Also consider purchasing the extended Icon pack @ https://pixelarticons.com/
22+
23+
Actively monitored and maintained by [nicholuassommer](https://github.com/nicholuassommer).
24+
25+
### Migration Steps:
26+
27+
1. Update your package.json dependency:
28+
29+
```diff
30+
- "@nicholuassommer/pixelarticons-react": "^1.0.1"
31+
+ "@nsommer/pixelart-react": "^2.0.0"
32+
```
33+
34+
2. Update your imports:
35+
36+
#### Previous import style:
37+
38+
```jsx
39+
import { User, Heart } from "@nicholuassommer/pixelarticons-react";
40+
```
41+
42+
#### New import options:
43+
44+
```jsx
45+
// Option 1: Direct from package (similar to before)
46+
import { User, Heart } from "@nsommer/pixelart-react";
47+
48+
// Option 2: New shorter path
49+
import { User, Heart } from "pixelart/react";
50+
```
51+
552
## Installation
653

754
```bash
8-
npm install @nicholuassommer/pixelarticons-react
55+
npm install @nsommer/pixelart-react
956
```
1057

1158
## Usage
1259

1360
### Direct Import
1461

1562
```jsx
16-
import { User, Heart, ArrowRight } from "@nicholuassommer/pixelarticons-react";
63+
import { User, Heart, ArrowRight } from "pixelart/react";
1764

1865
function App() {
1966
return (
@@ -29,7 +76,7 @@ function App() {
2976
### Using Icon Component
3077

3178
```jsx
32-
import { Icon } from "@nicholuassommer/pixelarticons-react";
79+
import { Icon } from "pixelart/react";
3380

3481
function App() {
3582
return (
@@ -62,7 +109,7 @@ For icons starting with numbers, you can either use the component name with "Ico
62109

63110
```jsx
64111
// Direct import
65-
import { Icon4g } from "@nicholuassommer/pixelarticons-react";
112+
import { Icon4g } from "pixelart/react";
66113

67114
// Or using the Icon component
68115
<Icon name="4g" />;

cover.jpg

-65.2 KB
Binary file not shown.

cover.png

498 KB
Loading

dist/cjs/react.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
"use strict";
2+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3+
if (k2 === undefined) k2 = k;
4+
var desc = Object.getOwnPropertyDescriptor(m, k);
5+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6+
desc = { enumerable: true, get: function() { return m[k]; } };
7+
}
8+
Object.defineProperty(o, k2, desc);
9+
}) : (function(o, m, k, k2) {
10+
if (k2 === undefined) k2 = k;
11+
o[k2] = m[k];
12+
}));
13+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
14+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15+
};
16+
Object.defineProperty(exports, "__esModule", { value: true });
17+
// This file supports the import path: import { IconName } from 'pixelart/react'
18+
__exportStar(require("./icons"), exports);
19+
__exportStar(require("./Icon"), exports);
20+
const Icon_1 = require("./Icon");
21+
exports.default = Icon_1.Icon;

dist/esm/react.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// This file supports the import path: import { IconName } from 'pixelart/react'
2+
export * from './icons';
3+
export * from './Icon';
4+
import { Icon } from './Icon';
5+
export default Icon;

dist/react.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './icons';
2+
export * from './Icon';
3+
import { Icon } from './Icon';
4+
export default Icon;

examples/BasicExample.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import { Icon } from '@pixelarticons/react';
3-
import { User, ShoppingCart, Heart } from '@pixelarticons/react';
2+
import { Icon } from 'pixelart/react';
3+
import { User, ShoppingCart, Heart } from 'pixelart/react';
44

55
export function BasicExample() {
66
return (

examples/NextJsExample.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22
import Head from 'next/head';
3-
import { Icon, IconName } from '@pixelarticons/react';
3+
import { Icon, IconName } from 'pixelart/react';
44
// For direct imports
5-
import { User, ShoppingCart, Heart } from '@pixelarticons/react';
5+
import { User, ShoppingCart, Heart } from 'pixelart/react';
66

77
// Array of icon names for demo
88
const commonIcons = [
@@ -18,7 +18,7 @@ export default function IconsDemo() {
1818
<div className="container">
1919
<Head>
2020
<title>Pixelarticons React Demo</title>
21-
<meta name="description" content="Demo for @pixelarticons/react package" />
21+
<meta name="description" content="Demo for @nsommer/pixelart-react package" />
2222
<link rel="icon" href="/favicon.ico" />
2323
</Head>
2424

examples/gallery-generator.html

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Pixelarticons Gallery</title>
7+
<style>
8+
body {
9+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
10+
background-color: #f9f9f9;
11+
padding: 20px;
12+
color: #333;
13+
}
14+
h1 {
15+
text-align: center;
16+
font-size: 28px;
17+
margin-bottom: 5px;
18+
}
19+
.gallery {
20+
display: grid;
21+
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
22+
gap: 20px;
23+
max-width: 1200px;
24+
margin: 0 auto;
25+
}
26+
.icon-item {
27+
display: flex;
28+
flex-direction: column;
29+
align-items: center;
30+
background: white;
31+
border-radius: 8px;
32+
padding: 15px 10px;
33+
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
34+
transition: transform 0.2s, box-shadow 0.2s;
35+
}
36+
.icon-item:hover {
37+
transform: translateY(-3px);
38+
box-shadow: 0 4px 8px rgba(0,0,0,0.1);
39+
}
40+
.icon-svg {
41+
width: 32px;
42+
height: 32px;
43+
margin-bottom: 8px;
44+
display: flex;
45+
align-items: center;
46+
justify-content: center;
47+
}
48+
.icon-svg svg {
49+
width: 24px;
50+
height: 24px;
51+
}
52+
.icon-name {
53+
font-size: 12px;
54+
text-align: center;
55+
color: #555;
56+
white-space: nowrap;
57+
overflow: hidden;
58+
text-overflow: ellipsis;
59+
width: 100%;
60+
}
61+
.header {
62+
display: flex;
63+
flex-direction: column;
64+
align-items: center;
65+
margin-bottom: 20px;
66+
}
67+
.subtitle {
68+
margin-top: 5px;
69+
color: #777;
70+
font-size: 16px;
71+
margin-bottom: 20px;
72+
}
73+
74+
/* Pixel art styling */
75+
svg {
76+
shape-rendering: crispEdges;
77+
}
78+
</style>
79+
</head>
80+
<body>
81+
<div class="header">
82+
<h1>Pixelarticons React</h1>
83+
<p class="subtitle">A collection of pixel-perfect icons for React</p>
84+
</div>
85+
86+
<div class="gallery" id="gallery">
87+
<!-- Icons will be inserted here -->
88+
</div>
89+
90+
<script>
91+
// List to hold all icon names
92+
let allIcons = [];
93+
94+
// Fetch all available icons first
95+
async function fetchAllIcons() {
96+
try {
97+
const response = await fetch('../svg/index.json');
98+
if (response.ok) {
99+
// Try to load from index.json if available
100+
const data = await response.json();
101+
allIcons = data.map(icon => {
102+
// Convert filename to display name (remove .svg extension)
103+
const name = icon.replace(/\.svg$/, '');
104+
return name;
105+
});
106+
} else {
107+
// Fallback to our predefined list
108+
console.warn("Could not load icon index file, using predefined list");
109+
allIcons = displayIcons;
110+
}
111+
} catch (error) {
112+
console.error("Error loading icons:", error);
113+
allIcons = displayIcons;
114+
}
115+
}
116+
117+
// Define mapping for icons with different display name vs filename
118+
const specialIconMappings = {
119+
'settings': 'sliders.svg',
120+
'unlock': 'lock-open.svg',
121+
'phone': 'device-phone.svg'
122+
// Add more mappings as needed
123+
};
124+
125+
// Predefined list of common icons (for fallback)
126+
const displayIcons = [
127+
'user', 'heart', 'home', 'settings', 'notification', 'search',
128+
'calendar', 'mail', 'camera', 'cart', 'credit-card', 'download',
129+
'upload', 'lock', 'unlock', 'file', 'folder', 'trash',
130+
'edit', 'plus', 'minus', 'check', 'close', 'alert',
131+
'info-box', 'warning-box', 'lightbulb', 'map', 'phone', 'chat',
132+
'picture-in-picture', 'image', 'video', 'music', 'coffee', 'gift',
133+
'moon', 'sun', 'star', 'bookmark', 'pin', 'link',
134+
'github', 'globe', 'battery', 'cloud', 'compass', 'filter',
135+
'flag', 'chart', 'eye', 'fire', 'flash', 'key',
136+
'layers', 'layout', 'list', 'map-pin', 'menu', 'monitor',
137+
'package', 'paperclip', 'save', 'share', 'shield', 'shopping-bag',
138+
'tag', 'thumbs-up', 'trending-up', 'wifi', 'zap'
139+
];
140+
141+
// Predefined SVG content for common icons (fallback)
142+
const fallbackSvgs = {
143+
'user': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M12 11C14.2091 11 16 9.20914 16 7C16 4.79086 14.2091 3 12 3C9.79086 3 8 4.79086 8 7C8 9.20914 9.79086 11 12 11Z"/><path d="M12 14C8.13401 14 5 17.134 5 21H19C19 17.134 15.866 14 12 14Z"/></svg>',
144+
'heart': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M7 3C4.23858 3 2 5.23858 2 8C2 15 12 21 12 21C12 21 22 15 22 8C22 5.23858 19.7614 3 17 3C15.4459 3 14.0656 3.78074 13.2597 5H10.7403C9.93435 3.78074 8.55414 3 7 3Z"/></svg>',
145+
'home': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M5 12.5V20H19V12.5"/><path d="M2 10L12 3L22 10"/></svg>',
146+
'check': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M21 6L8.625 18L3 12.5455"/></svg>',
147+
'close': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M18 6L6 18"/><path d="M6 6L18 18"/></svg>',
148+
'plus': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M5 12H19"/><path d="M12 5V19"/></svg>',
149+
'minus': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs"><path d="M5 12H19"/></svg>'
150+
};
151+
152+
// Load SVG file content
153+
async function loadSvg(name) {
154+
// Check if this icon has a special mapping
155+
let svgFile = `${name}.svg`;
156+
if (specialIconMappings[name]) {
157+
svgFile = specialIconMappings[name];
158+
}
159+
160+
try {
161+
const response = await fetch(`../svg/${svgFile}`);
162+
163+
if (!response.ok) {
164+
console.warn(`Failed to load SVG for ${name}: ${svgFile}`, response.statusText);
165+
return fallbackSvgs[name] || null;
166+
}
167+
168+
return await response.text();
169+
} catch (error) {
170+
console.error(`Error loading SVG for ${name}:`, error);
171+
return fallbackSvgs[name] || null;
172+
}
173+
}
174+
175+
// Create icon grid
176+
async function createIcons() {
177+
const gallery = document.getElementById('gallery');
178+
let loadedCount = 0;
179+
180+
// Use all icons if available, otherwise fall back to display icons
181+
const iconList = allIcons.length > 0 ? allIcons : displayIcons;
182+
183+
for (const name of iconList) {
184+
const item = document.createElement('div');
185+
item.className = 'icon-item';
186+
187+
const iconSvg = document.createElement('div');
188+
iconSvg.className = 'icon-svg';
189+
190+
// Load SVG from file
191+
const svgContent = await loadSvg(name);
192+
if (svgContent) {
193+
iconSvg.innerHTML = svgContent;
194+
loadedCount++;
195+
} else {
196+
// Fallback to a simple square for missing icons
197+
iconSvg.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square" stroke-linejoin="arcs">
198+
<rect x="4" y="4" width="16" height="16" />
199+
</svg>`;
200+
}
201+
202+
const iconName = document.createElement('div');
203+
iconName.className = 'icon-name';
204+
iconName.textContent = name;
205+
206+
item.appendChild(iconSvg);
207+
item.appendChild(iconName);
208+
gallery.appendChild(item);
209+
}
210+
211+
// Add icon count to the subtitle
212+
const subtitle = document.querySelector('.subtitle');
213+
subtitle.textContent = `A collection of pixel-perfect icons for React (${loadedCount}/${iconList.length} loaded)`;
214+
}
215+
216+
// Initialize icon grid
217+
document.addEventListener('DOMContentLoaded', async () => {
218+
await fetchAllIcons();
219+
createIcons();
220+
});
221+
</script>
222+
</body>
223+
</html>

0 commit comments

Comments
 (0)