File tree Expand file tree Collapse file tree 4 files changed +36
-47
lines changed
dotcom-rendering/src/components Expand file tree Collapse file tree 4 files changed +36
-47
lines changed Original file line number Diff line number Diff line change 1+ import type { Region } from '../footballMatches' ;
2+ import { FootballCompetitionSelect } from './FootballCompetitionSelect' ;
3+
4+ const goToCompetitionSpecificPage =
5+ ( guardianBaseUrl : string ) => ( path : string ) => {
6+ const url = `${ guardianBaseUrl } ${ path } ` ;
7+ window . location . assign ( url ) ;
8+ } ;
9+
10+ type Props = {
11+ regions : Region [ ] ;
12+ pageId : string ;
13+ guardianBaseUrl : string ;
14+ } ;
15+
16+ export const FootballTablesCompetitionSelect = ( {
17+ regions,
18+ pageId,
19+ guardianBaseUrl,
20+ } : Props ) => (
21+ < FootballCompetitionSelect
22+ regions = { regions }
23+ pageId = { pageId }
24+ onChange = { goToCompetitionSpecificPage ( guardianBaseUrl ) }
25+ kind = "Tables"
26+ />
27+ ) ;
Original file line number Diff line number Diff line change 11import type { Meta , StoryObj } from '@storybook/react/*' ;
2- import { fn } from '@storybook/test' ;
32import { regions } from '../../fixtures/manual/footballData' ;
43import { FootballTableList as TableListDefault } from './FootballTableList.stories' ;
54import { FootballTablesPage as FootballTablesPageComponent } from './FootballTablesPage' ;
@@ -16,7 +15,6 @@ type Story = StoryObj<typeof meta>;
1615export const FootballTablesPage = {
1716 args : {
1817 regions,
19- goToCompetitionSpecificPage : fn ( ) ,
2018 pageId : 'football/tables' ,
2119 competitions : TableListDefault . args . competitions ,
2220 renderAds : true ,
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ import type { FootballTableCompetition } from '../footballTables';
1010import { grid } from '../grid' ;
1111import { palette } from '../palette' ;
1212import { AdSlot } from './AdSlot.web' ;
13- import { FootballCompetitionSelect } from './FootballCompetitionSelect' ;
1413import { FootballTableList } from './FootballTableList' ;
14+ import { FootballTablesCompetitionSelect } from './FootballTablesCompetitionSelect.importable' ;
15+ import { Island } from './Island' ;
1516
1617type Props = {
1718 regions : Region [ ] ;
1819 pageId : string ;
19- goToCompetitionSpecificPage : ( tag : string ) => void ;
2020 competitions : FootballTableCompetition [ ] ;
2121 renderAds : boolean ;
2222 guardianBaseUrl : string ;
@@ -25,7 +25,6 @@ type Props = {
2525export const FootballTablesPage = ( {
2626 regions,
2727 pageId,
28- goToCompetitionSpecificPage,
2928 competitions,
3029 renderAds,
3130 guardianBaseUrl,
@@ -75,12 +74,13 @@ export const FootballTablesPage = ({
7574 grid-row : 2 ;
7675 ` }
7776 >
78- < FootballCompetitionSelect
79- regions = { regions }
80- kind = "Tables"
81- pageId = { pageId }
82- onChange = { goToCompetitionSpecificPage }
83- />
77+ < Island priority = "feature" defer = { { until : 'visible' } } >
78+ < FootballTablesCompetitionSelect
79+ regions = { regions }
80+ pageId = { pageId }
81+ guardianBaseUrl = { guardianBaseUrl }
82+ />
83+ </ Island >
8484 </ div >
8585 < div
8686 css = { css `
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments