Skip to content
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9dbf93f
WS-869: Inital commit
Isabella-Mitchell Nov 20, 2025
165ce78
WS-869: Adds fixture data
Isabella-Mitchell Nov 20, 2025
c229d45
WS-868: Align styles
Isabella-Mitchell Nov 20, 2025
9e313c7
WS-869: Tidy
Isabella-Mitchell Nov 20, 2025
5c80009
WS-869: Update stories, fix colour
Isabella-Mitchell Nov 20, 2025
5f946db
WS-869: Style
Isabella-Mitchell Nov 20, 2025
560eba1
Merge branch 'latest' into WS-869-align-WS-bylines-with-PS
Isabella-Mitchell Nov 25, 2025
2624936
WS-869: Refactors commas
Isabella-Mitchell Nov 25, 2025
04d26b7
WS-869: Tidies styles
Isabella-Mitchell Nov 25, 2025
a279770
WS-869: Reverts fixture data change
Isabella-Mitchell Nov 25, 2025
b57ebb8
WS-869: Adds visuallyHiddenText for ReportingFrom
Isabella-Mitchell Nov 25, 2025
d7b3831
WS-869: Aligns unit tests with new byline design
Isabella-Mitchell Nov 25, 2025
1e72340
WS-869: Adds test coverage for byline and subByline block types in Ar…
Isabella-Mitchell Nov 25, 2025
884e1e9
WS-869: Deletes fixture data file
Isabella-Mitchell Nov 25, 2025
b2d5f87
WS-869: Fixes comma
Isabella-Mitchell Nov 25, 2025
9aa14a0
WS-869: Removes 4 contributor cap
Isabella-Mitchell Nov 25, 2025
5557c54
WS-869: Fixes bug - gets current contributor topicURL, not the first …
Isabella-Mitchell Nov 26, 2025
807b7af
WS-869: Align single contributor styles more with PS
Isabella-Mitchell Nov 26, 2025
11d9581
WS-869: Tidy
Isabella-Mitchell Nov 26, 2025
07dd83e
Merge branch 'latest' into WS-869-align-WS-bylines-with-PS
Isabella-Mitchell Nov 26, 2025
df3eeb5
WS-869: Removes redudant grid styles
Isabella-Mitchell Nov 26, 2025
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
106 changes: 44 additions & 62 deletions src/app/components/Byline/index.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,78 +4,62 @@ import pixelsToRem from '../../utilities/pixelsToRem';
export default {
bylineContainer: ({ spacings, mq }: Theme) =>
css({
display: 'grid',
paddingInlineStart: `${spacings.FULL}rem`,
[mq.GROUP_1_MIN_WIDTH]: {
gridTemplateColumns: 'repeat(2, auto)',
},
paddingBottom: `${spacings.TRIPLE}rem`,
lineHeight: '1.35rem', // not sure I should do this due to script sizes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I should do this due to Script Sizes. The benefit is that gives a bit more breathing room on latin languages (e.g. News, Mundo). And if I look at a service with a larger script (e.g. Sinhala), then I can see the default service line height overwrites this. The negative is that the designs only account for latin designs.

[mq.GROUP_2_MIN_WIDTH]: {
display: 'flex',
flexWrap: 'wrap',
paddingInlineStart: `${spacings.DOUBLE}rem`,
},
[mq.GROUP_4_MIN_WIDTH]: { paddingInlineStart: 0 },
}),

bylineSection: ({ spacings, mq }: Theme) =>
bylineContainerSingleContributor: ({ mq }: Theme) =>
css({
marginRight: `${spacings.FULL}rem`,
marginBottom: `${spacings.FULL}rem`,
[mq.GROUP_3_MIN_WIDTH]: {
marginRight: `${spacings.DOUBLE}rem`,
marginBottom: 0,
display: 'grid',
[mq.GROUP_1_MIN_WIDTH]: {
gridTemplateColumns: 'repeat(2, auto)',
},
[mq.GROUP_2_MIN_WIDTH]: {
display: 'flex',
flexWrap: 'wrap',
},
}),

bylineList: () => css({ listStyle: 'none', padding: 0, margin: 0 }),
list: () => css({ listStyle: 'none', padding: 0, margin: 0 }),

author: ({ palette, isDarkUi }: Theme) =>
css({
color: isDarkUi ? palette.GREY_2 : palette.GREY_10,
display: 'inline-block',
}),

authorSingleContributor: () =>
css({
verticalAlign: 'middle',
}),

jobRole: ({ palette, isDarkUi }: Theme) =>
css({ color: isDarkUi ? palette.GREY_2 : palette.GREY_6 }),

twitterText: ({ palette }: Theme) =>
css({
color: palette.POSTBOX,
display: 'inline-block',
verticalAlign: 'middle',
}),
comma: ({ palette, isDarkUi }: Theme) =>
css({ color: isDarkUi ? palette.GREY_2 : palette.GREY_6 }),

authorChevron: ({ palette, isDarkUi, spacings, mq }: Theme) =>
css({
verticalAlign: 'middle',
margin: `0 ${spacings.HALF}rem`,
color: isDarkUi ? palette.GREY_2 : palette.GREY_10,
fill: 'currentcolor',
width: `${spacings.FULL + spacings.HALF}rem`,
height: `${spacings.FULL + spacings.HALF}rem`,
[mq.FORCED_COLOURS]: { fill: 'linkText' },
}),

twitterChevron: ({ palette, spacings, mq }: Theme) =>
css({
verticalAlign: 'middle',
margin: `0 ${spacings.HALF}rem`,
color: palette.POSTBOX,
fill: 'currentcolor',
width: `${spacings.FULL}rem`,
height: `${spacings.FULL}rem`,
width: `${pixelsToRem(10)}rem`,
height: `${pixelsToRem(10)}rem`,
[mq.FORCED_COLOURS]: { fill: 'linkText' },
}),

link: ({ mq, palette }: Theme) =>
css({
display: 'inline-block',
textDecoration: 'none',
paddingInlineEnd: '2.75rem',
'&:focus, &:hover': {
'.byline-link': {
textDecoration: 'underline',
color: palette.POSTBOX,
},
},
Expand All @@ -93,37 +77,36 @@ export default {
},
}),

location: () =>
css({
margin: '0',
display: 'block',
clear: 'both',
}),

locationText: ({ palette, isDarkUi }: Theme) =>
linkMultipleContributor: ({ palette }: Theme) =>
css({
color: isDarkUi ? palette.GREY_2 : palette.SHADOW,
display: 'block',
paddingTop: ` ${pixelsToRem(4)}rem`,
'.byline-link': {
textDecoration: 'underline',
textDecorationThickness: `${pixelsToRem(1)}rem`,
textUnderlineOffset: `${pixelsToRem(4)}rem`,
textDecorationColor: palette.GREY_5,
'&:focus, &:hover': {
textDecorationColor: palette.POSTBOX,
},
},
}),

reportingFromText: ({ palette, isDarkUi }: Theme) =>
linkSingleContributor: () =>
css({
color: isDarkUi ? palette.GREY_2 : palette.SHADOW,
paddingInlineEnd: '2.75rem',
textDecoration: 'none',
'&:focus, &:hover': {
'.byline-link': {
textDecoration: 'underline',
textDecorationColor: 'currentcolor',
textDecorationThickness: `${pixelsToRem(2)}rem`,
textUnderlineOffset: `${pixelsToRem(4)}rem`,
},
},
}),

timestampLineBreak: ({ palette, spacings, mq }: Theme) =>
locationText: ({ palette, isDarkUi }: Theme) =>
css({
// EXPERIMENT: Article Read Time
'&:nth-child(2)::before': {
content: '""',
borderTop: `${pixelsToRem(2)}rem solid ${palette.GREY_5}`,
width: `${pixelsToRem(40)}rem`,
display: 'block',
margin: `${spacings.DOUBLE}rem ${spacings.FULL}rem`,
[mq.GROUP_2_MIN_WIDTH]: { margin: `${spacings.DOUBLE}rem` },
[mq.GROUP_4_MIN_WIDTH]: { margin: `${spacings.DOUBLE}rem 0` },
},
color: isDarkUi ? palette.GREY_2 : palette.GREY_6,
}),

ImageWrapper: ({ palette }: Theme) =>
Expand Down Expand Up @@ -163,9 +146,8 @@ export default {
height: `${pixelsToRem(80)}rem`,
}),

twitterLink: () =>
displayInline: () =>
css({
paddingBottom: `${pixelsToRem(22)}rem`,
paddingTop: `${pixelsToRem(4)}rem`,
display: `inline`,
}),
};
16 changes: 4 additions & 12 deletions src/app/components/Byline/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ describe('Byline', () => {
render(<Byline blocks={bylineWithLink} />);

const AuthorLink = screen.getByText('Single Byline (all values)');
const TwitterLink = screen.getByText('@test');
const Links = screen.getAllByRole('link');

expect(AuthorLink).toBeInTheDocument();
expect(TwitterLink).toBeInTheDocument();
expect(Links.length).toBe(2);
expect(Links.length).toBe(1);
expect(Links[0]).toHaveAttribute('href', '/news/topics/c8qx38nq177t');
expect(Links[1]).toHaveAttribute('href', 'https://twitter.com/test');
});

