Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b447d45
add services to config
pvaliani Apr 7, 2026
5eb49f5
add logic for ukchina article page support
pvaliani Apr 7, 2026
fbcac40
new navigation styles for button
pvaliani Apr 7, 2026
92e5b98
add header styling css for new nav and script link specs
pvaliani Apr 7, 2026
3933214
styling updates for script switch link
pvaliani Apr 7, 2026
e120108
adds tests for ukchina articles (legacy)
pvaliani Apr 7, 2026
04dfec8
fix underline header issue on brandsvg
pvaliani Apr 7, 2026
02e1186
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
pvaliani Apr 7, 2026
f06ed52
cleanup
pvaliani Apr 7, 2026
c65f2c5
update script switch typography font size
pvaliani Apr 8, 2026
f19d41f
update test and snapshots
pvaliani Apr 8, 2026
c4a6f25
tighten script switch button position to more closely match design at…
pvaliani Apr 8, 2026
e15c7b6
Merge remote-tracking branch 'origin/latest' into WS-2323-add-script-…
pvaliani Apr 8, 2026
22155fd
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
pvaliani Apr 8, 2026
c6fd858
remove article specific check on ukchina not needed
pvaliani Apr 8, 2026
25b666e
update tests
pvaliani Apr 8, 2026
206e4cc
remove isNewNavigation prop to use service list directly
pvaliani Apr 8, 2026
66825e2
update tests with isNewNavigation removed
pvaliani Apr 8, 2026
fc0f0df
update snapshots
pvaliani Apr 8, 2026
b5434ee
updates to styling to separate out classes for easier deletion
pvaliani Apr 8, 2026
989800b
add class selector to psammead brand for new nav script link style
pvaliani Apr 8, 2026
3dea0d1
adjust headerBrand to use min height for script link
pvaliani Apr 8, 2026
3d73268
update snapshots
pvaliani Apr 8, 2026
ca84a24
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
pvaliani Apr 8, 2026
e9b8e9e
update snapshots
pvaliani Apr 8, 2026
5930dfe
remove hasScriptLink prop
pvaliani Apr 9, 2026
ae80e77
remove hasScriptLink prop style
pvaliani Apr 9, 2026
2170a7c
update snapshots
pvaliani Apr 9, 2026
2533f26
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
pvaliani Apr 9, 2026
336d893
snapshot update
pvaliani Apr 9, 2026
4ce75a1
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
pvaliani Apr 9, 2026
317ee75
fix spacing issue w/ script switch relative to hamburger icon at lowe…
pvaliani Apr 9, 2026
d312f31
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
pvaliani Apr 9, 2026
cea9433
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
amoore108 Apr 14, 2026
73a91c2
Update script button font size to `12px`
amoore108 Apr 14, 2026
0edccfc
Reduce focus/hover border thickness
amoore108 Apr 14, 2026
5a704e7
Remove variant services from new nav list
amoore108 Apr 14, 2026
dd6ae8d
Merge branch 'latest' into WS-2323-add-script-switching-new-navigation
amoore108 Apr 14, 2026
fdc8523
Snapshot updates
amoore108 Apr 14, 2026
f3ed349
Update index.styles.ts
amoore108 Apr 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,76 @@ exports[`Script Link should render correctly 1`] = `
</a>
</div>
`;

exports[`Script Link should render correctly for new navigation 1`] = `
.emotion-0 {
font-size: 1rem;
line-height: 1.375rem;
font-family: Helvetica,Arial,STHeiti,华文黑体,"Microsoft YaHei",微软雅黑,SimSun,宋体;
font-style: normal;
font-weight: 400;
display: inline-block;
color: #FFFFFF;
-webkit-text-decoration: none;
text-decoration: none;
height: 2.75rem;
border: 0.0625rem solid #FFFFFF;
margin: 0.5rem 0 0.5rem 0.5rem;
min-width: 2.75rem;
text-align: center;
}

@media (min-width: 20rem) and (max-width: 37.4375rem) {
.emotion-0 {
font-size: 1rem;
line-height: 1.5rem;
}
}

@media (min-width: 37.5rem) {
.emotion-0 {
font-size: 1rem;
line-height: 1.75rem;
}
}

.emotion-0:focus span,
.emotion-0:hover span {
margin: 0;
border: 0.1875rem solid #FFFFFF;
}

@media (min-width: 25rem) {
.emotion-0 {
line-height: calc(2.25rem - 0.5rem);
}
}

@media (max-width: 24.9375rem) {
.emotion-0 {
margin: 0.5rem 0 0.5rem 0;
}
}

.emotion-1 {
margin-top: 0.1875rem;
width: 100%;
display: inline-block;
height: calc(100%);
line-height: calc(2.75rem - 0.5rem);
}

<div>
<a
class="focusIndicatorRemove emotion-0"
data-variant="simp"
href="/ukchina/simp/articles/c0e8weny66ko"
>
<span
class="emotion-1"
>
</span>
</a>
</div>
`;
36 changes: 36 additions & 0 deletions src/app/components/Header/ScriptLink/index.styles.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pixelsToRem from '#app/utilities/pixelsToRem';
import { css, Theme } from '@emotion/react';

