Skip to content

Commit 23a8130

Browse files
Football tables - reorder the heading in the DOM (#13694)
re-order the heading in the DOM but visually keep the same order. This keeps ordering in line with docs
1 parent 4b8e668 commit 23a8130

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

dotcom-rendering/src/components/FootballTableList.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,17 @@ const footballTablesGridStyles = css`
4242
}
4343
`;
4444

45-
const CompetitionName = ({ children }: { children: ReactNode }) => (
45+
const CompetitionName = ({
46+
children,
47+
hasGroups,
48+
}: {
49+
children: ReactNode;
50+
hasGroups: boolean;
51+
}) => (
4652
<h2
4753
css={css`
4854
${textSansBold14}
55+
grid-row: ${hasGroups ? 2 : 1};
4956
grid-column: centre-column-start / centre-column-end;
5057
color: ${palette('--football-competition-text')};
5158
border-top: 1px solid ${palette('--football-top-border')};
@@ -79,6 +86,7 @@ const GroupName = ({
7986
<h3
8087
css={css`
8188
grid-column: centre-column-start / centre-column-end;
89+
grid-row: ${1 + 3 * index};
8290
padding-top: ${space[1]}px;
8391
padding-bottom: ${space[3]}px;
8492
border-top: 1px solid ${palette('--football-list-border')};
@@ -102,15 +110,12 @@ export const FootballTableList = ({ competitions, guardianBaseUrl }: Props) => (
102110
<section key={competition.name} css={footballTablesGridStyles}>
103111
{competition.tables.map((table, groupIndex) => (
104112
<>
105-
{competition.hasGroups && (
106-
<GroupName index={groupIndex}>
107-
{table.groupName}
108-
</GroupName>
109-
)}
110113
{
111114
// Only show the competition name above/beside the first group
112115
groupIndex === 0 && (
113-
<CompetitionName>
116+
<CompetitionName
117+
hasGroups={competition.hasGroups}
118+
>
114119
<a
115120
href={`${guardianBaseUrl}${competition.url}`}
116121
css={css`
@@ -126,8 +131,16 @@ export const FootballTableList = ({ competitions, guardianBaseUrl }: Props) => (
126131
</CompetitionName>
127132
)
128133
}
134+
{competition.hasGroups && (
135+
<GroupName index={groupIndex}>
136+
{table.groupName}
137+
</GroupName>
138+
)}
129139
<div
130140
css={css`
141+
grid-row: ${competition.hasGroups
142+
? 3 + 3 * groupIndex
143+
: 1};
131144
grid-column: centre-column-start /
132145
centre-column-end;
133146
`}

0 commit comments

Comments
 (0)