gatsby-matrix-theme 49.0.4 → 49.0.6
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 +40 -0
- package/package.json +1 -1
- package/src/components/atoms/teatime-lunchtime-disclaimer/index.js +16 -0
- package/src/components/atoms/teatime-lunchtime-disclaimer/styles.module.scss +17 -0
- package/src/components/atoms/teatime-lunchtime-disclaimer/teatime-lunchtime-disclaimer.stories.js +40 -0
- package/src/components/atoms/teatime-lunchtime-disclaimer/teatime-lunchtime-disclaimer.test.js +16 -0
- package/src/components/molecules/lotto-uk-49/index.js +49 -0
- package/src/components/molecules/lotto-uk-49/item/index.js +48 -0
- package/src/components/molecules/lotto-uk-49/item/styles.module.scss +91 -0
- package/src/components/molecules/lotto-uk-49/listItems/index.js +75 -0
- package/src/components/molecules/lotto-uk-49/listItems/styles.module.scss +76 -0
- package/src/components/molecules/lotto-uk-49/lotto-uk-49.stories.js +46 -0
- package/src/components/molecules/lotto-uk-49/lotto-uk-49.test.js +24 -0
- package/src/components/molecules/lotto-uk-49/styles.module.scss +9 -0
- package/src/components/molecules/operator-details/index.js +1 -1
- package/src/components/molecules/teatime-lunchtime-frame/index.js +108 -0
- package/src/components/molecules/teatime-lunchtime-frame/styles.module.scss +62 -0
- package/src/components/molecules/teatime-lunchtime-frame/teatime-lunchtime-frame.stories.js +37 -0
- package/src/components/molecules/teatime-lunchtime-frame/teatime-lunchtime.test.js +68 -0
- package/src/gatsby-core-theme/components/molecules/module/index.js +8 -1
- package/src/gatsby-core-theme/helpers/server-data.js +175 -148
- package/src/gatsby-core-theme/helpers/services.js +78 -57
- package/src/gatsby-core-theme/hooks/tabs/index.js +122 -122
- package/src/gatsby-core-theme/hooks/tabs/tab/tab-list.js +91 -91
- package/src/gatsby-core-theme/hooks/tabs/tab/tab-list.module.scss +78 -71
- package/src/gatsby-core-theme/hooks/tabs/tab/tab.js +61 -61
- package/src/gatsby-core-theme/hooks/tabs/tab/tab.module.scss +65 -54
- package/src/gatsby-core-theme/hooks/tabs/tabs.module.scss +173 -107
- package/src/gatsby-core-theme/hooks/tabs/title/index.js +55 -55
- package/src/gatsby-core-theme/hooks/tabs/title/title.module.scss +34 -30
- package/src/images/icons/booster-loto.js +191 -0
- package/src/images/icons/lotto.js +24 -0
- package/src/images/icons/trophy.js +12 -0
- package/storybook/public/{609.52ae9ffd.iframe.bundle.js → 451.08647350.iframe.bundle.js} +3 -3
- package/storybook/public/{609.52ae9ffd.iframe.bundle.js.map → 451.08647350.iframe.bundle.js.map} +1 -1
- package/storybook/public/iframe.html +1 -1
- package/storybook/public/main.10014c5d.iframe.bundle.js +1 -0
- package/storybook/public/project.json +2 -1
- package/tests/factories/lotto/lotto-uk-49.js +38 -0
- package/storybook/public/main.66bdb788.iframe.bundle.js +0 -1
- /package/src/gatsby-core-theme/constants/{navigation.js → site-settings/navigation.js} +0 -0
- /package/storybook/public/{609.52ae9ffd.iframe.bundle.js.LICENSE.txt → 451.08647350.iframe.bundle.js.LICENSE.txt} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
## [49.0.6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v49.0.5...v49.0.6) (2024-08-14)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add live env ([810ed94](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/810ed94937dcf4dff6e9d437d2ca5c544c3dd70a))
|
|
7
|
+
* add logic for historical data ([d900ee0](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d900ee09b627612e8e60815e182da86a84799be1))
|
|
8
|
+
* add lottery api ([86ec51d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/86ec51de511e9fdd6f6f399f79aefe032329b098))
|
|
9
|
+
* add margin ([9284aee](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/9284aee3277625d3474cd69e386908717dd0c1fa))
|
|
10
|
+
* add server data ([f9097b6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f9097b687cd237eb925245959245e03b6ecef563))
|
|
11
|
+
* add storybook and test ([4ad68d8](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/4ad68d89d0e13a2011a045138822d528193a2f9c))
|
|
12
|
+
* add tabs ([25c662d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/25c662d3c784236c9899d0298c0cf54c7c2655ae))
|
|
13
|
+
* add test ([0cf07ae](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/0cf07ae790f6a989323e93c95b88c100db48f7d6))
|
|
14
|
+
* add translations ([d699025](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/d6990255a5cfd04b2c6b3180edd254ac5f1d2464))
|
|
15
|
+
* clean up ([e394296](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e39429608edf462c8fb01963fd4cd6da5c0fdab4))
|
|
16
|
+
* fix build ([421cea6](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/421cea652dfcd624ed3f5a84d2b2ed2b50d6590b))
|
|
17
|
+
* fix storybook ([c19d499](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c19d499e75b45505540fee8c200a8b933e22adae))
|
|
18
|
+
* fix test and clean up code ([e2abc8a](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e2abc8afaf6b6f0d8b790b4a40a6aa8445a227a8))
|
|
19
|
+
* fix tests ([376e7fa](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/376e7fa55e6346c162508514a1e200107c0cdece))
|
|
20
|
+
* fix tests ([502257d](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/502257dfc14cf1794138ca7294768e1c53110641))
|
|
21
|
+
* frame module and disclamer module ([c09fca5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c09fca55d2d6c673cc7025c411dc7865c702d4dd))
|
|
22
|
+
* if the modules arent added on hercules stop to do api request ([7945332](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7945332a17af16d88c0fb6d71ea92bb8ac9b58a2))
|
|
23
|
+
* lotto ([5bf794f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/5bf794f268d2bdd982e7267b9bed45c8374f2448))
|
|
24
|
+
* make style ([2292375](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/22923755b6995839cd71d198f7130f0ef92090f4))
|
|
25
|
+
* make style ([6891b51](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/6891b5127bf507c5d169022a3dd538d12505c006))
|
|
26
|
+
* server data ([196c619](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/196c619b4cdffdb5619c428cf76641a1feac563d))
|
|
27
|
+
* star rating ([94cfe4f](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/94cfe4f26364ec42835e267cf7d183af011354b3))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
* Merge branch 'tm-4555-lotto-uk-49' into 'master' ([e7f2d3c](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/e7f2d3ca3187d2cc2e36cbd0653d1ede435a8338))
|
|
31
|
+
* Merge branch 'master' into 'tm-4555-lotto-uk-49' ([f970ba7](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/f970ba7ed3d39eee8a086b10e6bd2e92009fa3c2))
|
|
32
|
+
* Merge branch 'master' into tm-4555-lotto-uk-49 ([7f6c423](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/7f6c42382a46965e07d111cec617c8466bc2746b))
|
|
33
|
+
|
|
34
|
+
## [49.0.5](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v49.0.4...v49.0.5) (2024-08-09)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
* navigation settings ([c55efca](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/commit/c55efca706cd96bdfc41705d3204cee4868cf003))
|
|
40
|
+
|
|
1
41
|
## [49.0.4](https://git.ilcd.rocks/team-floyd/themes/matrix-theme/compare/v49.0.3...v49.0.4) (2024-08-09)
|
|
2
42
|
|
|
3
43
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import useTranslate from 'gatsby-core-theme/src/hooks/useTranslate/useTranslate';
|
|
3
|
+
import styles from './styles.module.scss';
|
|
4
|
+
|
|
5
|
+
export default function TeatimeLunchtimeDisclaimer() {
|
|
6
|
+
return (
|
|
7
|
+
<div className={styles.conatainer}>
|
|
8
|
+
<p>
|
|
9
|
+
{useTranslate(
|
|
10
|
+
'teamtime_lunchtime_disclaimer',
|
|
11
|
+
'While we strive to ensure that the information on this page is correct and up to date, we cannot guarantee the accuracy or reliability of the UK49s results. Any winnings should be confirmed with the official UK49s website or authorized distributors.'
|
|
12
|
+
)}
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
.conatainer {
|
|
2
|
+
padding: 2.4rem !important;
|
|
3
|
+
background: var(--teatime-lunchtime-disclaimer-background, #ffe0da);
|
|
4
|
+
border: 1px solid var(--teatime-lunchtime-disclaimer-border-color, #f55d41);
|
|
5
|
+
border-radius: 0.8rem;
|
|
6
|
+
width: calc(100% - 3.2rem);
|
|
7
|
+
@include min(laptop) {
|
|
8
|
+
width: calc(var(--main-container-max) - 3.2rem);
|
|
9
|
+
}
|
|
10
|
+
> p {
|
|
11
|
+
font-size: 1.6rem;
|
|
12
|
+
font-style: italic;
|
|
13
|
+
line-height: 2.4rem;
|
|
14
|
+
font-weight: 700;
|
|
15
|
+
color: #3C394F;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/components/atoms/teatime-lunchtime-disclaimer/teatime-lunchtime-disclaimer.stories.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Title,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
PRIMARY_STORY,
|
|
8
|
+
ArgsTable,
|
|
9
|
+
} from '@storybook/addon-docs/blocks';
|
|
10
|
+
import data from '../../../../tests/factories/lotto/lotto-uk-49';
|
|
11
|
+
|
|
12
|
+
import Discalmer from '.';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Theme/Atoms/Teatime Lunchtime Disclaimer',
|
|
16
|
+
component: Discalmer,
|
|
17
|
+
argTypes: {},
|
|
18
|
+
parameters: {
|
|
19
|
+
docs: {
|
|
20
|
+
description: {
|
|
21
|
+
component: '',
|
|
22
|
+
},
|
|
23
|
+
page: () => (
|
|
24
|
+
<>
|
|
25
|
+
<Title />
|
|
26
|
+
<Description />
|
|
27
|
+
<Primary />
|
|
28
|
+
<ArgsTable story={PRIMARY_STORY} />
|
|
29
|
+
</>
|
|
30
|
+
),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const Template = (args) => <Discalmer {...args} />;
|
|
36
|
+
|
|
37
|
+
export const Default = Template.bind({});
|
|
38
|
+
Default.args = {
|
|
39
|
+
serverData: data,
|
|
40
|
+
};
|
package/src/components/atoms/teatime-lunchtime-disclaimer/teatime-lunchtime-disclaimer.test.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
+
import Disclaimer from '.';
|
|
6
|
+
|
|
7
|
+
describe('Disclaimer Teatime and Lunchtime Component', () => {
|
|
8
|
+
test('renders without crashing with serverData', () => {
|
|
9
|
+
const { getByText } = render(<Disclaimer />);
|
|
10
|
+
expect(
|
|
11
|
+
getByText(
|
|
12
|
+
'While we strive to ensure that the information on this page is correct and up to date, we cannot guarantee the accuracy or reliability of the UK49s results. Any winnings should be confirmed with the official UK49s website or authorized distributors.'
|
|
13
|
+
)
|
|
14
|
+
).toBeTruthy();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
/* eslint-disable react/button-has-type */
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import Tabs from 'gatsby-core-theme/src/hooks/tabs';
|
|
6
|
+
import { formatDate } from 'gatsby-core-theme/src/helpers/date-time';
|
|
7
|
+
import styles from './styles.module.scss';
|
|
8
|
+
import ListItems from './listItems';
|
|
9
|
+
|
|
10
|
+
export default function LottoUK49({ serverData = [], module }) {
|
|
11
|
+
if(serverData.length === 0) return;
|
|
12
|
+
const daysOfWeek = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
13
|
+
const monthsOfYear = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec',];
|
|
14
|
+
|
|
15
|
+
const filterTabs =
|
|
16
|
+
serverData &&
|
|
17
|
+
Array.from(
|
|
18
|
+
new Set(serverData?.tabs.map((res) => formatDate(new Date(res.drawDate), 'DD/MM/YYYY', '-')))
|
|
19
|
+
);
|
|
20
|
+
filterTabs.unshift('Latest');
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Tabs
|
|
24
|
+
module={module}
|
|
25
|
+
showNumberOfResults
|
|
26
|
+
headerClass="lottoTabs"
|
|
27
|
+
activeTabClass="lottoTabsActive"
|
|
28
|
+
>
|
|
29
|
+
{filterTabs?.map((res, index) => {
|
|
30
|
+
const isLatestTab = res === 'Latest';
|
|
31
|
+
const label = isLatestTab
|
|
32
|
+
? res
|
|
33
|
+
: daysOfWeek[new Date(serverData.tabs[index - 1].drawDate).getDay()];
|
|
34
|
+
|
|
35
|
+
const results = isLatestTab
|
|
36
|
+
? null
|
|
37
|
+
: `${monthsOfYear[new Date(serverData.tabs[index - 1].drawDate).getMonth()]} ${new Date(
|
|
38
|
+
serverData.tabs[index - 1].drawDate
|
|
39
|
+
).getDate()}`;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div label={label} results={results} key={res} className={styles.container}>
|
|
43
|
+
<ListItems tab={res} serverData={serverData?.data} />
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
})}
|
|
47
|
+
</Tabs>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
5
|
+
import styles from './styles.module.scss';
|
|
6
|
+
import LottoIcon from '../../../../images/icons/lotto';
|
|
7
|
+
import BoosterLoto from '../../../../images/icons/booster-loto';
|
|
8
|
+
import months from '../../../../constants/months';
|
|
9
|
+
|
|
10
|
+
function Item({ drawDate, lottery, drawDetails }) {
|
|
11
|
+
const date = new Date(drawDate);
|
|
12
|
+
const formatDate = `${date.getDate()} ${useTranslate(months[date.getMonth()], months[date.getMonth()]) } ${date.getFullYear()}`;
|
|
13
|
+
return (
|
|
14
|
+
<div className={`${styles.item} ${styles[lottery]}`}>
|
|
15
|
+
<div className={styles.info}>
|
|
16
|
+
<p className={styles.date}>{formatDate}</p>
|
|
17
|
+
<p className={styles.text}>
|
|
18
|
+
{`${useTranslate('lotto_uk_49_text_1', 'UK 49s')} ${useTranslate(lottery, lottery)} ${useTranslate('lotto_uk_49_text_2', 'Result For Today')}`}
|
|
19
|
+
</p>
|
|
20
|
+
</div>
|
|
21
|
+
<div className={styles.lottos}>
|
|
22
|
+
{drawDetails &&
|
|
23
|
+
drawDetails[0]?.lottery_numbers.map((res) => (
|
|
24
|
+
<div key={res} className={styles.lottoIcon}>
|
|
25
|
+
<LottoIcon number={res} />
|
|
26
|
+
</div>
|
|
27
|
+
))}
|
|
28
|
+
<div className={styles.booster}>
|
|
29
|
+
<BoosterLoto />
|
|
30
|
+
<span className={styles.boosterValue}>{drawDetails && drawDetails[0]?.bonus_number}</span>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
Item.propTypes = {
|
|
38
|
+
drawDate: PropTypes.string,
|
|
39
|
+
lottery: PropTypes.string,
|
|
40
|
+
drawDetails: PropTypes.arrayOf(
|
|
41
|
+
PropTypes.shape({
|
|
42
|
+
lottery_numbers: PropTypes.arrayOf(PropTypes.number),
|
|
43
|
+
bonus_number: PropTypes.number,
|
|
44
|
+
})
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default Item;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
.item {
|
|
2
|
+
padding: 1.6rem;
|
|
3
|
+
border-top-left-radius: 0.8rem;
|
|
4
|
+
border-bottom-left-radius: 0.8rem;
|
|
5
|
+
gap: 2.6rem;
|
|
6
|
+
|
|
7
|
+
@include flex-direction(column);
|
|
8
|
+
|
|
9
|
+
@include min(tablet) {
|
|
10
|
+
padding: 2.4rem;
|
|
11
|
+
|
|
12
|
+
@include flex-direction(row);
|
|
13
|
+
@include flex-align(center, space-between);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.lunchtime {
|
|
18
|
+
background: linear-gradient(
|
|
19
|
+
90deg,
|
|
20
|
+
var(--lunchtime-background-color-1, #fbf3e5) 0%,
|
|
21
|
+
var(--lunchtime-background-color-2, #fff) 100%
|
|
22
|
+
);
|
|
23
|
+
border-left: 1rem solid var(--lunchtime-border-color, #eaaa3b);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.teatime {
|
|
27
|
+
background: linear-gradient(
|
|
28
|
+
90deg,
|
|
29
|
+
var(--teatime-background-color-1, #e2d6fa) 0%,
|
|
30
|
+
var(--teatime-background-color-2, #fff) 100%
|
|
31
|
+
);
|
|
32
|
+
border-left: 1rem solid var(--teatime-border-color, #6e33e5);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.info {
|
|
36
|
+
@include flex-direction(column);
|
|
37
|
+
|
|
38
|
+
gap: 0.8rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.date {
|
|
42
|
+
font-weight: 400;
|
|
43
|
+
font-size: 1.6rem;
|
|
44
|
+
line-height: 2.4rem;
|
|
45
|
+
color: #212529;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.text {
|
|
49
|
+
font-weight: 700;
|
|
50
|
+
font-size: 1.8rem;
|
|
51
|
+
line-height: 2.4rem;
|
|
52
|
+
text-transform: capitalize;
|
|
53
|
+
color: #171D39;
|
|
54
|
+
|
|
55
|
+
@include min(tablet) {
|
|
56
|
+
font-size: 2.4rem;
|
|
57
|
+
line-height: 2.4rem;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.lottos {
|
|
62
|
+
@include flex-direction(row);
|
|
63
|
+
@include flex-align(center, start);
|
|
64
|
+
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.lottoIcon {
|
|
68
|
+
position: relative;
|
|
69
|
+
margin-left: -1rem;
|
|
70
|
+
|
|
71
|
+
@include min(tablet){
|
|
72
|
+
margin-left: 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.booster {
|
|
77
|
+
position: relative;
|
|
78
|
+
margin-bottom: -4rem;
|
|
79
|
+
|
|
80
|
+
@include flex-direction(row);
|
|
81
|
+
@include flex-align(center, center);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.boosterValue {
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: 1.3rem;
|
|
87
|
+
width: fit-content;
|
|
88
|
+
font-weight: 700;
|
|
89
|
+
color: #000;
|
|
90
|
+
height: fit-content;
|
|
91
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
import React, { useEffect, useState, useCallback } from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { FaRegCalendarAlt } from "@react-icons/all-files/fa/FaRegCalendarAlt";
|
|
5
|
+
import useTranslate from '~hooks/useTranslate/useTranslate';
|
|
6
|
+
import styles from './styles.module.scss';
|
|
7
|
+
import Item from '../item';
|
|
8
|
+
import { getLottoUKdata } from '../../../../gatsby-core-theme/helpers/services';
|
|
9
|
+
|
|
10
|
+
export default function ListItems({ serverData, tab }) {
|
|
11
|
+
const [data, setData] = useState(null);
|
|
12
|
+
const fetchData = async () => {
|
|
13
|
+
const res = await Promise.all(
|
|
14
|
+
['lunchtime', 'teatime'].map(
|
|
15
|
+
async (type) =>
|
|
16
|
+
// eslint-disable-next-line no-return-await
|
|
17
|
+
await getLottoUKdata(
|
|
18
|
+
false,
|
|
19
|
+
false,
|
|
20
|
+
null,
|
|
21
|
+
`uk49s-${type}-result-${tab.split('-').reverse().join('-')}`
|
|
22
|
+
)
|
|
23
|
+
)
|
|
24
|
+
);
|
|
25
|
+
setData(res.filter(n=>n!==undefined));
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (tab === 'Latest') {
|
|
30
|
+
setData(serverData);
|
|
31
|
+
} else {
|
|
32
|
+
fetchData();
|
|
33
|
+
}
|
|
34
|
+
}, [serverData, tab]);
|
|
35
|
+
|
|
36
|
+
const filterData = data && data.sort((a, b) => new Date(b.drawDate) - new Date(a.drawDate));
|
|
37
|
+
|
|
38
|
+
const itemView = useCallback(
|
|
39
|
+
() =>
|
|
40
|
+
filterData?.map((res, index) => (
|
|
41
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
42
|
+
<Item key={index} {...res} />
|
|
43
|
+
)),
|
|
44
|
+
[filterData]
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
<div className={styles.resultInfo}>
|
|
51
|
+
<div className={styles.drawDate}>
|
|
52
|
+
<FaRegCalendarAlt size={20} color='#e00028' />
|
|
53
|
+
{useTranslate('draw_date', 'Draw Date')}</div>
|
|
54
|
+
</div>
|
|
55
|
+
<div className={styles.lottoTypes}>
|
|
56
|
+
<div className={styles.type}>
|
|
57
|
+
<span className={styles.circle} />
|
|
58
|
+
<span className={styles.textType}>{useTranslate('lunchtime', 'Lunchtime')}</span>
|
|
59
|
+
</div>
|
|
60
|
+
<div className={styles.type}>
|
|
61
|
+
<span className={`${styles.circle} ${styles.circle2}`} />
|
|
62
|
+
<span className={`${styles.textType} ${styles.text2Type}`}>
|
|
63
|
+
{useTranslate('teatime', 'Teatime')}
|
|
64
|
+
</span>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
<div className={styles.items}>{filterData && itemView()}</div>
|
|
68
|
+
</>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
ListItems.propTypes = {
|
|
73
|
+
serverData: PropTypes.arrayOf({}),
|
|
74
|
+
tab: PropTypes.string,
|
|
75
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
.resultInfo {
|
|
2
|
+
@include flex-direction(column);
|
|
3
|
+
|
|
4
|
+
gap: 2.4rem;
|
|
5
|
+
padding-top: 2rem;
|
|
6
|
+
|
|
7
|
+
@include min(tablet) {
|
|
8
|
+
@include flex-direction(row);
|
|
9
|
+
@include flex-align(center, space-between);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.drawDate {
|
|
14
|
+
color: var(--lotto-uk-49-drawDate-color, #e00028);
|
|
15
|
+
font-size: 1.6rem;
|
|
16
|
+
line-height: 3rem;
|
|
17
|
+
font-weight: bold;
|
|
18
|
+
|
|
19
|
+
@include flex-direction(row);
|
|
20
|
+
@include flex-align(center, start);
|
|
21
|
+
|
|
22
|
+
margin-bottom: 2.4rem;
|
|
23
|
+
padding-left: 1.2rem;
|
|
24
|
+
margin-top: 1rem;
|
|
25
|
+
|
|
26
|
+
>svg{
|
|
27
|
+
margin-right: 1.6rem;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.lottoTypes {
|
|
32
|
+
@include flex-direction(row);
|
|
33
|
+
|
|
34
|
+
margin-bottom: 2.4rem;
|
|
35
|
+
gap: 1.6rem;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.type {
|
|
39
|
+
@include flex-direction(row);
|
|
40
|
+
@include flex-align(center, start);
|
|
41
|
+
|
|
42
|
+
gap: 1.6rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.textType {
|
|
46
|
+
font-size: 1.6rem;
|
|
47
|
+
line-height: 3rem;
|
|
48
|
+
font-weight: 700;
|
|
49
|
+
color: var(--lotto-uk-49-text1-color, #eaaa3b);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.text2Type {
|
|
53
|
+
color: var(--lotto-uk-49-text2-color, #6e33e5);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.circle {
|
|
57
|
+
width: 1.8rem;
|
|
58
|
+
height: 1.8rem;
|
|
59
|
+
border-radius: 50%;
|
|
60
|
+
background: linear-gradient(to right, #eaaa3b 50%, #fbf3e5 50%);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.circle2 {
|
|
64
|
+
background: linear-gradient(to right, #6e33e5 50%, #e2d6fa 50%);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.items {
|
|
68
|
+
@include flex-direction(column);
|
|
69
|
+
|
|
70
|
+
gap: 1.6rem;
|
|
71
|
+
min-height: 34.6rem;
|
|
72
|
+
|
|
73
|
+
@include min(tablet){
|
|
74
|
+
min-height: 22.4rem;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import {
|
|
4
|
+
Title,
|
|
5
|
+
Description,
|
|
6
|
+
Primary,
|
|
7
|
+
PRIMARY_STORY,
|
|
8
|
+
ArgsTable,
|
|
9
|
+
} from '@storybook/addon-docs/blocks';
|
|
10
|
+
import data from '../../../../tests/factories/lotto/lotto-uk-49';
|
|
11
|
+
|
|
12
|
+
import LottoUK49 from '.';
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: 'Theme/Modules/Template Blocks/Lotto/Lotto UK 49',
|
|
16
|
+
component: LottoUK49,
|
|
17
|
+
argTypes: {
|
|
18
|
+
serverData: {
|
|
19
|
+
control: 'array',
|
|
20
|
+
description: 'Data for the LottoUK49 component',
|
|
21
|
+
defaultValue: data,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
parameters: {
|
|
25
|
+
docs: {
|
|
26
|
+
description: {
|
|
27
|
+
component: 'Lotto UK 49',
|
|
28
|
+
},
|
|
29
|
+
page: () => (
|
|
30
|
+
<>
|
|
31
|
+
<Title />
|
|
32
|
+
<Description />
|
|
33
|
+
<Primary />
|
|
34
|
+
<ArgsTable story={PRIMARY_STORY} />
|
|
35
|
+
</>
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const Template = (args) => <LottoUK49 {...args} />;
|
|
42
|
+
|
|
43
|
+
export const Default = Template.bind({});
|
|
44
|
+
Default.args = {
|
|
45
|
+
serverData: data,
|
|
46
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* eslint-disable react/prop-types */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
5
|
+
import LottoUK49 from '.';
|
|
6
|
+
import data from '../../../../tests/factories/lotto/lotto-uk-49';
|
|
7
|
+
|
|
8
|
+
describe('LottoUK49 Component', () => {
|
|
9
|
+
test('renders without crashing with serverData', () => {
|
|
10
|
+
const { getByText } = render(<LottoUK49 serverData={data} />);
|
|
11
|
+
expect(getByText('Draw Date')).toBeTruthy();
|
|
12
|
+
expect(getByText('Lunchtime')).toBeTruthy();
|
|
13
|
+
expect(getByText('Teatime')).toBeTruthy();
|
|
14
|
+
expect(getByText('UK 49s lunchtime Result For Today')).toBeTruthy();
|
|
15
|
+
expect(getByText('UK 49s teatime Result For Today')).toBeTruthy();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('renders without data with serverData', () => {
|
|
19
|
+
const { container } = render(<LottoUK49 serverData={[]} />);
|
|
20
|
+
expect(container.firstChild).toBeNull();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// need add more tests when we have new APIs
|