const styles = {
Expand Down Expand Up @@ -26,6 +27,31 @@ const styles = {
margin: `${spacings.FULL}rem 0 ${spacings.FULL}rem 0`,
},
}),
newNavLink: ({ fontVariants, fontSizes, palette }: Theme) =>
css({
...fontVariants.sansRegular,
...fontSizes.minion,
position: 'relative',
display: 'flex',
justifyContent: 'center',
boxSizing: 'border-box',
color: palette.WHITE,
textDecoration: 'none',
height: `${pixelsToRem(36)}rem`,
width: `${pixelsToRem(34)}rem`,
border: `${pixelsToRem(1)}rem solid ${palette.WHITE}`,
textAlign: 'center',
whiteSpace: 'nowrap',

'&:focus::after, &:hover::after': {
content: '""',
position: 'absolute',
inset: 0,
boxSizing: 'border-box',
border: `${pixelsToRem(3)}rem solid ${palette.WHITE}`,
pointerEvents: 'none',
},
}),
container: ({ spacings }: Theme) =>
css({
marginTop: '0.1875rem',
Expand All @@ -34,5 +60,15 @@ const styles = {
height: 'calc(100%)',
lineHeight: `calc(2.75rem - ${spacings.FULL}rem)`,
}),
newNavContainer: () =>
css({
display: 'inline-flex',
alignItems: 'center',
justifyContent: 'center',
boxSizing: 'border-box',
height: '100%',
paddingInline: `${pixelsToRem(6)}rem`,
lineHeight: 1,
}),
};
export default styles;
10 changes: 10 additions & 0 deletions src/app/components/Header/ScriptLink/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ describe(`Script Link`, () => {
expect(container).toMatchSnapshot();
});

it('should render correctly for new navigation', () => {
const { container } = render(<ScriptLink />, {
toggles: enabledToggleState,
service: 'ukchina',
variant: 'trad',
pathname: '/ukchina/trad/articles/c0e8weny66ko',
});
expect(container).toMatchSnapshot();
});

