@newskit-render/core 2.35.3 → 2.36.0
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 +8 -0
- package/package.json +1 -1
- package/temp/header.tsx +20 -251
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.35.3](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.35.3-alpha.0...@newskit-render/core@2.35.3) (2022-12-23)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @newskit-render/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.35.2](https://github.com/newscorp-ghfb/ncu-newskit-render/compare/@newskit-render/core@2.35.2-alpha.0...@newskit-render/core@2.35.2) (2022-12-22)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @newskit-render/core
|
package/package.json
CHANGED
package/temp/header.tsx
CHANGED
|
@@ -1,269 +1,38 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
Cell,
|
|
4
|
-
styled,
|
|
5
|
-
getColorCssFromTheme,
|
|
6
|
-
getSizingCssFromTheme,
|
|
7
|
-
getFontsFromTheme,
|
|
8
|
-
Visible,
|
|
9
|
-
getMediaQueryFromTheme,
|
|
10
|
-
Stack,
|
|
11
|
-
Block,
|
|
12
|
-
toNewsKitIcon,
|
|
13
|
-
} from 'newskit'
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
|
+
import { styled, Block } from 'newskit'
|
|
14
3
|
import { UserData } from '@newskit-render/my-account'
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import { IconAccount } from '../common/icons/IconAccount'
|
|
23
|
-
import { Menu as FilledMenu } from '@emotion-icons/material/Menu'
|
|
24
|
-
|
|
25
|
-
const IconFilledMenu = toNewsKitIcon(FilledMenu)
|
|
4
|
+
import {
|
|
5
|
+
PastDueBannerExternal,
|
|
6
|
+
NavigationPrimary,
|
|
7
|
+
} from '@newskit-render/shared-components'
|
|
8
|
+
import { AppContext } from '../../context'
|
|
9
|
+
import { sectionLinks } from './navigation-links'
|
|
10
|
+
import { pastDueBanner } from './banner-messages'
|
|
26
11
|
|
|
27
12
|
export const headerSize = 'sizing100'
|
|
28
13
|
|
|
29
|
-
const StyledHeader = styled.div`
|
|
30
|
-
${getSizingCssFromTheme('height', headerSize)}
|
|
31
|
-
${getColorCssFromTheme('backgroundColor', 'interfaceBrand010')};
|
|
32
|
-
a,
|
|
33
|
-
a:visited:not(:disabled) {
|
|
34
|
-
${getColorCssFromTheme('color', 'white')};
|
|
35
|
-
font-weight: bold;
|
|
36
|
-
line-height: ${getFontsFromTheme('fontLineHeight040')};
|
|
37
|
-
}
|
|
38
|
-
${getMediaQueryFromTheme('xs')} {
|
|
39
|
-
${getSizingCssFromTheme('paddingTop', 'sizing040')};
|
|
40
|
-
${getSizingCssFromTheme('paddingBottom', 'sizing040')};
|
|
41
|
-
${getSizingCssFromTheme('paddingLeft', 'sizing000')};
|
|
42
|
-
${getSizingCssFromTheme('paddingRight', 'sizing000')};
|
|
43
|
-
}
|
|
44
|
-
${getMediaQueryFromTheme('lg')} {
|
|
45
|
-
${getSizingCssFromTheme('paddingTop', 'sizing040')};
|
|
46
|
-
${getSizingCssFromTheme('paddingBottom', 'sizing040')};
|
|
47
|
-
${getSizingCssFromTheme('paddingLeft', 'sizing090')};
|
|
48
|
-
${getSizingCssFromTheme('paddingRight', 'sizing090')};
|
|
49
|
-
}
|
|
50
|
-
`
|
|
51
|
-
|
|
52
|
-
type NavigationProps = {
|
|
53
|
-
show: boolean
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const NavigationContainer = styled.div<NavigationProps>`
|
|
57
|
-
position: fixed;
|
|
58
|
-
overflow: auto;
|
|
59
|
-
width: 100%;
|
|
60
|
-
min-height: 100vh;
|
|
61
|
-
${getColorCssFromTheme('backgroundColor', 'interfaceBrand010')};
|
|
62
|
-
left: 0;
|
|
63
|
-
${getSizingCssFromTheme('top', headerSize)}
|
|
64
|
-
z-index: 2;
|
|
65
|
-
display: ${(props) => (props.show ? 'block' : 'none')};
|
|
66
|
-
|
|
67
|
-
${getMediaQueryFromTheme('md')} {
|
|
68
|
-
display: flex;
|
|
69
|
-
position: relative;
|
|
70
|
-
overflow: auto;
|
|
71
|
-
width: initial;
|
|
72
|
-
min-height: initial;
|
|
73
|
-
background-color: initial;
|
|
74
|
-
left: initial;
|
|
75
|
-
top: initial;
|
|
76
|
-
z-index: 1;
|
|
77
|
-
${getSizingCssFromTheme('height', 'sizing080')}
|
|
78
|
-
}
|
|
79
|
-
`
|
|
80
|
-
|
|
81
|
-
const Navigation = styled.div`
|
|
82
|
-
display: flex;
|
|
83
|
-
flex-flow: row wrap;
|
|
84
|
-
justify-content: space-between;
|
|
85
|
-
flex-direction: column;
|
|
86
|
-
align-items: center;
|
|
87
|
-
|
|
88
|
-
${getMediaQueryFromTheme('md')} {
|
|
89
|
-
justify-content: flex-end;
|
|
90
|
-
flex-direction: row;
|
|
91
|
-
}
|
|
92
|
-
`
|
|
93
|
-
|
|
94
|
-
const pastDueBanner = {
|
|
95
|
-
firstNotice: {
|
|
96
|
-
title: "We haven't been able to take payment",
|
|
97
|
-
text:
|
|
98
|
-
'You may need to update your payment details to keep your subscription.',
|
|
99
|
-
button: 'Update payment details',
|
|
100
|
-
},
|
|
101
|
-
secondNotice: {
|
|
102
|
-
title: 'Act now to keep your subscription',
|
|
103
|
-
text:
|
|
104
|
-
'We’ve tried several times, but haven’t been able to take payment. Please update your payment details to keep your subscription.',
|
|
105
|
-
button: 'Update payment details',
|
|
106
|
-
},
|
|
107
|
-
terminated: {
|
|
108
|
-
title: 'Your subscription has been terminated',
|
|
109
|
-
phoneNumber: 'XXXX-XXX-XXXX',
|
|
110
|
-
text:
|
|
111
|
-
'We didn’t receive payment for your subscription. To reactivate it, please call ##PHONE_NUMBER##.',
|
|
112
|
-
dismissDays: 7,
|
|
113
|
-
},
|
|
114
|
-
cancelled: {
|
|
115
|
-
title: 'Your subscription has been cancelled.',
|
|
116
|
-
phoneNumber: 'XXXX-XXX-XXXX',
|
|
117
|
-
text:
|
|
118
|
-
'You’ll no longer have access to subscription benefits. To re-activate call ##PHONE_NUMBER##.',
|
|
119
|
-
dismissDays: 7,
|
|
120
|
-
},
|
|
121
|
-
toBeCancelled: {
|
|
122
|
-
title: 'Your subscription will end soon.',
|
|
123
|
-
phoneNumber: 'XXXX-XXX-XXXX',
|
|
124
|
-
text:
|
|
125
|
-
'You have cancelled your subscription and will lose access to all benefits on ##DATE##. To re-activate your subscription call ##PHONE_NUMBER##.',
|
|
126
|
-
},
|
|
127
|
-
toBeCancelledWithRefund: {
|
|
128
|
-
title: 'Your subscription will end soon.',
|
|
129
|
-
phoneNumber: '0800 xxxx xxxxx',
|
|
130
|
-
text:
|
|
131
|
-
'We have successfully cancelled your subscription and will be processing your refund shortly. If you have any question please call ##PHONE_NUMBER##.',
|
|
132
|
-
dismissDays: 7,
|
|
133
|
-
},
|
|
134
|
-
treshold: {
|
|
135
|
-
firstNotice: 26,
|
|
136
|
-
secondNotice: 30,
|
|
137
|
-
},
|
|
138
|
-
}
|
|
139
|
-
|
|
140
14
|
const BannerContainer = styled(Block)`
|
|
141
15
|
position: sticky;
|
|
142
16
|
top: 0;
|
|
143
17
|
z-index: 1;
|
|
144
18
|
`
|
|
145
19
|
|
|
146
|
-
const NavButton = ({
|
|
147
|
-
buttonText,
|
|
148
|
-
href,
|
|
149
|
-
ariaLabel,
|
|
150
|
-
}: {
|
|
151
|
-
buttonText: string
|
|
152
|
-
href: string
|
|
153
|
-
isLast?: boolean
|
|
154
|
-
ariaLabel?: string
|
|
155
|
-
}) => (
|
|
156
|
-
<Block
|
|
157
|
-
as="span"
|
|
158
|
-
spaceInline={{
|
|
159
|
-
xs: 'space000',
|
|
160
|
-
md: 'space040',
|
|
161
|
-
}}
|
|
162
|
-
spaceStack={{
|
|
163
|
-
xs: 'space050',
|
|
164
|
-
md: 'space000',
|
|
165
|
-
}}
|
|
166
|
-
>
|
|
167
|
-
<NavLink href={href} ariaLabel={ariaLabel} buttonText={buttonText} />
|
|
168
|
-
</Block>
|
|
169
|
-
)
|
|
170
|
-
|
|
171
|
-
|
|
172
20
|
const Header: React.FC<{ user: UserData }> = ({ user }) => {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
21
|
+
const navigationPrimary = {
|
|
22
|
+
nav: sectionLinks,
|
|
23
|
+
loggedInUser: !!user,
|
|
24
|
+
gridOverrides: {
|
|
25
|
+
width: '100%',
|
|
26
|
+
maxWidth: '1920px',
|
|
27
|
+
marginInline: 'auto',
|
|
28
|
+
},
|
|
178
29
|
}
|
|
179
30
|
|
|
31
|
+
const { theme } = useContext(AppContext)
|
|
32
|
+
|
|
180
33
|
return (
|
|
181
34
|
<>
|
|
182
|
-
<
|
|
183
|
-
<MainGrid>
|
|
184
|
-
<Cell xs={12}>
|
|
185
|
-
<Stack
|
|
186
|
-
flow="horizontal-center"
|
|
187
|
-
stackDistribution="space-between"
|
|
188
|
-
wrap="nowrap"
|
|
189
|
-
>
|
|
190
|
-
<NextLink
|
|
191
|
-
type="standalone"
|
|
192
|
-
overrides={{ stylePreset: 'linkStandaloneInverse' }}
|
|
193
|
-
href="/"
|
|
194
|
-
aria-label="Logo Link"
|
|
195
|
-
>
|
|
196
|
-
<Visible md lg xl>
|
|
197
|
-
<NewsKitLogoFull color="white" size="sizing120" />
|
|
198
|
-
</Visible>
|
|
199
|
-
<Visible xs sm>
|
|
200
|
-
<NewsKitLogoShort color="white" size="sizing120" />
|
|
201
|
-
</Visible>
|
|
202
|
-
</NextLink>
|
|
203
|
-
<Stack
|
|
204
|
-
flow="horizontal-center"
|
|
205
|
-
stackDistribution="flex-end"
|
|
206
|
-
wrap="nowrap"
|
|
207
|
-
>
|
|
208
|
-
<NavigationContainer
|
|
209
|
-
show={showMenu}
|
|
210
|
-
data-testid="NavigationContainer"
|
|
211
|
-
>
|
|
212
|
-
<Navigation data-testid="Navigation">
|
|
213
|
-
{showMenu && (
|
|
214
|
-
<Block
|
|
215
|
-
spaceStack="space050"
|
|
216
|
-
data-testid="mobile-block-space"
|
|
217
|
-
/>
|
|
218
|
-
)}
|
|
219
|
-
<NavButton
|
|
220
|
-
buttonText="Section One"
|
|
221
|
-
href="/section-one"
|
|
222
|
-
ariaLabel="Section One Link"
|
|
223
|
-
/>
|
|
224
|
-
<NavButton
|
|
225
|
-
buttonText="Section Two"
|
|
226
|
-
href="/section-two"
|
|
227
|
-
ariaLabel="Section Two Link"
|
|
228
|
-
/>
|
|
229
|
-
<NavButton
|
|
230
|
-
buttonText="Section Three"
|
|
231
|
-
href="/section-three"
|
|
232
|
-
ariaLabel="Section Three Link"
|
|
233
|
-
/>
|
|
234
|
-
{user && (
|
|
235
|
-
<IconNavLink
|
|
236
|
-
icon={<IconAccount data-testid="account-link" />}
|
|
237
|
-
href="/account"
|
|
238
|
-
text="Account"
|
|
239
|
-
spaceInline="space040"
|
|
240
|
-
typographyPreset="utilityMeta020"
|
|
241
|
-
stylePreset="linkStandaloneInverse"
|
|
242
|
-
/>
|
|
243
|
-
)}
|
|
244
|
-
</Navigation>
|
|
245
|
-
</NavigationContainer>
|
|
246
|
-
<Visible xs sm>
|
|
247
|
-
<Block spaceInline="space050">
|
|
248
|
-
<IconFilledMenu
|
|
249
|
-
overrides={{
|
|
250
|
-
size: 'iconSize030',
|
|
251
|
-
stylePreset: 'linkStandaloneInverse',
|
|
252
|
-
}}
|
|
253
|
-
onClick={mobileMenuControl}
|
|
254
|
-
onKeyDown={handleEnterKeyPress(mobileMenuControl)}
|
|
255
|
-
role="button"
|
|
256
|
-
tabIndex={0}
|
|
257
|
-
aria-label="Mobile Menu Button"
|
|
258
|
-
data-testid="mobile-menu-btn"
|
|
259
|
-
/>
|
|
260
|
-
</Block>
|
|
261
|
-
</Visible>
|
|
262
|
-
</Stack>
|
|
263
|
-
</Stack>
|
|
264
|
-
</Cell>
|
|
265
|
-
</MainGrid>
|
|
266
|
-
</StyledHeader>
|
|
35
|
+
<NavigationPrimary {...navigationPrimary} customTheme={theme} />
|
|
267
36
|
<PastDueBannerExternal
|
|
268
37
|
pastDueBanner={pastDueBanner}
|
|
269
38
|
user={user}
|