pal-city-icons
v1.0.2
Published
Shared icon library for Pal-City Web and Mobile
Readme
Pal-City Icons
A unified, shared SVG icon library built for the Pal-City ecosystem. This package serves as a single source of truth for all icons, exposing thin, compiled wrappers for both React (Web) and React Native (Expo).
Architecture
This project uses @svgr/cli to automatically convert raw .svg files into functional React/React Native components.
svgs/: The single source of truth. Drop raw standard.svgfiles here.src/web/: Auto-generated standard React components.src/native/: Auto-generated React Native (react-native-svg) components.
How to Add a New Icon
Obtain the SVG
Export or download your icon as an.svgfile (e.g., from Figma or an icon library).Add to Repository
Place the.svgfile directly into thesvgs/folder in this repository. Give it a PascalCase name for consistency, likeUserAvatar.svgorHomeIcon.svg.Build the Components
Run the build script to auto-generate the wrappers.npm run buildVerify
Check thesrc/anddist/folders to verify that the TypeScript components and compiled JavaScript have been updated.
How to Use in Projects
Once published, you can install the library in any Pal-City project:
npm install pal-city-iconsFor React (Next.js / Vite / Web):
import { HomeIcon } from 'pal-city-icons';
export default function MyComponent() {
return <HomeIcon width={24} height={24} />;
}For React Native (Expo):
import { HomeIcon } from 'pal-city-icons';
export default function MyScreen() {
return <HomeIcon width={24} height={24} />;
}How to Publish to npm
Whenever you add new icons or make changes, you need to publish a new version to npm.
- Update the Version: Manually increment the
"version"field inpackage.json(e.g., change"1.0.0"to"1.0.1"). - Log into npm: (If you haven't already on your machine)
npm login - Publish:
npm publish
(Note: You do not need to run npm run build before publishing. The package.json contains a prepublishOnly script that will automatically trigger the build process for you before uploading.)
Available Scripts
npm run build: Cleans old builds, generates new React/Native components from SVGs, and compiles them via TypeScript.npm run generate: Only generates the wrapper components in thesrc/folder.npm run clean: Deletes the auto-generatedsrc/anddist/folders.