describe('assertions', () => {
describe.each(['canonical', 'amp', 'lite'])('%s', platform => {
it.each`
Expand Down
12 changes: 9 additions & 3 deletions src/app/components/Header/ScriptLink/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { use } from 'react';
import useToggle from '#hooks/useToggle';
import { RequestContext } from '#app/contexts/RequestContext';
import SERVICES_WITH_NEW_NAV from '#app/components/Navigation/config';
import { ServiceContext } from '../../../contexts/ServiceContext';
import styles from './index.styles';

const ScriptLink = () => {
const { scriptLink } = use(ServiceContext);
const { scriptLink, service } = use(ServiceContext);
const { pathname, variant: currentVariant } = use(RequestContext);
const { enabled: scriptLinkEnabled } = useToggle('scriptLink');

Expand All @@ -26,15 +27,20 @@ const ScriptLink = () => {

pathPartsWithoutExtension[currentVariantIndex] = alternateVariant;
const pathToVariant = pathPartsWithoutExtension.join('/');
const useNewNavigationStyles = SERVICES_WITH_NEW_NAV.includes(service);
const linkStyles = useNewNavigationStyles ? styles.newNavLink : styles.link;
const containerStyles = useNewNavigationStyles
? styles.newNavContainer
: styles.container;

return (
<a
css={styles.link}
css={linkStyles}
href={pathToVariant}
data-variant={alternateVariant}
className="focusIndicatorRemove"
>
<span css={styles.container}>{text}</span>
<span css={containerStyles}>{text}</span>
</a>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1198,11 +1198,11 @@ exports[`PageLayoutWrapper should render default page wrapper with children 1`]
class="emotion-17 emotion-18 emotion-19"
>
<div
class="emotion-20 emotion-21"
class="brand-svg-wrapper emotion-20 emotion-21"
>
<a
aria-labelledby="BrandLink-topPage"
class="focusIndicatorRemove emotion-22 emotion-23"
class="brand-link focusIndicatorRemove emotion-22 emotion-23"
href="/news"
id="topPage"
>
Expand Down Expand Up @@ -1633,11 +1633,11 @@ exports[`PageLayoutWrapper should render default page wrapper with children 1`]
class="emotion-17 emotion-142 emotion-19"
>
<div
class="emotion-20 emotion-21"
class="brand-svg-wrapper emotion-20 emotion-21"
>
<a
aria-labelledby="BrandLink-footer"
class="focusIndicatorRemove emotion-22 emotion-23"
class="brand-link focusIndicatorRemove emotion-22 emotion-23"
href="/news"
id="footer"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ exports[`BrandContainer should render correctly 1`] = `
class="emotion-0 emotion-1 emotion-2"
>
<div
class="emotion-3 emotion-4"
class="brand-svg-wrapper emotion-3 emotion-4"
>
<a
aria-labelledby="BrandLink-null"
class="focusIndicatorRemove emotion-5 emotion-6"
class="brand-link focusIndicatorRemove emotion-5 emotion-6"
href="/news"
>
<svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ exports[`FooterContainer snapshots should render correctly 1`] = `
class="emotion-2 emotion-3 emotion-4"
>
<div
class="emotion-5 emotion-6"
class="brand-svg-wrapper emotion-5 emotion-6"
>
<a
aria-labelledby="BrandLink-footer"
class="focusIndicatorRemove emotion-7 emotion-8"
class="brand-link focusIndicatorRemove emotion-7 emotion-8"
href="/news"
id="footer"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,11 +913,11 @@ exports[`Header Snapshots should render correctly for WS TV page 1`] = `
class="emotion-16 emotion-17 emotion-18"
>
<div
class="emotion-19 emotion-20"
class="brand-svg-wrapper emotion-19 emotion-20"
>
<a
aria-labelledby="BrandLink-topPage"
class="focusIndicatorRemove emotion-21 emotion-22"
class="brand-link focusIndicatorRemove emotion-21 emotion-22"
href="/news"
id="topPage"
>
Expand Down Expand Up @@ -2248,11 +2248,11 @@ exports[`Header Snapshots should render correctly for WS on demand audio page 1`
class="emotion-16 emotion-17 emotion-18"
>
<div
class="emotion-19 emotion-20"
class="brand-svg-wrapper emotion-19 emotion-20"
>
<a
aria-labelledby="BrandLink-topPage"
class="focusIndicatorRemove emotion-21 emotion-22"
class="brand-link focusIndicatorRemove emotion-21 emotion-22"
href="/news"
id="topPage"
>
Expand Down Expand Up @@ -3583,11 +3583,11 @@ exports[`Header Snapshots should render correctly for WS radio page 1`] = `
class="emotion-16 emotion-17 emotion-18"
>
<div
class="emotion-19 emotion-20"
class="brand-svg-wrapper emotion-19 emotion-20"
>
<a
aria-labelledby="BrandLink-topPage"
class="focusIndicatorRemove emotion-21 emotion-22"
class="brand-link focusIndicatorRemove emotion-21 emotion-22"
href="/news"
id="topPage"
>
Expand Down Expand Up @@ -4918,11 +4918,11 @@ exports[`Header Snapshots should render correctly for news article 1`] = `
class="emotion-16 emotion-17 emotion-18"
>
<div
class="emotion-19 emotion-20"
class="brand-svg-wrapper emotion-19 emotion-20"
>
<a
aria-labelledby="BrandLink-topPage"
class="focusIndicatorRemove emotion-21 emotion-22"
class="brand-link focusIndicatorRemove emotion-21 emotion-22"
href="/news"
id="topPage"
>
Expand Down
9 changes: 5 additions & 4 deletions src/app/legacy/containers/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ const HeaderContainer = ({ navItems, propsForTopBarOJComponent }) => {
</SkipLink>
);

const shouldUseNewNav = SERVICES_WITH_NEW_NAV.includes(service);

let shouldRenderScriptSwitch = false;

if (scriptLink) {
Expand All @@ -102,8 +104,7 @@ const HeaderContainer = ({ navItems, propsForTopBarOJComponent }) => {
}

if (isApp) return null;

const shouldUseNewNav = SERVICES_WITH_NEW_NAV.includes(service);
const headerBrandCss = shouldUseNewNav ? styles.headerBrand : null;

const NavigationComponent = shouldUseNewNav
? NewNavigationContainer
Expand All @@ -117,7 +118,7 @@ const HeaderContainer = ({ navItems, propsForTopBarOJComponent }) => {
linkId="brandLink"
skipLink={skipLink}
scriptLink={shouldRenderScriptSwitch && <ScriptLink />}
css={shouldUseNewNav ? styles.headerBrand : null}
css={headerBrandCss}
>
<AccountHeader />
</Header>
Expand All @@ -126,7 +127,7 @@ const HeaderContainer = ({ navItems, propsForTopBarOJComponent }) => {
brandRef={brandRef}
skipLink={skipLink}
scriptLink={shouldRenderScriptSwitch && <ScriptLink />}
css={shouldUseNewNav ? styles.headerBrand : null}
css={headerBrandCss}
>
<AccountHeader />
</Header>
Expand Down
Loading
Loading