filter-button 0.1.0 → 0.2.1

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
@@ -1,9 +1,10 @@
1
-
2
1
  # Filter Button
3
2
 
4
3
  ## About
5
4
 
6
- ![App Screenshot](./assets/demo.gif)
5
+ ![App Screenshot](https://github.com/kalpesh442266/Filter-Button/blob/master/assets/demo.gif)
6
+
7
+ <!-- ![App Screenshot](./assets//demo.gif) -->
7
8
 
8
9
  This package provides a custom field for Strapi that lets you add a filter button in no time.
9
10
 
@@ -11,34 +12,39 @@ Custom fields are supported since Strapi 4.4+ and offer powerful API to create h
11
12
 
12
13
  This plugin lets you view filtered data according to your configurations.
13
14
 
14
-
15
- Installation
16
-
17
15
  ## Installation
18
16
 
19
17
  To install this plugin, you need to add an NPM dependency to your Strapi application:
18
+
20
19
  #### For NPM:
20
+
21
21
  ```bash
22
22
  npm i filter-button
23
23
  ```
24
+
24
25
  #### For Yarn:
26
+
25
27
  ```bash
26
28
  yarn add filter-button
27
29
  ```
28
30
 
29
31
  Now we need to register plugin so strapi can use it. In order to do that we need to create (if not already created) ./config/plugins.js file and add entry to it.
32
+
30
33
  ```bash
34
+ module.exports = {
31
35
  'filter-button': {
32
36
  enabled: true,
33
- }
37
+ },
38
+ }
34
39
  ```
35
40
 
36
- ## Configuration
41
+ ## Configuration
42
+
37
43
  #### create relations first for filter button to work
38
- if relation is many to many then add boolean ```manyToMany:true``` in configuration
39
44
 
40
- Add webpack.config.js file into src/admin and paste this content there.
45
+ if relation is many to many then add boolean `manyToMany:true` in configuration
41
46
 
47
+ Add webpack.config.js file into src/admin and paste this content there.
42
48
 
43
49
  ```bash
44
50
  'use strict';
@@ -79,17 +85,22 @@ module.exports = (config, webpack) => {
79
85
 
80
86
  ```
81
87
 
82
- ### Then Run build:
88
+ #### Then run build:
89
+
83
90
  #### For NPM:
91
+
84
92
  ```bash
85
- npm run bild
93
+ npm run build
86
94
  ```
95
+
87
96
  #### For Yarn:
97
+
88
98
  ```bash
89
- yarn bild
99
+ yarn build
90
100
  ```
101
+
91
102
  ## How To Use
92
103
 
93
- 1. Once all necessary configuration is done, create a elation between ```from``` and ```to``` collections.
104
+ 1. Once all necessary configuration is done, create a elation between `from` and `to` collections.
94
105
  2. Add button from custom fields
95
- 3. make sure ```attributeName``` is matching with configurations while creating custom field
106
+ 3. make sure `attributeName` is matching with configurations while creating custom field
@@ -18,7 +18,7 @@ const ButtonComponent = ({ name }) => {
18
18
 
19
19
  const { uid } = allLayoutData.contentType;
20
20
  const currentCollection = CONTENT_TYPES?.filter(data => { if (data?.from === uid && data?.attributeName === name) return data })[0]
21
- console.log(currentCollection)
21
+
22
22
  const filterCards = () => {
23
23
  history.push(`/content-manager/collectionType/${currentCollection?.to}?page=1&pageSize=10&sort=${currentCollection?.filterBy}:ASC&filters[$and][0][${currentCollection?.manyToMany ? currentCollection?.from?.split('.')[1] + 's' : currentCollection?.from?.split('.')[1]}][${currentCollection?.filterBy}][$eq]=${modifiedData?.title}`)
24
24
  }
package/package.json CHANGED
@@ -1,13 +1,23 @@
1
1
  {
2
2
  "name": "filter-button",
3
- "version": "0.1.0",
4
- "description": "This is the description of the plugin.",
3
+ "version": "0.2.1",
4
+ "private": false,
5
+ "description": "Custom filter button plugin for strapi",
5
6
  "strapi": {
6
7
  "name": "filter-button",
7
- "description": "Description of Filter Button plugin",
8
+ "description": "Custom filter button plugin for strapi",
8
9
  "kind": "plugin",
9
10
  "displayName": "Filter Button"
10
11
  },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/kalpesh442266/Filter-Button"
15
+ },
16
+ "keywords": [
17
+ "filter-button",
18
+ "strapi custom field",
19
+ "strapi filter button field"
20
+ ],
11
21
  "dependencies": {},
12
22
  "author": {
13
23
  "name": "A Strapi developer"
@@ -22,4 +32,4 @@
22
32
  "npm": ">=6.0.0"
23
33
  },
24
34
  "license": "MIT"
25
- }
35
+ }