@scaleflex/widget-pixaforge 0.0.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/CHANGELOG.md +7423 -0
- package/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/style.css +260 -0
- package/dist/style.min.css +1 -0
- package/lib/api.service.js +93 -0
- package/lib/common.slice.js +77 -0
- package/lib/components/CategoriesCards/CategoryCard.js +33 -0
- package/lib/components/CategoriesCards/index.js +48 -0
- package/lib/components/CategoriesCards/index.scss +27 -0
- package/lib/components/CustomizeIcons/ColorCustomization.js +159 -0
- package/lib/components/CustomizeIcons/index.js +105 -0
- package/lib/components/CustomizeIcons/index.scss +33 -0
- package/lib/components/GalleryViewsOptionsMenu.js +97 -0
- package/lib/components/IconsGallery/SingleIcon.js +49 -0
- package/lib/components/IconsGallery/index.js +153 -0
- package/lib/components/IconsGallery/index.scss +53 -0
- package/lib/components/ImagesGallery/ImageCell.js +59 -0
- package/lib/components/ImagesGallery/LandscapesContainer.js +28 -0
- package/lib/components/ImagesGallery/PortraitsColumns.js +72 -0
- package/lib/components/ImagesGallery/index.js +183 -0
- package/lib/components/ImagesGallery/index.scss +120 -0
- package/lib/components/MainView.js +102 -0
- package/lib/components/TagsAndFoundLabel/TagItem.js +23 -0
- package/lib/components/TagsAndFoundLabel/index.js +72 -0
- package/lib/components/TagsAndFoundLabel/index.scss +25 -0
- package/lib/components/TopBar.js +113 -0
- package/lib/components/index.scss +48 -0
- package/lib/constants.js +19 -0
- package/lib/defaultLocale.js +22 -0
- package/lib/index.js +327 -0
- package/lib/style.scss +8 -0
- package/package.json +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 scaleflex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# @scaleflex/widget-pixaforge
|
|
2
|
+
|
|
3
|
+
[![Plugins][plugins-image]](#plugins)
|
|
4
|
+
[![Website][filerobot-image]][sfx-url]
|
|
5
|
+
[![Version][filerobot-version]][version-url]
|
|
6
|
+
[![Scaleflex team][made-by-image]][sfx-url]
|
|
7
|
+
[![License][license-image]][license-url]
|
|
8
|
+
[![CodeSandbox][codeSandbox-image]][codeSandbox-url]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
<div align='center'>
|
|
12
|
+
<img title="Scaleflex Widget logo" alt="Scaleflex Widget logo" src="https://cdn.scaleflex.com/plugins/filerobot-widget/assets/filerobot_widget_logo_with_fire.png?vh=b2ff09" width="140"/>
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
Import free images & icons from Pixaforge in [Scaleflex Media Asset Widget](https://www.npmjs.com/package/@scaleflex/widget-core) that has free gallery for both.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### NPM
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install --save @scaleflex/widget-pixaforge
|
|
23
|
+
```
|
|
24
|
+
### YARN
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
yarn add @scaleflex/widget-pixaforge
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
then
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import Pixaforge from '@scaleflex/widget-pixaforge'
|
|
34
|
+
...
|
|
35
|
+
...
|
|
36
|
+
...
|
|
37
|
+
scaleflexWidget.use(Pixaforge, propertiesObject)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### CDN
|
|
41
|
+
|
|
42
|
+
The plugin from CDN is found inside `Scaleflex` global object `Scaleflex.Pixaforge`
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const Pixaforge = window.ScaleflexWidget.Pixaforge
|
|
46
|
+
...
|
|
47
|
+
...
|
|
48
|
+
...
|
|
49
|
+
scaleflexWidget.use(Pixaforge, propertiesObject)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Plugin's styles
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
import '@scaleflex/widget-core/dist/style.css'
|
|
56
|
+
import '@scaleflex/widget-pixaforge/dist/style.css'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
or if you prefer the minified version
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import '@scaleflex/widget-core/dist/style.min.css'
|
|
63
|
+
import '@scaleflex/widget-pixaforge/dist/style.min.css'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> The plugin's css file should be imported after the [Core's css file](../@scaleflex/widget-core/#modules-styles) for having the styles shown correctly.
|
|
67
|
+
|
|
68
|
+
## Properties
|
|
69
|
+
|
|
70
|
+
### `title`
|
|
71
|
+
|
|
72
|
+
<u>Type:</u> `string`
|
|
73
|
+
|
|
74
|
+
<u>Default:</u> `'Pixaforge'`
|
|
75
|
+
|
|
76
|
+
The title/label that would be shown & used for the plugin.
|
|
77
|
+
|
|
78
|
+
### `companionHeaders`
|
|
79
|
+
|
|
80
|
+
<u>Type:</u> `null` | `object`
|
|
81
|
+
|
|
82
|
+
<u>Default:</u> `null`
|
|
83
|
+
|
|
84
|
+
If you need to pass additional headers for in companion requests then pass them in this property(used in importing the images from pixaforge).
|
|
85
|
+
|
|
86
|
+
### `locale: object`
|
|
87
|
+
|
|
88
|
+
<u>Type:</u> `object`
|
|
89
|
+
|
|
90
|
+
<u>Default:</u> locales from scaleflexWidget's backend then default locale file with all labels is under `lib/defaultLocale.js`.
|
|
91
|
+
|
|
92
|
+
You can override some labels by specifying a translation object here, such as:
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
{
|
|
96
|
+
strings: {
|
|
97
|
+
standardPortraits: 'Standard verticals' // overrides the default Standard portraits value to standard verticals
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### `noIconsGallery`
|
|
103
|
+
|
|
104
|
+
<u>Type:</u> `boolean`
|
|
105
|
+
|
|
106
|
+
<u>Default:</u> `false`
|
|
107
|
+
|
|
108
|
+
If used the icons gallery option will be removed from the plugin and only images will be available.
|
|
109
|
+
|
|
110
|
+
<!-- Variables -->
|
|
111
|
+
|
|
112
|
+
[npm-url]: https://www.npmjs.com/package/@scaleflex/widget-pixaforge
|
|
113
|
+
[license-url]: https://opensource.org/licenses/MIT
|
|
114
|
+
[sfx-url]: https://www.scaleflex.com/
|
|
115
|
+
[version-url]: https://www.npmjs.com/package/@scaleflex/widget-pixaforge
|
|
116
|
+
[codeSandbox-url]: https://codesandbox.io/s/filerobot-widget-v3-c5l9th
|
|
117
|
+
|
|
118
|
+
[npm-image]: https://img.shields.io/npm/v/@telus/remark-config.svg?style=for-the-badge&logo=npm
|
|
119
|
+
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge
|
|
120
|
+
[made-by-image]: https://img.shields.io/badge/%3C%2F%3E%20with%20%E2%99%A5%20by-the%20Scaleflex%20team-6986fa.svg?style=for-the-badge
|
|
121
|
+
[plugins-image]: https://img.shields.io/static/v1?label=Scaleflex&message=Plugins&color=yellow&style=for-the-badge
|
|
122
|
+
[filerobot-image]: https://img.shields.io/static/v1?label=Scaleflex&message=website&color=orange&style=for-the-badge
|
|
123
|
+
[filerobot-version]: https://img.shields.io/npm/v/@scaleflex/widget-pixaforge?label=Version&style=for-the-badge&logo=npm
|
|
124
|
+
[codeSandbox-image]: https://img.shields.io/badge/CodeSandbox-black?style=for-the-badge&logo=CodeSandbox
|
package/dist/style.css
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");
|
|
2
|
+
.filerobot-Pixaforge-MainView {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
height: 100%; }
|
|
6
|
+
.filerobot-Pixaforge-MainView img {
|
|
7
|
+
-webkit-user-select: none;
|
|
8
|
+
-moz-user-select: none;
|
|
9
|
+
user-select: none; }
|
|
10
|
+
|
|
11
|
+
.filerobot-Pixaforge-TopBar {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
padding: 12px;
|
|
15
|
+
background: #F8FAFB;
|
|
16
|
+
border-bottom: 1px solid #eaeaea; }
|
|
17
|
+
.filerobot-Pixaforge-TopBar > div:nth-child(2) {
|
|
18
|
+
min-width: calc(100% - 128px); }
|
|
19
|
+
|
|
20
|
+
.filerobot-Pixaforge-TopBar-gallerySelect {
|
|
21
|
+
max-width: 128px;
|
|
22
|
+
margin-right: 8px; }
|
|
23
|
+
|
|
24
|
+
.filerobot-Pixaforge-TopBar-galleryOption {
|
|
25
|
+
display: flex; }
|
|
26
|
+
|
|
27
|
+
.filerobot-Pixaforge-Topbar-galleryIcon {
|
|
28
|
+
width: 16px;
|
|
29
|
+
height: 16px;
|
|
30
|
+
margin-right: 8px;
|
|
31
|
+
color: #5D6D7E; }
|
|
32
|
+
|
|
33
|
+
.filerobot-Pixaforge-overlay {
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: 4px;
|
|
36
|
+
bottom: 4px;
|
|
37
|
+
left: 4px;
|
|
38
|
+
right: 4px;
|
|
39
|
+
display: none;
|
|
40
|
+
z-index: 100; }
|
|
41
|
+
.filerobot-Pixaforge-overlay * {
|
|
42
|
+
color: #fff; }
|
|
43
|
+
|
|
44
|
+
.filerobot-Pixaforge-Categories {
|
|
45
|
+
display: grid;
|
|
46
|
+
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
|
|
47
|
+
padding: 8px 8px 4px;
|
|
48
|
+
overflow: auto; }
|
|
49
|
+
|
|
50
|
+
.filerobot-Pixaforge-CategoryCard {
|
|
51
|
+
cursor: pointer;
|
|
52
|
+
padding: 4px 4px 8px;
|
|
53
|
+
width: 100%; }
|
|
54
|
+
|
|
55
|
+
.filerobot-Pixaforge-CategoryCard-image {
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 120px; }
|
|
58
|
+
.filerobot-Pixaforge-CategoryCard-image img {
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 100%;
|
|
61
|
+
border-radius: 2px; }
|
|
62
|
+
|
|
63
|
+
.filerobot-Pixaforge-CategoryCard-label {
|
|
64
|
+
margin: 4px 0 2px;
|
|
65
|
+
font-size: 12px;
|
|
66
|
+
line-height: 14px; }
|
|
67
|
+
|
|
68
|
+
.filerobot-Pixaforge-TagsAndFoundLabel {
|
|
69
|
+
margin: 12px 12px 4px; }
|
|
70
|
+
|
|
71
|
+
.filerobot-Pixaforge-TagsAndFoundLabel-foundLabel {
|
|
72
|
+
display: inline-block; }
|
|
73
|
+
|
|
74
|
+
.filerobot-Pixaforge-TagsAndFoundLabel-tags {
|
|
75
|
+
margin-left: 6px;
|
|
76
|
+
margin-right: 4px;
|
|
77
|
+
display: inline; }
|
|
78
|
+
|
|
79
|
+
.filerobot-Pixaforge-TagItem {
|
|
80
|
+
margin: 2px;
|
|
81
|
+
cursor: pointer; }
|
|
82
|
+
.filerobot-Pixaforge-TagItem span {
|
|
83
|
+
border: 1px solid #92A6BC !important; }
|
|
84
|
+
|
|
85
|
+
.filerobot-Pixaforge-TagsAndFoundLabel-showMoreLabel {
|
|
86
|
+
display: inline-flex;
|
|
87
|
+
margin-left: 8px;
|
|
88
|
+
margin-top: 2px; }
|
|
89
|
+
|
|
90
|
+
@keyframes imgPlaceholderSkeleton {
|
|
91
|
+
0% {
|
|
92
|
+
background-position: -468px 0; }
|
|
93
|
+
100% {
|
|
94
|
+
background-position: 468px 0; } }
|
|
95
|
+
|
|
96
|
+
.filerobot-Pixaforge-ImagesGallery {
|
|
97
|
+
display: flex;
|
|
98
|
+
flex-direction: column;
|
|
99
|
+
overflow: auto; }
|
|
100
|
+
|
|
101
|
+
.filerobot-Pixaforge-ImagesGallery-imagesWrapper {
|
|
102
|
+
display: flex;
|
|
103
|
+
padding: 8px 8px 4px;
|
|
104
|
+
overflow: auto;
|
|
105
|
+
height: 100%;
|
|
106
|
+
width: 100%; }
|
|
107
|
+
.filerobot-Pixaforge-ImagesGallery-imagesWrapper .filerobot-c-empty {
|
|
108
|
+
justify-content: center;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: 16px;
|
|
111
|
+
font-size: 16px; }
|
|
112
|
+
|
|
113
|
+
.filerobot-Pixaforge-PortraitsColumn {
|
|
114
|
+
margin: 0 4px;
|
|
115
|
+
flex-grow: 1; }
|
|
116
|
+
|
|
117
|
+
.filerobot-Pixaforge-ImageCell {
|
|
118
|
+
margin-bottom: 8px;
|
|
119
|
+
position: relative;
|
|
120
|
+
cursor: pointer; }
|
|
121
|
+
.filerobot-Pixaforge-ImageCell.filerobot-Pixaforge-ImageCell--selected .filerobot-Pixaforge-overlay, .filerobot-Pixaforge-ImageCell:hover .filerobot-Pixaforge-overlay {
|
|
122
|
+
display: block; }
|
|
123
|
+
.filerobot-Pixaforge-ImageCell.filerobot-Pixaforge-ImageCell--selected img, .filerobot-Pixaforge-ImageCell:hover img {
|
|
124
|
+
filter: brightness(0.8); }
|
|
125
|
+
.filerobot-Pixaforge-ImageCell:hover .filerobot-Pixaforge-ImageCell-imageInfo {
|
|
126
|
+
display: block; }
|
|
127
|
+
|
|
128
|
+
.filerobot-Pixaforge-ImageCell-imageWrapper {
|
|
129
|
+
width: 100%;
|
|
130
|
+
height: 100%;
|
|
131
|
+
animation-duration: 1s;
|
|
132
|
+
animation-fill-mode: forwards;
|
|
133
|
+
animation-iteration-count: infinite;
|
|
134
|
+
animation-name: imgPlaceholderSkeleton;
|
|
135
|
+
animation-timing-function: linear;
|
|
136
|
+
background: #F8FAFB;
|
|
137
|
+
background-image: linear-gradient(to right, #F8FAFB 0%, #f1f3f6 30%, #F8FAFB 90%, #F8FAFB 100%);
|
|
138
|
+
background-repeat: no-repeat; }
|
|
139
|
+
.filerobot-Pixaforge-ImageCell-imageWrapper img {
|
|
140
|
+
border-radius: 2px;
|
|
141
|
+
max-width: 100%;
|
|
142
|
+
filter: drop-shadow(0px 1px 2px rgba(78, 77, 77, 0.15)); }
|
|
143
|
+
|
|
144
|
+
.filerobot-Pixaforge-ImageCell-imageInfo {
|
|
145
|
+
display: none; }
|
|
146
|
+
|
|
147
|
+
.filerobot-Pixaforge-ImageCell-authorAndTitle {
|
|
148
|
+
text-align: right;
|
|
149
|
+
position: absolute;
|
|
150
|
+
width: 80%;
|
|
151
|
+
top: 0;
|
|
152
|
+
right: 0; }
|
|
153
|
+
.filerobot-Pixaforge-ImageCell-authorAndTitle div {
|
|
154
|
+
font-size: 10px;
|
|
155
|
+
line-height: 12px; }
|
|
156
|
+
|
|
157
|
+
.filerobot-Pixaforge-ImageCell-author {
|
|
158
|
+
font-weight: 700;
|
|
159
|
+
margin-bottom: 4px; }
|
|
160
|
+
|
|
161
|
+
.filerobot-Pixaforge-ImageCell-imageMeta {
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
justify-content: space-between;
|
|
165
|
+
position: absolute;
|
|
166
|
+
width: 100%;
|
|
167
|
+
bottom: 0; }
|
|
168
|
+
.filerobot-Pixaforge-ImageCell-imageMeta span {
|
|
169
|
+
font-size: 11px;
|
|
170
|
+
line-height: 12px;
|
|
171
|
+
text-align: center; }
|
|
172
|
+
|
|
173
|
+
.filerobot-Pixaforge-LandscapesContainer {
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-wrap: wrap; }
|
|
176
|
+
|
|
177
|
+
.filerobot-Pixaforge-LandscapesContainer .filerobot-Pixaforge-ImageCell {
|
|
178
|
+
margin: 4px;
|
|
179
|
+
flex-grow: 1;
|
|
180
|
+
height: 160px;
|
|
181
|
+
max-height: 160px; }
|
|
182
|
+
.filerobot-Pixaforge-LandscapesContainer .filerobot-Pixaforge-ImageCell img {
|
|
183
|
+
max-height: 100%;
|
|
184
|
+
width: 100%;
|
|
185
|
+
-o-object-fit: cover;
|
|
186
|
+
object-fit: cover; }
|
|
187
|
+
|
|
188
|
+
.filerobot-Pixaforge-IconsGallery {
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-direction: column;
|
|
191
|
+
overflow: auto; }
|
|
192
|
+
|
|
193
|
+
.filerobot-Pixaforge-IconsGallery-icons {
|
|
194
|
+
display: flex;
|
|
195
|
+
padding: 8px;
|
|
196
|
+
overflow: auto;
|
|
197
|
+
flex-wrap: wrap; }
|
|
198
|
+
|
|
199
|
+
.filerobot-Pixaforge-SingleIcon {
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
position: relative;
|
|
202
|
+
width: 106px;
|
|
203
|
+
height: 106px;
|
|
204
|
+
display: flex;
|
|
205
|
+
justify-content: center;
|
|
206
|
+
align-items: center;
|
|
207
|
+
background-color: #F8FAFB;
|
|
208
|
+
margin: 4px; }
|
|
209
|
+
.filerobot-Pixaforge-SingleIcon:hover {
|
|
210
|
+
background-color: #EFF3F6; }
|
|
211
|
+
.filerobot-Pixaforge-SingleIcon:hover .filerobot-Pixaforge-overlay {
|
|
212
|
+
display: block; }
|
|
213
|
+
|
|
214
|
+
.filerobot-Pixaforge-SingleIcon--selected {
|
|
215
|
+
background-color: #EFF3F6; }
|
|
216
|
+
.filerobot-Pixaforge-SingleIcon--selected .filerobot-Pixaforge-overlay {
|
|
217
|
+
display: block; }
|
|
218
|
+
|
|
219
|
+
.filerobot-Pixaforge-SingleIcon-icon {
|
|
220
|
+
width: 50px;
|
|
221
|
+
height: 50px;
|
|
222
|
+
max-width: 50px;
|
|
223
|
+
max-height: 50px;
|
|
224
|
+
display: flex;
|
|
225
|
+
align-items: center;
|
|
226
|
+
justify-content: center;
|
|
227
|
+
color: #5D6D7E; }
|
|
228
|
+
.filerobot-Pixaforge-SingleIcon-icon svg {
|
|
229
|
+
max-width: 100%;
|
|
230
|
+
max-height: 100%; }
|
|
231
|
+
|
|
232
|
+
.filerobot-Pixaforge-CustomizeIcons {
|
|
233
|
+
padding: 12px 8px 0;
|
|
234
|
+
display: flex;
|
|
235
|
+
flex-direction: column;
|
|
236
|
+
overflow: auto; }
|
|
237
|
+
|
|
238
|
+
.filerobot-Pixaforge-ColorCustomization {
|
|
239
|
+
margin: 0 4px; }
|
|
240
|
+
|
|
241
|
+
.filerobot-Pixaforge-CustomizedIcons-title {
|
|
242
|
+
margin: 0 0 12px 4px; }
|
|
243
|
+
.filerobot-Pixaforge-CustomizedIcons-title svg {
|
|
244
|
+
margin-left: 6px;
|
|
245
|
+
width: 12px;
|
|
246
|
+
height: 12px; }
|
|
247
|
+
|
|
248
|
+
.filerobot-Pixaforge-CustomizeIcons-iconsWrapper {
|
|
249
|
+
display: flex;
|
|
250
|
+
flex-wrap: wrap;
|
|
251
|
+
overflow: auto;
|
|
252
|
+
margin: 12px 0; }
|
|
253
|
+
|
|
254
|
+
.filerobot-Pixaforge-ColorCustomization-rgbField {
|
|
255
|
+
max-width: 80px;
|
|
256
|
+
margin-right: 4px; }
|
|
257
|
+
|
|
258
|
+
.filerobot-Pixaforge-ColorCustomization-removeButton {
|
|
259
|
+
display: inline-flex;
|
|
260
|
+
margin-left: 8px; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");.filerobot-Pixaforge-MainView{display:flex;flex-direction:column;height:100%}.filerobot-Pixaforge-MainView img{-webkit-user-select:none;-moz-user-select:none;user-select:none}.filerobot-Pixaforge-TopBar{align-items:center;background:#f8fafb;border-bottom:1px solid #eaeaea;display:flex;padding:12px}.filerobot-Pixaforge-TopBar>div:nth-child(2){min-width:calc(100% - 128px)}.filerobot-Pixaforge-TopBar-gallerySelect{margin-right:8px;max-width:128px}.filerobot-Pixaforge-TopBar-galleryOption{display:flex}.filerobot-Pixaforge-Topbar-galleryIcon{color:#5d6d7e;height:16px;margin-right:8px;width:16px}.filerobot-Pixaforge-overlay{bottom:4px;display:none;left:4px;position:absolute;right:4px;top:4px;z-index:100}.filerobot-Pixaforge-overlay *{color:#fff}.filerobot-Pixaforge-Categories{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));overflow:auto;padding:8px 8px 4px}.filerobot-Pixaforge-CategoryCard{cursor:pointer;padding:4px 4px 8px;width:100%}.filerobot-Pixaforge-CategoryCard-image{height:120px;width:100%}.filerobot-Pixaforge-CategoryCard-image img{border-radius:2px;height:100%;width:100%}.filerobot-Pixaforge-CategoryCard-label{font-size:12px;line-height:14px;margin:4px 0 2px}.filerobot-Pixaforge-TagsAndFoundLabel{margin:12px 12px 4px}.filerobot-Pixaforge-TagsAndFoundLabel-foundLabel{display:inline-block}.filerobot-Pixaforge-TagsAndFoundLabel-tags{display:inline;margin-left:6px;margin-right:4px}.filerobot-Pixaforge-TagItem{cursor:pointer;margin:2px}.filerobot-Pixaforge-TagItem span{border:1px solid #92a6bc!important}.filerobot-Pixaforge-TagsAndFoundLabel-showMoreLabel{display:inline-flex;margin-left:8px;margin-top:2px}@keyframes imgPlaceholderSkeleton{0%{background-position:-468px 0}to{background-position:468px 0}}.filerobot-Pixaforge-ImagesGallery{display:flex;flex-direction:column;overflow:auto}.filerobot-Pixaforge-ImagesGallery-imagesWrapper{display:flex;height:100%;overflow:auto;padding:8px 8px 4px;width:100%}.filerobot-Pixaforge-ImagesGallery-imagesWrapper .filerobot-c-empty{align-items:center;font-size:16px;gap:16px;justify-content:center}.filerobot-Pixaforge-PortraitsColumn{flex-grow:1;margin:0 4px}.filerobot-Pixaforge-ImageCell{cursor:pointer;margin-bottom:8px;position:relative}.filerobot-Pixaforge-ImageCell.filerobot-Pixaforge-ImageCell--selected .filerobot-Pixaforge-overlay,.filerobot-Pixaforge-ImageCell:hover .filerobot-Pixaforge-overlay{display:block}.filerobot-Pixaforge-ImageCell.filerobot-Pixaforge-ImageCell--selected img,.filerobot-Pixaforge-ImageCell:hover img{filter:brightness(.8)}.filerobot-Pixaforge-ImageCell:hover .filerobot-Pixaforge-ImageCell-imageInfo{display:block}.filerobot-Pixaforge-ImageCell-imageWrapper{animation-duration:1s;animation-fill-mode:forwards;animation-iteration-count:infinite;animation-name:imgPlaceholderSkeleton;animation-timing-function:linear;background:#f8fafb;background-image:linear-gradient(90deg,#f8fafb 0,#f1f3f6 30%,#f8fafb 90%,#f8fafb);background-repeat:no-repeat;height:100%;width:100%}.filerobot-Pixaforge-ImageCell-imageWrapper img{border-radius:2px;filter:drop-shadow(0 1px 2px rgba(78,77,77,.15));max-width:100%}.filerobot-Pixaforge-ImageCell-imageInfo{display:none}.filerobot-Pixaforge-ImageCell-authorAndTitle{position:absolute;right:0;text-align:right;top:0;width:80%}.filerobot-Pixaforge-ImageCell-authorAndTitle div{font-size:10px;line-height:12px}.filerobot-Pixaforge-ImageCell-author{font-weight:700;margin-bottom:4px}.filerobot-Pixaforge-ImageCell-imageMeta{align-items:center;bottom:0;display:flex;justify-content:space-between;position:absolute;width:100%}.filerobot-Pixaforge-ImageCell-imageMeta span{font-size:11px;line-height:12px;text-align:center}.filerobot-Pixaforge-LandscapesContainer{display:flex;flex-wrap:wrap}.filerobot-Pixaforge-LandscapesContainer .filerobot-Pixaforge-ImageCell{flex-grow:1;height:160px;margin:4px;max-height:160px}.filerobot-Pixaforge-LandscapesContainer .filerobot-Pixaforge-ImageCell img{max-height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.filerobot-Pixaforge-IconsGallery{display:flex;flex-direction:column;overflow:auto}.filerobot-Pixaforge-IconsGallery-icons{display:flex;flex-wrap:wrap;overflow:auto;padding:8px}.filerobot-Pixaforge-SingleIcon{align-items:center;background-color:#f8fafb;cursor:pointer;display:flex;height:106px;justify-content:center;margin:4px;position:relative;width:106px}.filerobot-Pixaforge-SingleIcon:hover{background-color:#eff3f6}.filerobot-Pixaforge-SingleIcon:hover .filerobot-Pixaforge-overlay{display:block}.filerobot-Pixaforge-SingleIcon--selected{background-color:#eff3f6}.filerobot-Pixaforge-SingleIcon--selected .filerobot-Pixaforge-overlay{display:block}.filerobot-Pixaforge-SingleIcon-icon{align-items:center;color:#5d6d7e;display:flex;height:50px;justify-content:center;max-height:50px;max-width:50px;width:50px}.filerobot-Pixaforge-SingleIcon-icon svg{max-height:100%;max-width:100%}.filerobot-Pixaforge-CustomizeIcons{display:flex;flex-direction:column;overflow:auto;padding:12px 8px 0}.filerobot-Pixaforge-ColorCustomization{margin:0 4px}.filerobot-Pixaforge-CustomizedIcons-title{margin:0 0 12px 4px}.filerobot-Pixaforge-CustomizedIcons-title svg{height:12px;margin-left:6px;width:12px}.filerobot-Pixaforge-CustomizeIcons-iconsWrapper{display:flex;flex-wrap:wrap;margin:12px 0;overflow:auto}.filerobot-Pixaforge-ColorCustomization-rgbField{margin-right:4px;max-width:80px}.filerobot-Pixaforge-ColorCustomization-removeButton{display:inline-flex;margin-left:8px}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
8
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
13
|
+
import { DEFAULT_ICONS_COLOR } from './constants';
|
|
14
|
+
var baseUrl = 'https://www.openpix.net/v3/';
|
|
15
|
+
var CDN_HOST_DOMAIN = '.cloudimg.io';
|
|
16
|
+
var CDN_URL = "https://scaleflex".concat(CDN_HOST_DOMAIN, "/v7/");
|
|
17
|
+
var categoriesImgsUrl = 'https://cdn.scaleflex.com/plugins/filerobot-widget/assets/categories.json?vh=ac2e9b&func=proxy';
|
|
18
|
+
|
|
19
|
+
// We didn't split them into thunks and reuse the apiClient from the redux store's middleware as it is not that bulky code.
|
|
20
|
+
var _send = function _send(endpoint) {
|
|
21
|
+
var method = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GET';
|
|
22
|
+
var data = arguments.length > 2 ? arguments[2] : undefined;
|
|
23
|
+
return new Promise(function (resolve, reject) {
|
|
24
|
+
var xhr = new XMLHttpRequest();
|
|
25
|
+
xhr.open(method, endpoint.startsWith('http') ? endpoint : "".concat(baseUrl).concat(endpoint));
|
|
26
|
+
xhr.responseType = 'json';
|
|
27
|
+
if (data) xhr.setRequestHeader('Content-Type', 'application/json');
|
|
28
|
+
xhr.onload = function () {
|
|
29
|
+
if (xhr.status >= 200 && xhr.status < 300) {
|
|
30
|
+
resolve(xhr.response);
|
|
31
|
+
} else {
|
|
32
|
+
reject(xhr.status);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
xhr.onerror = function () {
|
|
36
|
+
reject(xhr.status);
|
|
37
|
+
};
|
|
38
|
+
xhr.send(data ? JSON.stringify(data) : null);
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
export var getCategories = function getCategories() {
|
|
42
|
+
return Promise.all([_send('pictures/tags'), _send(categoriesImgsUrl)]).then(function (_ref) {
|
|
43
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
44
|
+
_ref2$ = _ref2[0],
|
|
45
|
+
categoriesResponse = _ref2$ === void 0 ? {} : _ref2$,
|
|
46
|
+
_ref2$2 = _ref2[1],
|
|
47
|
+
categoriesImages = _ref2$2 === void 0 ? {} : _ref2$2;
|
|
48
|
+
return (categoriesResponse.tags || []).map(function (category) {
|
|
49
|
+
return {
|
|
50
|
+
name: category.tag,
|
|
51
|
+
count: category.count,
|
|
52
|
+
image: "".concat(categoriesImages[category.tag] || categoriesImages["default"], "?w=170")
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
export var getImagesAndTags = function getImagesAndTags() {
|
|
58
|
+
var searchQueries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
59
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
60
|
+
var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
|
|
61
|
+
return _send("search?q[]=".concat(searchQueries.join('&q[]='), "&limit=").concat(limit, "&offset=").concat(offset)).then(function () {
|
|
62
|
+
var _response$images, _response$ratio, _response$related_tag, _response$count;
|
|
63
|
+
var response = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
64
|
+
return {
|
|
65
|
+
images: ((_response$images = response.images) !== null && _response$images !== void 0 ? _response$images : []).map(function (image) {
|
|
66
|
+
return _objectSpread(_objectSpread({}, image), {}, {
|
|
67
|
+
preview: image.src.includes(CDN_HOST_DOMAIN) ? "".concat(image.src, "?w=300") : "".concat(CDN_URL).concat(image.src, "?w=300")
|
|
68
|
+
});
|
|
69
|
+
}),
|
|
70
|
+
ratio: (_response$ratio = response.ratio) !== null && _response$ratio !== void 0 ? _response$ratio : 1,
|
|
71
|
+
tags: (_response$related_tag = response.related_tags) !== null && _response$related_tag !== void 0 ? _response$related_tag : [],
|
|
72
|
+
totalCount: (_response$count = response.count) !== null && _response$count !== void 0 ? _response$count : 0
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
export var getIconsAndTags = function getIconsAndTags() {
|
|
77
|
+
var searchQueries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
78
|
+
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
79
|
+
var limit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 50;
|
|
80
|
+
return _send("icons?q[]=".concat(searchQueries.join('&q[]='), "&style[]=MONOCOLOR&limit=").concat(limit, "&offset=").concat(offset)).then(function () {
|
|
81
|
+
var _response$icons, _response$related_tag2, _response$count2;
|
|
82
|
+
var response = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
83
|
+
return {
|
|
84
|
+
icons: ((_response$icons = response.icons) !== null && _response$icons !== void 0 ? _response$icons : []).map(function (i) {
|
|
85
|
+
return _objectSpread(_objectSpread({}, i), {}, {
|
|
86
|
+
color: DEFAULT_ICONS_COLOR
|
|
87
|
+
});
|
|
88
|
+
}),
|
|
89
|
+
tags: (_response$related_tag2 = response.related_tags) !== null && _response$related_tag2 !== void 0 ? _response$related_tag2 : [],
|
|
90
|
+
totalCount: (_response$count2 = response.count) !== null && _response$count2 !== void 0 ? _response$count2 : 0
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
8
|
+
import { PLUGINS_IDS } from '@scaleflex/widget-utils/lib/constants';
|
|
9
|
+
import { GALLERIES, IMAGES_GALLERY_VIEWS } from './constants';
|
|
10
|
+
var initialState = {
|
|
11
|
+
currentSelection: [],
|
|
12
|
+
customizedIcons: [],
|
|
13
|
+
gallery: GALLERIES.IMAGES,
|
|
14
|
+
galleryView: IMAGES_GALLERY_VIEWS.STANDARD_PORTRAITS,
|
|
15
|
+
loading: false
|
|
16
|
+
};
|
|
17
|
+
var commonSlice = createSlice({
|
|
18
|
+
name: PLUGINS_IDS.PIXAFORGE,
|
|
19
|
+
initialState: initialState,
|
|
20
|
+
reducers: {
|
|
21
|
+
currentSelectionsUpdated: function currentSelectionsUpdated(state, action) {
|
|
22
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
23
|
+
currentSelection: action.payload
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
customizedIconsUpdated: function customizedIconsUpdated(state, action) {
|
|
27
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
28
|
+
customizedIcons: action.payload
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
galleryChanged: function galleryChanged(state, action) {
|
|
32
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
33
|
+
gallery: action.payload
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
galleryViewChanged: function galleryViewChanged(state, action) {
|
|
37
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
38
|
+
galleryView: action.payload
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
loadingToggled: function loadingToggled(state, action) {
|
|
42
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
43
|
+
loading: !state.loading
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
pixaforgeCommonStateUpdated: function pixaforgeCommonStateUpdated(state, action) {
|
|
47
|
+
return _objectSpread(_objectSpread({}, state), action.payload);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
var _commonSlice$actions = commonSlice.actions,
|
|
52
|
+
currentSelectionsUpdated = _commonSlice$actions.currentSelectionsUpdated,
|
|
53
|
+
customizedIconsUpdated = _commonSlice$actions.customizedIconsUpdated,
|
|
54
|
+
galleryChanged = _commonSlice$actions.galleryChanged,
|
|
55
|
+
galleryViewChanged = _commonSlice$actions.galleryViewChanged,
|
|
56
|
+
loadingToggled = _commonSlice$actions.loadingToggled,
|
|
57
|
+
pixaforgeCommonStateUpdated = _commonSlice$actions.pixaforgeCommonStateUpdated;
|
|
58
|
+
export { currentSelectionsUpdated, customizedIconsUpdated, galleryChanged, galleryViewChanged, loadingToggled, pixaforgeCommonStateUpdated };
|
|
59
|
+
export var selectPixaforgeCommonState = function selectPixaforgeCommonState(state) {
|
|
60
|
+
return state[PLUGINS_IDS.PIXAFORGE];
|
|
61
|
+
};
|
|
62
|
+
export var selectCurrentSelection = function selectCurrentSelection(state) {
|
|
63
|
+
return selectPixaforgeCommonState(state).currentSelection;
|
|
64
|
+
};
|
|
65
|
+
export var selectCustomizedIcons = function selectCustomizedIcons(state) {
|
|
66
|
+
return selectPixaforgeCommonState(state).customizedIcons;
|
|
67
|
+
};
|
|
68
|
+
export var selectGallery = function selectGallery(state) {
|
|
69
|
+
return selectPixaforgeCommonState(state).gallery;
|
|
70
|
+
};
|
|
71
|
+
export var selectGalleryView = function selectGalleryView(state) {
|
|
72
|
+
return selectPixaforgeCommonState(state).galleryView;
|
|
73
|
+
};
|
|
74
|
+
export var selectIsLoading = function selectIsLoading(state) {
|
|
75
|
+
return selectPixaforgeCommonState(state).loading;
|
|
76
|
+
};
|
|
77
|
+
export default commonSlice.reducer;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Image } from '@scaleflex/widget-common';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
+
var CategoryCard = function CategoryCard(_ref) {
|
|
5
|
+
var onClick = _ref.onClick,
|
|
6
|
+
image = _ref.image,
|
|
7
|
+
name = _ref.name,
|
|
8
|
+
count = _ref.count;
|
|
9
|
+
var handleClick = useCallback(function () {
|
|
10
|
+
if (typeof onClick === 'function') {
|
|
11
|
+
onClick(name);
|
|
12
|
+
}
|
|
13
|
+
}, [name]);
|
|
14
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
15
|
+
className: "filerobot-Pixaforge-CategoryCard",
|
|
16
|
+
onClick: handleClick,
|
|
17
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
18
|
+
className: "filerobot-Pixaforge-CategoryCard-image",
|
|
19
|
+
children: /*#__PURE__*/_jsx(Image, {
|
|
20
|
+
src: image
|
|
21
|
+
})
|
|
22
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
23
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
24
|
+
className: "filerobot-Pixaforge-CategoryCard-label",
|
|
25
|
+
children: name
|
|
26
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
27
|
+
className: "filerobot-common-secondaryTxt",
|
|
28
|
+
children: count
|
|
29
|
+
})]
|
|
30
|
+
})]
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
export default CategoryCard;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["name"];
|
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
9
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
16
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
17
|
+
import CategoryCard from './CategoryCard';
|
|
18
|
+
import { getCategories } from '../../api.service';
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
var CategoriesCards = function CategoriesCards(_ref) {
|
|
21
|
+
var selectCategory = _ref.selectCategory,
|
|
22
|
+
setIsLoading = _ref.setIsLoading;
|
|
23
|
+
var _useState = useState([]),
|
|
24
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
25
|
+
categories = _useState2[0],
|
|
26
|
+
setCategories = _useState2[1];
|
|
27
|
+
var fetchCategories = useCallback(function () {
|
|
28
|
+
setIsLoading(true);
|
|
29
|
+
getCategories().then(function (foundCategories) {
|
|
30
|
+
setCategories(foundCategories.splice(0, 20)); // We use slice to use only first 20 categories (descriptions in T6119 https://sfx.li/xyRTwym9kUsWxR)
|
|
31
|
+
})["finally"](function () {
|
|
32
|
+
setIsLoading(false);
|
|
33
|
+
});
|
|
34
|
+
}, []);
|
|
35
|
+
useEffect(fetchCategories, []);
|
|
36
|
+
return /*#__PURE__*/_jsx("div", {
|
|
37
|
+
className: "filerobot-Pixaforge-Categories",
|
|
38
|
+
children: categories.map(function (_ref2) {
|
|
39
|
+
var name = _ref2.name,
|
|
40
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
41
|
+
return /*#__PURE__*/_jsx(CategoryCard, _objectSpread({
|
|
42
|
+
name: name,
|
|
43
|
+
onClick: selectCategory
|
|
44
|
+
}, rest), name);
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export default CategoriesCards;
|