it('should render a section with role region', () => {
Expand All @@ -70,7 +67,7 @@ describe('Byline', () => {
const firstContributorItems =
within(firstContributor).getAllByRole('listitem');

expect(firstContributorItems.length).toBe(5);
expect(firstContributorItems.length).toBe(4);
});

it('should correctly use the buildIChefURL function to create the image url', () => {
Expand Down Expand Up @@ -135,14 +132,10 @@ describe('Byline', () => {
render(<Byline blocks={bylineWithPngPhoto} />);

const AuthorLink = screen.getByText('Mayeni Jones');
const TwitterLink = screen.getByText('@MayeniJones');
const Links = screen.getAllByRole('link');
const Location = screen.getByText('Lagos, Nigeria');
const Image = screen.getByRole('img');

expect(AuthorLink).toBeInTheDocument();
expect(TwitterLink).toBeInTheDocument();
expect(Links.length).toBe(1);
expect(Location).toBeInTheDocument();
expect(Image).toBeInTheDocument();
});
Expand All @@ -151,8 +144,7 @@ describe('Byline', () => {
expectation | info | text
${'Author'} | ${'Author'} | ${'Author,'}
${'Role'} | ${'Role'} | ${'Role,'}
${'X'} | ${'X'} | ${'X,'}
${'Reporting from'} | ${'Reporting from'} | ${'Reporting from'}
${'Reporting from'} | ${'Reporting from'} | ${'Reporting from,'}
`('should correctly announce $expectation for $info', ({ text }) => {
render(
<Byline blocks={bylineWithLinkAndLocation}>
Expand All @@ -173,7 +165,7 @@ describe('Byline', () => {
info | translation
${'author'} | ${'Barreessaa,'}
${'role'} | ${'Gahee,'}
${'reportingFrom'} | ${'Gabaasni irraati'}
${'reportingFrom'} | ${'Gabaasni irraati,'}
`('should translate $info announcement correctly', ({ translation }) => {
render(
<Byline blocks={bylineWithLinkAndLocation}>
Expand Down
Loading
Loading