gatsby-matrix-theme 34.0.16 → 34.0.18
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 +27 -0
- package/package.json +2 -2
- package/src/components/atoms/cards/operator-card/template-two/template-two.module.scss +0 -1
- package/src/components/atoms/feedback/index.js +12 -127
- package/src/components/atoms/feedback/template-one/index.js +116 -0
- package/src/components/atoms/feedback/template-one/template-one.stories.js +46 -0
- package/src/components/atoms/feedback/template-one/template-one.test.js +44 -0
- package/src/components/atoms/feedback/template-two/feedback.module.scss +180 -0
- package/src/components/atoms/feedback/template-two/index.js +148 -0
- package/src/components/atoms/feedback/template-two/template-two.stories.js +47 -0
- package/src/components/atoms/feedback/template-two/template-two.test.js +44 -0
- package/src/components/molecules/operator-summary/template-one/index.js +9 -4
- package/src/components/molecules/operator-summary/template-one/template-one.module.scss +21 -4
- package/src/components/molecules/operator-summary/template-three/template-three.module.scss +2 -1
- package/src/components/molecules/operator-summary/template-two/template-two.module.scss +1 -0
- package/src/gatsby-core-theme/components/atoms/module-title/index.js +23 -11
- package/src/gatsby-core-theme/components/atoms/module-title/module-title.module.scss +1 -5
- package/src/gatsby-core-theme/components/molecules/main/index.js +1 -0
- package/src/services/index.js +20 -0
- package/storybook/public/408.0066e73c.iframe.bundle.js +2 -0
- package/storybook/public/{970.1250b6b4.iframe.bundle.js → 970.c147cf4f.iframe.bundle.js} +4 -4
- package/storybook/public/{970.1250b6b4.iframe.bundle.js.map → 970.c147cf4f.iframe.bundle.js.map} +1 -1
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/main.736baf23.iframe.bundle.js +2 -0
- package/storybook/public/{runtime~main.3524c145.iframe.bundle.js → runtime~main.ee7dae1a.iframe.bundle.js} +1 -1
- package/storybook/public/408.f803dd10.iframe.bundle.js +0 -2
- package/storybook/public/main.533502d9.iframe.bundle.js +0 -2
- /package/src/components/atoms/feedback/{feedback.module.scss → template-one/feedback.module.scss} +0 -0
- /package/storybook/public/{408.f803dd10.iframe.bundle.js.LICENSE.txt → 408.0066e73c.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook/public/{970.1250b6b4.iframe.bundle.js.LICENSE.txt → 970.c147cf4f.iframe.bundle.js.LICENSE.txt} +0 -0
- /package/storybook/public/{main.533502d9.iframe.bundle.js.LICENSE.txt → main.736baf23.iframe.bundle.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,30 @@
|
|
|
1
|
+
## [34.0.18](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v34.0.17...v34.0.18) (2023-10-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add extra field an experience ([5acb766](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5acb766040b96e76078b8e33f14f7d54acebdff7))
|
|
7
|
+
* add partnership template ([d77090e](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d77090e944c50eaf5c4c65ba0c5621bec068922c))
|
|
8
|
+
* add storybook ([14eb1d0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/14eb1d0ca572773ff5449baa6e1c884309354fb0))
|
|
9
|
+
* feedback module ([73a0645](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/73a06455c948dbacf7e287387c934afbef2c53b6))
|
|
10
|
+
* make style ([a1b1213](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/a1b1213904bf27cf1499ff012a91899e5218e626))
|
|
11
|
+
* make style and sperate logic ([16bac27](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/16bac2772fb50f5ac243ac4a65c9f1f8a9e47d46))
|
|
12
|
+
* make test ([5968a75](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5968a751ec2b3769946ae05b18b708b9542fa518))
|
|
13
|
+
* module see more ([85871a2](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/85871a22f28791f33866e0e194d97548469349c2))
|
|
14
|
+
* remove console.log ([561437a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/561437a55b9faa268567d5f0b6c2fd8d2a845942))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
* Merge branch 'tm-3609-feedback' into 'master' ([40d8339](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/40d8339bf23760f027675bc56b45dce207dd4d6d))
|
|
18
|
+
* Merge branch 'operator-summery' into 'master' ([33892e6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/33892e6392fd98fe2da3edac572bf8557eccc192))
|
|
19
|
+
|
|
20
|
+
## [34.0.17](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v34.0.16...v34.0.17) (2023-10-18)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* triggering deployment ([105af69](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/105af695714ef09e03bdfa4125740349bc99326f))
|
|
26
|
+
* update core theme version ([70469c3](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/70469c318773a865ced70b5620444d8cd0e7ea70))
|
|
27
|
+
|
|
1
28
|
## [34.0.16](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v34.0.15...v34.0.16) (2023-10-12)
|
|
2
29
|
|
|
3
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-matrix-theme",
|
|
3
|
-
"version": "34.0.
|
|
3
|
+
"version": "34.0.18",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Matrix Theme NPM Package",
|
|
6
6
|
"author": "",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@react-icons/all-files": "^4.1.0",
|
|
27
27
|
"gatsby": "^5.11.0",
|
|
28
|
-
"gatsby-core-theme": "30.0.
|
|
28
|
+
"gatsby-core-theme": "30.0.8",
|
|
29
29
|
"gatsby-plugin-sharp": "^5.11.0",
|
|
30
30
|
"gatsby-plugin-sitemap": "^3.3.0",
|
|
31
31
|
"gatsby-transformer-sharp": "^5.11.0",
|
|
@@ -1,132 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useState, useContext } from 'react';
|
|
1
|
+
import React from 'react';
|
|
3
2
|
import PropTypes from 'prop-types';
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const { translations } = useContext(Context) || {};
|
|
14
|
-
const [voted, setVote] = useState(null);
|
|
15
|
-
const [error, setError] = useState(null);
|
|
16
|
-
const [success, setSuccess] = useState(null);
|
|
17
|
-
|
|
18
|
-
async function addVote(feetBack) {
|
|
19
|
-
const votedUser = feetBack ? 1 : 0;
|
|
20
|
-
await fetch(`${process.env.GATSBY_API_URL}/sites/v0.1/page-votes`, {
|
|
21
|
-
method: 'POST',
|
|
22
|
-
headers: {
|
|
23
|
-
'Content-Type': 'application/json',
|
|
24
|
-
},
|
|
25
|
-
body: JSON.stringify({
|
|
26
|
-
page_id: pageId,
|
|
27
|
-
vote: votedUser,
|
|
28
|
-
}),
|
|
29
|
-
})
|
|
30
|
-
.then((response) => response.json())
|
|
31
|
-
.then((data) => {
|
|
32
|
-
setVote(feetBack);
|
|
33
|
-
// eslint-disable-next-line no-unused-expressions
|
|
34
|
-
!data?.success ? setError(data.errors[0]) : setSuccess(true);
|
|
35
|
-
})
|
|
36
|
-
.catch((err) => {
|
|
37
|
-
console.log(err);
|
|
38
|
-
});
|
|
3
|
+
import TemplateTwo from './template-two';
|
|
4
|
+
import TemplateOne from './template-one';
|
|
5
|
+
|
|
6
|
+
export default function FeedBack({ templateName = 'template_two', ...rest }) {
|
|
7
|
+
switch (templateName) {
|
|
8
|
+
case 'template_two':
|
|
9
|
+
return <TemplateTwo {...rest} />;
|
|
10
|
+
default:
|
|
11
|
+
return <TemplateOne {...rest} />;
|
|
39
12
|
}
|
|
40
|
-
|
|
41
|
-
const vote = (feetBack) => {
|
|
42
|
-
addVote(feetBack);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className={styles?.container || ''}>
|
|
47
|
-
<div className={styles?.feedbackBox || ''}>
|
|
48
|
-
<span>
|
|
49
|
-
{translate(
|
|
50
|
-
translations,
|
|
51
|
-
'recomend_casino_title',
|
|
52
|
-
'Would you recomend [casinoTitle] ?'
|
|
53
|
-
).replace('[casinoTitle]', casinoTitle)}
|
|
54
|
-
</span>
|
|
55
|
-
<div className={styles?.formBox || ''}>
|
|
56
|
-
<span
|
|
57
|
-
onClick={voted === null ? () => vote(true) : null}
|
|
58
|
-
className={`${voted ? styles?.like || '' : ''} ${
|
|
59
|
-
voted === false ? styles?.disabled || '' : ''
|
|
60
|
-
}`}
|
|
61
|
-
aria-hidden="true"
|
|
62
|
-
>
|
|
63
|
-
<BiLike color="#323C46" title="Like Icon" />
|
|
64
|
-
</span>
|
|
65
|
-
<div>
|
|
66
|
-
<span className={styles?.number || ''}>{voted ? trueVotes + 1 : trueVotes} </span>
|
|
67
|
-
|
|
68
|
-
<span className={styles?.text || ''}>
|
|
69
|
-
{voted || voted === undefined || voted === null
|
|
70
|
-
? translate(translations, 'recomend_casino', 'Recommendations')
|
|
71
|
-
: translate(translations, 'dont_recomend_casino', 'Don’t Recommend it')}
|
|
72
|
-
</span>
|
|
73
|
-
</div>
|
|
74
|
-
<span
|
|
75
|
-
onClick={voted === null ? () => vote(false) : null}
|
|
76
|
-
className={`${!voted && voted !== null && styles.dislike} ${voted && styles.disabled}`}
|
|
77
|
-
aria-hidden="true"
|
|
78
|
-
>
|
|
79
|
-
<BiDislike color="#323C46" title="Dislike Icon" />
|
|
80
|
-
</span>
|
|
81
|
-
</div>
|
|
82
|
-
{voted === null ? (
|
|
83
|
-
<div className={styles?.details || ''}>{`${trueVotes} ${translate(
|
|
84
|
-
translations,
|
|
85
|
-
'of_feedback',
|
|
86
|
-
'of'
|
|
87
|
-
)} ${trueVotes + falseVotes} ${translate(
|
|
88
|
-
translations,
|
|
89
|
-
'user_recomend_feedback',
|
|
90
|
-
'users recommend [casinoTitle]'
|
|
91
|
-
).replace('[casinoTitle]', casinoTitle)} `}</div>
|
|
92
|
-
) : (
|
|
93
|
-
<div className={styles?.voted || ''}>
|
|
94
|
-
<span>{translate(translations, 'thanks_feedback', 'Thanks for your feedback!')}</span>
|
|
95
|
-
{error ? (
|
|
96
|
-
<p className={styles?.error || ''}>{translate(translations, 'error_info', error)}</p>
|
|
97
|
-
) : (
|
|
98
|
-
<>
|
|
99
|
-
{success && (
|
|
100
|
-
<p>
|
|
101
|
-
{voted
|
|
102
|
-
? translate(
|
|
103
|
-
translations,
|
|
104
|
-
'positive_feedback',
|
|
105
|
-
'What did you like about [casinoTitle]? Let us know, send us a message'
|
|
106
|
-
).replace('[casinoTitle]', casinoTitle)
|
|
107
|
-
: translate(
|
|
108
|
-
translations,
|
|
109
|
-
'negative_feedback',
|
|
110
|
-
'Sorry about your experience at [casinoTitle]. What happened? send us a message'
|
|
111
|
-
).replace('[casinoTitle]', casinoTitle)}
|
|
112
|
-
<Link to={contactUs}> {translate(translations, 'hereText', 'here')} </Link>.
|
|
113
|
-
</p>
|
|
114
|
-
)}
|
|
115
|
-
</>
|
|
116
|
-
)}
|
|
117
|
-
</div>
|
|
118
|
-
)}
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
13
|
+
}
|
|
123
14
|
|
|
124
15
|
FeedBack.propTypes = {
|
|
125
|
-
|
|
126
|
-
casinoTitle: PropTypes.string,
|
|
127
|
-
trueVotes: PropTypes.number,
|
|
128
|
-
falseVotes: PropTypes.number,
|
|
129
|
-
contactUs: PropTypes.string,
|
|
16
|
+
templateName: PropTypes.string,
|
|
130
17
|
};
|
|
131
|
-
|
|
132
|
-
export default FeedBack;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import React, { useState, useContext } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { Link } from 'gatsby';
|
|
5
|
+
import { Context } from 'gatsby-core-theme/src/context/MainProvider';
|
|
6
|
+
import { translate } from 'gatsby-core-theme/src/helpers/getters';
|
|
7
|
+
import { BiLike } from '@react-icons/all-files/bi/BiLike';
|
|
8
|
+
import { BiDislike } from '@react-icons/all-files/bi/BiDislike';
|
|
9
|
+
import { addVote } from '../../../../services';
|
|
10
|
+
|
|
11
|
+
import styles from './feedback.module.scss';
|
|
12
|
+
|
|
13
|
+
const FeedBack = ({ pageId, casinoTitle, trueVotes, falseVotes, contactUs = '/contact-us' }) => {
|
|
14
|
+
const { translations } = useContext(Context) || {};
|
|
15
|
+
const [voted, setVote] = useState(null);
|
|
16
|
+
const [error, setError] = useState(null);
|
|
17
|
+
const [success, setSuccess] = useState(null);
|
|
18
|
+
|
|
19
|
+
const vote = async (feetBack) => {
|
|
20
|
+
const res = await addVote(feetBack, pageId);
|
|
21
|
+
setVote(feetBack);
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line no-unused-expressions
|
|
24
|
+
!res?.success ? setError(res?.errors[0]) : setSuccess(true);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div className={styles?.container || ''}>
|
|
29
|
+
<div className={styles?.feedbackBox || ''}>
|
|
30
|
+
<span>
|
|
31
|
+
{translate(
|
|
32
|
+
translations,
|
|
33
|
+
'recomend_casino_title',
|
|
34
|
+
'Would you recomend [casinoTitle] ?'
|
|
35
|
+
).replace('[casinoTitle]', casinoTitle)}
|
|
36
|
+
</span>
|
|
37
|
+
<div className={styles?.formBox || ''}>
|
|
38
|
+
<span
|
|
39
|
+
onClick={voted === null ? () => vote(true) : null}
|
|
40
|
+
className={`${voted ? styles?.like || '' : ''} ${
|
|
41
|
+
voted === false ? styles?.disabled || '' : ''
|
|
42
|
+
}`}
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
data-testid="like-button"
|
|
45
|
+
>
|
|
46
|
+
<BiLike color="#323C46" title="Like Icon" />
|
|
47
|
+
</span>
|
|
48
|
+
<div>
|
|
49
|
+
<span className={styles?.number || ''}>{voted ? trueVotes + 1 : trueVotes} </span>
|
|
50
|
+
|
|
51
|
+
<span className={styles?.text || ''}>
|
|
52
|
+
{voted || voted === undefined || voted === null
|
|
53
|
+
? translate(translations, 'recomend_casino', 'Recommendations')
|
|
54
|
+
: translate(translations, 'dont_recomend_casino', 'Don’t Recommend it')}
|
|
55
|
+
</span>
|
|
56
|
+
</div>
|
|
57
|
+
<span
|
|
58
|
+
onClick={voted === null ? () => vote(false) : null}
|
|
59
|
+
className={`${!voted && voted !== null && styles.dislike} ${voted && styles.disabled}`}
|
|
60
|
+
aria-hidden="true"
|
|
61
|
+
data-testid="dislike-button"
|
|
62
|
+
>
|
|
63
|
+
<BiDislike color="#323C46" title="Dislike Icon" />
|
|
64
|
+
</span>
|
|
65
|
+
</div>
|
|
66
|
+
{voted === null ? (
|
|
67
|
+
<div className={styles?.details || ''}>{`${trueVotes} ${translate(
|
|
68
|
+
translations,
|
|
69
|
+
'of_feedback',
|
|
70
|
+
'of'
|
|
71
|
+
)} ${trueVotes + falseVotes} ${translate(
|
|
72
|
+
translations,
|
|
73
|
+
'user_recomend_feedback',
|
|
74
|
+
'users recommend [casinoTitle]'
|
|
75
|
+
).replace('[casinoTitle]', casinoTitle)} `}</div>
|
|
76
|
+
) : (
|
|
77
|
+
<div className={styles?.voted || ''}>
|
|
78
|
+
<span>{translate(translations, 'thanks_feedback', 'Thanks for your feedback!')}</span>
|
|
79
|
+
{error ? (
|
|
80
|
+
<p className={styles?.error || ''}>{translate(translations, 'error_info', error)}</p>
|
|
81
|
+
) : (
|
|
82
|
+
<>
|
|
83
|
+
{success && (
|
|
84
|
+
<p>
|
|
85
|
+
{voted
|
|
86
|
+
? translate(
|
|
87
|
+
translations,
|
|
88
|
+
'positive_feedback',
|
|
89
|
+
'What did you like about [casinoTitle]? Let us know, send us a message'
|
|
90
|
+
).replace('[casinoTitle]', casinoTitle)
|
|
91
|
+
: translate(
|
|
92
|
+
translations,
|
|
93
|
+
'negative_feedback',
|
|
94
|
+
'Sorry about your experience at [casinoTitle]. What happened? send us a message'
|
|
95
|
+
).replace('[casinoTitle]', casinoTitle)}
|
|
96
|
+
<Link to={contactUs}> {translate(translations, 'hereText', 'here')} </Link>.
|
|
97
|
+
</p>
|
|
98
|
+
)}
|
|
99
|
+
</>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
FeedBack.propTypes = {
|
|
109
|
+
pageId: PropTypes.number,
|
|
110
|
+
casinoTitle: PropTypes.string,
|
|
111
|
+
trueVotes: PropTypes.number,
|
|
112
|
+
falseVotes: PropTypes.number,
|
|
113
|
+
contactUs: PropTypes.string,
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default FeedBack;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
3
|
+
import {
|
|
4
|
+
Title,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
PRIMARY_STORY,
|
|
8
|
+
ArgsTable,
|
|
9
|
+
} from '@storybook/addon-docs/blocks';
|
|
10
|
+
import TemplateOne from '.';
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
title: 'Theme/Modules/Template Blocks/FeadBack Counter/Template One /Template One',
|
|
14
|
+
component: TemplateOne,
|
|
15
|
+
argTypes: {
|
|
16
|
+
title: 'Would you recommend (Casino Name)?',
|
|
17
|
+
pageId: 123,
|
|
18
|
+
trueVotes: 10,
|
|
19
|
+
falseVotes: 5,
|
|
20
|
+
},
|
|
21
|
+
parameters: {
|
|
22
|
+
docs: {
|
|
23
|
+
description: {
|
|
24
|
+
component: 'A component that displays authors cards',
|
|
25
|
+
},
|
|
26
|
+
page: () => (
|
|
27
|
+
<>
|
|
28
|
+
<Title />
|
|
29
|
+
<Description />
|
|
30
|
+
<Primary />
|
|
31
|
+
<ArgsTable story={PRIMARY_STORY} />
|
|
32
|
+
</>
|
|
33
|
+
),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const Template = (args) => <TemplateOne {...args} />;
|
|
39
|
+
export const Default = Template.bind({});
|
|
40
|
+
Default.args = {
|
|
41
|
+
title: 'Would you recommend [operator_name]?',
|
|
42
|
+
pageId: 123,
|
|
43
|
+
trueVotes: 10,
|
|
44
|
+
falseVotes: 5,
|
|
45
|
+
casinoTitle: 'Wildz',
|
|
46
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render, fireEvent, waitFor } from '@testing-library/react';
|
|
3
|
+
import { act } from 'react-dom/test-utils';
|
|
4
|
+
import FeedBack from '.';
|
|
5
|
+
|
|
6
|
+
describe('FeedBack Component', () => {
|
|
7
|
+
it('renders correctly with initial state', () => {
|
|
8
|
+
const { getByText } = render(
|
|
9
|
+
<FeedBack pageId={123} casinoTitle="Wildz" trueVotes={10} falseVotes={5} />
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
expect(getByText('Would you recomend Wildz ?')).toBeInTheDocument();
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('handles like button click', async () => {
|
|
16
|
+
const { getByText, getByTestId } = render(
|
|
17
|
+
<FeedBack pageId={123} casinoTitle="Wildz" trueVotes={10} falseVotes={5} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
const likeButton = getByTestId('like-button');
|
|
21
|
+
await act(async () => {
|
|
22
|
+
fireEvent.click(likeButton);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
await waitFor(() => {
|
|
26
|
+
expect(getByText('Thanks for your feedback!')).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('handles dislike button click', async () => {
|
|
31
|
+
const { getByText, getByTestId } = render(
|
|
32
|
+
<FeedBack pageId={123} casinoTitle="Wildz" trueVotes={10} falseVotes={5} />
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const dislikeButton = getByTestId('dislike-button');
|
|
36
|
+
await act(async () => {
|
|
37
|
+
fireEvent.click(dislikeButton);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
await waitFor(() => {
|
|
41
|
+
expect(getByText('Thanks for your feedback!')).toBeInTheDocument();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
.feedbackBox {
|
|
2
|
+
border-radius: 10px;
|
|
3
|
+
background: #FFF;
|
|
4
|
+
box-shadow: 0px 4px 6px -2px rgba(27, 27, 28, 0.04), 0px 12px 16px -4px rgba(27, 27, 28, 0.07);
|
|
5
|
+
width: calc(100% - 3.2rem);
|
|
6
|
+
margin: 0 auto;
|
|
7
|
+
padding: 1.6rem;
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: 1fr auto;
|
|
10
|
+
grid-template-rows: auto;
|
|
11
|
+
max-width:calc(var(--main-container-max) - 2.4rem);
|
|
12
|
+
|
|
13
|
+
@include min(tablet) {
|
|
14
|
+
display: grid;
|
|
15
|
+
grid-template-columns: 9.6rem 2.1fr .8fr 0.5fr;
|
|
16
|
+
grid-template-rows: repeat(2, auto);
|
|
17
|
+
align-items: center;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
>img {
|
|
21
|
+
display: none;
|
|
22
|
+
|
|
23
|
+
@include min(tablet) {
|
|
24
|
+
display: block;
|
|
25
|
+
grid-column: 1;
|
|
26
|
+
grid-row: 1/3;
|
|
27
|
+
width: 8rem;
|
|
28
|
+
height: 8rem;
|
|
29
|
+
border-radius: .8rem;
|
|
30
|
+
margin-right: 1.6rem;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.title {
|
|
36
|
+
color: #1B1B1C;
|
|
37
|
+
font-size: 1.8rem;
|
|
38
|
+
font-style: normal;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
line-height: 2.8rem;
|
|
41
|
+
margin-right: .8rem;
|
|
42
|
+
|
|
43
|
+
@include min(tablet) {
|
|
44
|
+
grid-column: 2/3;
|
|
45
|
+
grid-row: 1/2;
|
|
46
|
+
font-size: 1.8rem;
|
|
47
|
+
font-style: normal;
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
line-height: 2.8rem;
|
|
50
|
+
margin-top: .5rem
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.formBox {
|
|
55
|
+
@include flex-direction(row);
|
|
56
|
+
gap: .8rem;
|
|
57
|
+
|
|
58
|
+
@include min(tablet) {
|
|
59
|
+
grid-row: 1/3;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.button {
|
|
64
|
+
border-radius: 100px;
|
|
65
|
+
background: #ECECEC;
|
|
66
|
+
min-width: 5.6rem;
|
|
67
|
+
height: 5.6rem;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
@include flex-align(center, center);
|
|
70
|
+
@include min(tablet){
|
|
71
|
+
width: 6.4rem;
|
|
72
|
+
height: 6.4rem;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
>svg {
|
|
76
|
+
width: 2.8rem;
|
|
77
|
+
height: 2.8rem;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.details {
|
|
82
|
+
border-radius: 4px;
|
|
83
|
+
background: var(--feedback-color-details, #D3DB34);
|
|
84
|
+
grid-column: 1/3;
|
|
85
|
+
color: #262629;
|
|
86
|
+
font-size: 1.4rem;
|
|
87
|
+
font-style: normal;
|
|
88
|
+
font-weight: 500;
|
|
89
|
+
line-height: 2.2rem;
|
|
90
|
+
height: 3rem;
|
|
91
|
+
margin-top: 1.6rem;
|
|
92
|
+
@include flex-align(center, center);
|
|
93
|
+
|
|
94
|
+
@include min(tablet) {
|
|
95
|
+
@include flex-align(center, flex-start);
|
|
96
|
+
grid-column: 2/3;
|
|
97
|
+
grid-row: 2/3;
|
|
98
|
+
background-color: transparent;
|
|
99
|
+
margin-top: 0;
|
|
100
|
+
font-size: 1.4rem;
|
|
101
|
+
font-style: normal;
|
|
102
|
+
font-weight: 400;
|
|
103
|
+
line-height: 2.2rem;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.like,
|
|
108
|
+
.dislike {
|
|
109
|
+
background: var(--feedback-button, #136A43);
|
|
110
|
+
|
|
111
|
+
>svg {
|
|
112
|
+
fill: white;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.voted {
|
|
117
|
+
grid-column: 1/3;
|
|
118
|
+
margin-top: 2.4rem;
|
|
119
|
+
@include min(tablet){
|
|
120
|
+
grid-column: 2/3;
|
|
121
|
+
grid-row: 1/3;
|
|
122
|
+
margin-top: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
>span {
|
|
126
|
+
color: #1C1A28;
|
|
127
|
+
font-size: 1.8rem;
|
|
128
|
+
font-style: normal;
|
|
129
|
+
font-weight: 600;
|
|
130
|
+
line-height: 2.8rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
>p {
|
|
134
|
+
color: #515156;
|
|
135
|
+
font-size: 1.4rem;
|
|
136
|
+
font-style: normal;
|
|
137
|
+
font-weight: 400;
|
|
138
|
+
line-height: 2.2rem;
|
|
139
|
+
margin-top: 0.8rem;
|
|
140
|
+
@include min(tablet){
|
|
141
|
+
margin-top: 0;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
>a {
|
|
145
|
+
margin-left: 0.5rem;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.userCount {
|
|
151
|
+
@include flex-direction(column);
|
|
152
|
+
color: #1B1B1C;
|
|
153
|
+
font-size: 1.8rem;
|
|
154
|
+
font-style: normal;
|
|
155
|
+
font-weight: 600;
|
|
156
|
+
line-height: 2.8rem;
|
|
157
|
+
display: none;
|
|
158
|
+
|
|
159
|
+
@include min(tablet) {
|
|
160
|
+
display: flex;
|
|
161
|
+
grid-column: 3;
|
|
162
|
+
grid-row: 1/3;
|
|
163
|
+
height: 100%;
|
|
164
|
+
margin-left: 4.8rem;
|
|
165
|
+
margin-right: 2.4rem;
|
|
166
|
+
@include flex-align(start, center);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
>span {
|
|
170
|
+
color: #515156;
|
|
171
|
+
font-size: 1.6rem;
|
|
172
|
+
font-style: normal;
|
|
173
|
+
font-weight: 400;
|
|
174
|
+
line-height: 2.6rem;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.showCounter {
|
|
179
|
+
display: flex;
|
|
180
|
+
}
|