gatsby-core-theme 6.1.1 → 6.1.7
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 +74 -0
- package/package.json +1 -1
- package/src/components/molecules/operator-banner/index.js +3 -3
- package/src/components/molecules/operator-banner/operator-banner.module.scss +1 -1
- package/src/components/molecules/star-rating/one-star.js +20 -0
- package/src/components/molecules/star-rating/one-star.module.scss +28 -0
- package/src/components/molecules/star-rating/one-star.test.js +18 -0
- package/src/components/molecules/star-rating/star-rating.module.scss +1 -1
- package/src/helpers/processor/modules.js +18 -7
- package/src/helpers/processor/modules.test.js +10 -3
- package/src/styles/utils/_mixins.scss +5 -5
- package/src/styles/utils/variables/_main.scss +1 -0
- package/storybook/.ci.yml +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
|
1
|
+
## [6.1.7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.6...v6.1.7) (2022-04-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Code Refactoring
|
|
5
|
+
|
|
6
|
+
* update cards, cards_v2 filtering for operator pages ([08ecad7](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/08ecad782f75f6f8105f203e06baf48951d68789))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* Merge branch 'tm-2805-cards-random-filter' into 'master' ([206b0e8](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/206b0e89234188e5a0ad38ad1fd1aec3a1212e89))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### refactoe
|
|
13
|
+
|
|
14
|
+
* update processor modules tests ([11fd5a0](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/11fd5a0f7dcadf71a9550c58eeed383db35437e4))
|
|
15
|
+
|
|
16
|
+
## [6.1.6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.5...v6.1.6) (2022-04-18)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* commit to trigger publish ([6c6c3fb](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/6c6c3fb19ff72f175da8843c02cc467033211097))
|
|
22
|
+
|
|
23
|
+
## [6.1.5](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.4...v6.1.5) (2022-04-18)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
* changed npm token ([eba1721](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eba17217edfaa65a57f0fc911341ae040df4e2df))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([44e4e94](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/44e4e940745311f4435de7e965394481a0e13e21))
|
|
32
|
+
|
|
33
|
+
## [6.1.4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.3...v6.1.4) (2022-04-18)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* changed tracker ([4ed35aa](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/4ed35aa6ccdad19fdf9e203da67a8a74d78fd662))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
* Merge branch 'master' of git.ilcd.rocks:team-floyd/themes/gatsby-themes ([43f8dcf](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/43f8dcf4f647f3f7128c10bfcc73482876129890))
|
|
42
|
+
|
|
43
|
+
## [6.1.3](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.2...v6.1.3) (2022-04-18)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* star rating fixed design ([eaf7472](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/eaf74723c83f203e465d5cc3811cca562134b3ef))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
* Merge branch 'tm-2783-fix-star-rating' into 'master' ([3f1d310](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/3f1d3105db166d2bbdd48c2a2d19bb0c1e3a462e))
|
|
52
|
+
|
|
53
|
+
## [6.1.2](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.1...v6.1.2) (2022-04-13)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Bug Fixes
|
|
57
|
+
|
|
58
|
+
* add star ratings changes ([a7145f4](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/a7145f4ee6c6e8c73c879e3ea968ef1b5b3566f9))
|
|
59
|
+
* replace h3 with p for heading sequence ([046fd25](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/046fd25173b6293285687c0da4545eb687cfe726))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Code Refactoring
|
|
63
|
+
|
|
64
|
+
* seperate one star component ([77e38fc](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/77e38fc9dfb1ec1b8be2a62bfbbad695ba9c46ca))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
* Merge branch 'tm-2813-heading-sequence' into 'master' ([1536f72](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/1536f723f30ec5b794222db41fffcd398b3e0688))
|
|
68
|
+
* Merge branch 'fix-star-ratings' into 'master' ([954ff3a](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/954ff3ace386c2165421731ad280e6d8ecd60c94))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Tests
|
|
72
|
+
|
|
73
|
+
* added test for onestar ([0f21ec6](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/commit/0f21ec6ae1ae0133450ba1d15c442469c4abf18d))
|
|
74
|
+
|
|
1
75
|
## [6.1.1](https://git.ilcd.rocks/team-floyd/themes/gatsby-themes/compare/v6.1.0...v6.1.1) (2022-04-06)
|
|
2
76
|
|
|
3
77
|
|
package/package.json
CHANGED
|
@@ -52,8 +52,8 @@ export default function OperatorBanner({
|
|
|
52
52
|
<LazyImage alt={operator?.name} src={imagePrettyUrl(logo)} />
|
|
53
53
|
</a>
|
|
54
54
|
) : (
|
|
55
|
-
<div>
|
|
56
|
-
<
|
|
55
|
+
<div className={styles.nameTitle}>
|
|
56
|
+
<p>
|
|
57
57
|
<a
|
|
58
58
|
href={prettyLink}
|
|
59
59
|
title={operator?.name}
|
|
@@ -63,7 +63,7 @@ export default function OperatorBanner({
|
|
|
63
63
|
>
|
|
64
64
|
{operator?.name}
|
|
65
65
|
</a>
|
|
66
|
-
</
|
|
66
|
+
</p>
|
|
67
67
|
{!isPlaceholder && hasStars && (
|
|
68
68
|
<StarRating numOfStars={5} rating={operator.rating} />
|
|
69
69
|
)}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { getRating } from '~helpers/rating';
|
|
4
|
+
|
|
5
|
+
import styles from './one-star.module.scss';
|
|
6
|
+
|
|
7
|
+
const OneStar = ({ numOfStars, rating, active = true }) => (
|
|
8
|
+
<div className={`${styles.starRatingContainer} ${!active && styles.inactive}`}>
|
|
9
|
+
<span className={styles.fullStar} />
|
|
10
|
+
<span className={styles.rateNr}>{`${getRating(rating)}/${numOfStars}`}</span>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
OneStar.propTypes = {
|
|
15
|
+
numOfStars: PropTypes.oneOf([5, 10]).isRequired,
|
|
16
|
+
rating: PropTypes.oneOfType([PropTypes.array, PropTypes.number, PropTypes.string]).isRequired,
|
|
17
|
+
active: PropTypes.bool,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default OneStar;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.starRatingContainer {
|
|
2
|
+
@include flex-direction(row);
|
|
3
|
+
justify-content: center;
|
|
4
|
+
background-color: #ffffff;
|
|
5
|
+
min-width: 6.5rem;
|
|
6
|
+
min-height: 2.1rem;
|
|
7
|
+
line-height: 2.1rem;
|
|
8
|
+
border-radius: 0.4rem;
|
|
9
|
+
border: 1px solid var(--main-star-wrapper-color);
|
|
10
|
+
|
|
11
|
+
.fullStar {
|
|
12
|
+
@include star(var(--full-star-fill-color), var(--full-star-border-color), unset, 2.1rem);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rateNr {
|
|
16
|
+
color: #17182f;
|
|
17
|
+
font-weight: 700;
|
|
18
|
+
font-size: 1.3rem;
|
|
19
|
+
margin-left: 0.33rem;
|
|
20
|
+
line-height: 2.1rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.inactive {
|
|
24
|
+
.fullStar {
|
|
25
|
+
@include star(var(--empty-star-border-color), var(--empty-star-border-color), unset, 2.1rem);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, cleanup } from '@testing-library/react';
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
4
|
+
|
|
5
|
+
import OneStar from './one-star';
|
|
6
|
+
|
|
7
|
+
describe('OneStar Component', () => {
|
|
8
|
+
test('render container with correct rating', async () => {
|
|
9
|
+
const { container } = render(<OneStar numOfStars={5} rating={3} />);
|
|
10
|
+
|
|
11
|
+
expect(container.querySelectorAll('span')).toHaveLength(2);
|
|
12
|
+
expect(container.querySelectorAll('span')[1].innerHTML).toBe('3/5');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterEach(() => {
|
|
17
|
+
cleanup();
|
|
18
|
+
});
|
|
@@ -18,9 +18,15 @@ export function processCardsModule(module, pages, pagesCloned, pagesMappedById)
|
|
|
18
18
|
const numOfItems =
|
|
19
19
|
Math.sign(module.num_of_items) === 0 ? pages[modelType].length : Number(module.num_of_items);
|
|
20
20
|
if (sortBy === 'random') {
|
|
21
|
-
const samplePages =
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const samplePages =
|
|
22
|
+
module.cards_page_type !== 'operator'
|
|
23
|
+
? pagesCloned[modelType]
|
|
24
|
+
: pagesCloned[modelType].filter(
|
|
25
|
+
(page) =>
|
|
26
|
+
!settings.filter_cards_modules[process.env.GATSBY_SITE_NAME].includes(
|
|
27
|
+
page.relation && page.relation.status
|
|
28
|
+
)
|
|
29
|
+
);
|
|
24
30
|
module.items = sampleSize(samplePages, numOfItems);
|
|
25
31
|
} else {
|
|
26
32
|
module.items = pagesCloned[modelType].slice(0, numOfItems);
|
|
@@ -180,10 +186,15 @@ export function processCardsV2(module, pagesCloned, pagesMappedById) {
|
|
|
180
186
|
|
|
181
187
|
// Applying sorting
|
|
182
188
|
if (sortType === 'random') {
|
|
183
|
-
const samplePages =
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
189
|
+
const samplePages =
|
|
190
|
+
module.cards_page_type !== 'operator'
|
|
191
|
+
? uniquePages
|
|
192
|
+
: uniquePages.filter(
|
|
193
|
+
(page) =>
|
|
194
|
+
!settings.filter_cards_modules[process.env.GATSBY_SITE_NAME].includes(
|
|
195
|
+
page.relation && page.relation.status
|
|
196
|
+
)
|
|
197
|
+
);
|
|
187
198
|
module.items = sampleSize(samplePages, itemLimit);
|
|
188
199
|
} else if (sortType === 'latest') {
|
|
189
200
|
if (uniquePages.length > 0) {
|
|
@@ -17,6 +17,11 @@ import {
|
|
|
17
17
|
import { relationData, singleToplistData } from '../../../tests/factories/modules/toplist.factory';
|
|
18
18
|
|
|
19
19
|
describe('Modules Helper', () => {
|
|
20
|
+
beforeEach(() => {
|
|
21
|
+
jest.resetModules();
|
|
22
|
+
process.env = { ...process.env };
|
|
23
|
+
delete process.env.NODE_ENV;
|
|
24
|
+
});
|
|
20
25
|
test('Cards V2 Manual list', () => {
|
|
21
26
|
const pagesNum = 10;
|
|
22
27
|
const moduleData = getSampleCardsV2ModuleManual();
|
|
@@ -45,12 +50,14 @@ describe('Modules Helper', () => {
|
|
|
45
50
|
const moduleData = getSampleCardsV2Filtered(false, 'Game');
|
|
46
51
|
moduleData.cards_selector_filters_sort_by = 'random';
|
|
47
52
|
moduleData.cards_selector_filters_limit = '3';
|
|
53
|
+
moduleData.cards_page_type = 'operator';
|
|
48
54
|
const pageList = getPageDataList(pagesNum).map((page, i) =>
|
|
49
55
|
i % 2
|
|
50
|
-
? { ...page, type: '
|
|
51
|
-
: { ...page, type: '
|
|
56
|
+
? { ...page, type: 'operator', relation: { ...page.relation, status: 'inactive' } }
|
|
57
|
+
: { ...page, type: 'operator', relation: { ...page.relation, status: 'active' } }
|
|
52
58
|
);
|
|
53
|
-
processCardsV2
|
|
59
|
+
const { processCardsV2: processCardsV2Clean } = require('./modules');
|
|
60
|
+
processCardsV2Clean(moduleData, groupBy(pageList, 'type'), groupBy(pageList, 'id'));
|
|
54
61
|
|
|
55
62
|
expect(moduleData.items).toHaveLength(3);
|
|
56
63
|
moduleData.items.forEach((item) => {
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
border-top: $height solid $color;
|
|
68
68
|
border-right: calc($width / 2) solid transparent;
|
|
69
69
|
border-left: calc($width / 2) solid transparent;
|
|
70
|
-
margin-left: -
|
|
70
|
+
margin-left: -calc($width / 2);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
@mixin star($border-color: #
|
|
89
|
-
line-height:
|
|
90
|
-
width:
|
|
88
|
+
@mixin star($border-color: #ffb400, $fill-color: #ffb400, $width: 16px, $line-height: 2rem) {
|
|
89
|
+
line-height: $line-height;
|
|
90
|
+
width: $width;
|
|
91
91
|
font-weight: normal;
|
|
92
92
|
display: inline-block;
|
|
93
93
|
color: $fill-color;
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
@mixin half-star($border-color: #
|
|
106
|
+
@mixin half-star($border-color: #ffb400, $half-empty-color: #ffb400, $half-full-color: white) {
|
|
107
107
|
line-height: 2rem;
|
|
108
108
|
width: 16px;
|
|
109
109
|
font-weight: normal;
|
package/storybook/.ci.yml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# ######################
|
|
2
|
-
# STORYBOOK
|
|
2
|
+
# STORYBOOK
|
|
3
3
|
# #####################
|
|
4
4
|
|
|
5
5
|
Storybook Build:
|
|
@@ -9,7 +9,7 @@ Storybook Build:
|
|
|
9
9
|
- floyd-runner-test
|
|
10
10
|
script:
|
|
11
11
|
- yarn config set cache-folder .yarn
|
|
12
|
-
- npm config set //registry.npmjs.org/:_authToken
|
|
12
|
+
- npm config set //registry.npmjs.org/:_authToken $NPM_AUTH_TOKEN
|
|
13
13
|
- yarn
|
|
14
14
|
- yarn workspace gatsby-core-theme build-storybook -o ./storybook/public
|
|
15
15
|
artifacts:
|