11# Polylang React Library
22
3- A unified package of React components, icons , and utilities for Polylang projects, optimized for WordPress Gutenberg integration.
3+ A unified package of icons, hooks , and utilities for Polylang projects, optimized for WordPress Gutenberg integration.
44
55## 📦 What's Included
66
7- - ** React Components** - UI components like ` LanguageDropdown ` and ` LanguageFlag `
8- - ** SVG Icons** - Complete icon library for Polylang Pro
9- - ** API Middlewares** - WordPress REST API filtering utilities
7+ - ** SVG Icons** - Complete icon library for Polylang projects
108- ** React Hooks** - Custom hooks for language management and state handling
9+ - ** API Middlewares** - WordPress REST API filtering utilities
1110
1211## 🚀 Installation
1312
@@ -23,27 +22,6 @@ The package automatically builds during installation via the `prepare` script. T
2322
2423## 💻 Usage
2524
26- ### Components
27-
28- ``` javascript
29- import { LanguageDropdown , LanguageFlag } from ' @wpsyntex/polylang-react-library' ;
30-
31- function MyComponent () {
32- const languages = new Map ( [
33- [ ' en' , { slug: ' en' , name: ' English' , flag_url: ' ...' } ],
34- [ ' fr' , { slug: ' fr' , name: ' Français' , flag_url: ' ...' } ],
35- ] );
36-
37- return (
38- < LanguageDropdown
39- handleChange= { ( slug ) => console .log ( slug ) }
40- languages= { languages }
41- selectedLanguage= { languages .get ( ' en' ) }
42- / >
43- );
44- }
45- ```
46-
4725### Icons
4826
4927``` javascript
@@ -56,7 +34,6 @@ import {
5634 trash ,
5735 star ,
5836 SubmenuIcon ,
59- DefaultLangIcon ,
6037} from ' @wpsyntex/polylang-react-library' ;
6138
6239function MyToolbar () {
@@ -132,11 +109,6 @@ npm run lint:fix # Fix automatically
132109
133110## 📋 Available Exports
134111
135- ### Components
136- - ` LanguageDropdown` - Dropdown selector for languages
137- - ` LanguageFlag` - Flag display component
138-
139- ### Icons
140112- ` duplication` - Copy/duplicate icon
141113- ` pencil` - Edit icon
142114- ` plus` - Add/create icon
@@ -145,7 +117,6 @@ npm run lint:fix # Fix automatically
145117- ` trash` - Delete icon
146118- ` star` - Favorite/default icon
147119- ` SubmenuIcon` - Submenu navigation icon
148- - ` DefaultLangIcon` - Default language indicator
149120
150121### Middlewares
151122- ` editorsRequestsFilter` - Filter WordPress editor requests
@@ -166,11 +137,9 @@ npm run lint:fix # Fix automatically
166137This package requires the following peer dependencies (provided by consuming projects):
167138
168139- ` @wordpress/ api- fetch` >= 7.0.0
169- - ` @wordpress/ components` >= 27.0.0
170140- ` @wordpress/ data` >= 10.0.0
171141- ` @wordpress/ editor` >= 14.0.0
172142- ` @wordpress/ element` >= 6.0.0
173- - ` @wordpress/ i18n` >= 5.0.0
174143- ` @wordpress/ primitives` >= 4.0.0
175144- ` lodash` >= 4.17.0
176145- ` react` >= 17.0.0
0 commit comments