|
| 1 | +import { css } from '@emotion/react'; |
| 2 | +import { |
| 3 | + from, |
| 4 | + headlineBold15Object, |
| 5 | + headlineBold17Object, |
| 6 | + headlineBold24Object, |
| 7 | + headlineBold42Object, |
| 8 | + headlineMedium15Object, |
| 9 | + headlineMedium17Object, |
| 10 | + palette, |
| 11 | +} from '@guardian/source/foundations'; |
| 12 | +import { grid } from '../grid'; |
| 13 | + |
| 14 | +type Props = { |
| 15 | + selected: 'fixtures' | 'tables' | 'none'; |
| 16 | + pageId: string; |
| 17 | +}; |
| 18 | + |
| 19 | +export const FootballCompetitionNav = ({ selected, pageId }: Props) => |
| 20 | + pageId.includes('women-s-euro-2025') ? ( |
| 21 | + <nav css={nav}> |
| 22 | + <a |
| 23 | + href="https://www.theguardian.com/football/women-s-euro-2025" |
| 24 | + css={largeLinkStyles} |
| 25 | + > |
| 26 | + Women's Euro 2025 |
| 27 | + </a> |
| 28 | + <ul css={list}> |
| 29 | + <li |
| 30 | + css={listItem} |
| 31 | + style={selected === 'fixtures' ? selectedStyles : undefined} |
| 32 | + > |
| 33 | + <a |
| 34 | + href="https://www.theguardian.com/football/women-s-euro-2025/fixtures" |
| 35 | + css={smallLink} |
| 36 | + > |
| 37 | + Fixtures |
| 38 | + </a> |
| 39 | + </li> |
| 40 | + <li |
| 41 | + css={listItem} |
| 42 | + style={selected === 'tables' ? selectedStyles : undefined} |
| 43 | + > |
| 44 | + <a |
| 45 | + href="https://www.theguardian.com/football/women-s-euro-2025/overview" |
| 46 | + css={smallLink} |
| 47 | + > |
| 48 | + Tables |
| 49 | + </a> |
| 50 | + </li> |
| 51 | + <li css={listItem}> |
| 52 | + <a |
| 53 | + href="https://www.theguardian.com/p/x2e3za" |
| 54 | + css={smallLink} |
| 55 | + > |
| 56 | + Top scorers |
| 57 | + </a> |
| 58 | + </li> |
| 59 | + <li css={listItem}> |
| 60 | + <a |
| 61 | + href="https://www.theguardian.com/p/x27nz8" |
| 62 | + css={smallLink} |
| 63 | + > |
| 64 | + Players guide |
| 65 | + </a> |
| 66 | + </li> |
| 67 | + <li css={listItem}> |
| 68 | + <a |
| 69 | + href="https://www.theguardian.com/football/women-s-euro-2025" |
| 70 | + css={lastSmallLink} |
| 71 | + > |
| 72 | + Full coverage |
| 73 | + </a> |
| 74 | + </li> |
| 75 | + </ul> |
| 76 | + </nav> |
| 77 | + ) : null; |
| 78 | + |
| 79 | +const nav = css({ |
| 80 | + backgroundColor: palette.news[400], |
| 81 | + '&': css(grid.paddedContainer), |
| 82 | + alignContent: 'space-between', |
| 83 | + height: 116, |
| 84 | + [from.tablet]: { |
| 85 | + height: 140, |
| 86 | + }, |
| 87 | + [from.desktop]: { |
| 88 | + height: 150, |
| 89 | + }, |
| 90 | +}); |
| 91 | + |
| 92 | +const largeLinkStyles = css({ |
| 93 | + ...headlineBold24Object, |
| 94 | + color: palette.neutral[100], |
| 95 | + textDecoration: 'none', |
| 96 | + '&': css(grid.column.centre), |
| 97 | + [from.tablet]: headlineBold42Object, |
| 98 | + [from.leftCol]: css(grid.between('left-column-start', 'right-column-end')), |
| 99 | +}); |
| 100 | + |
| 101 | +const list = css({ |
| 102 | + display: 'flex', |
| 103 | + flexWrap: 'wrap', |
| 104 | + '&': css(grid.column.all), |
| 105 | + position: 'relative', |
| 106 | + '--top-border-gap': '1.55rem', |
| 107 | + [from.mobileLandscape]: { |
| 108 | + paddingLeft: 10, |
| 109 | + }, |
| 110 | + [from.tablet]: { |
| 111 | + '--top-border-gap': '3rem', |
| 112 | + }, |
| 113 | + backgroundImage: `linear-gradient( |
| 114 | + #d84d4d 0, |
| 115 | + #d84d4d 1px, |
| 116 | + transparent 1px, |
| 117 | + transparent var(--top-border-gap), |
| 118 | + #d84d4d var(--top-border-gap), |
| 119 | + #d84d4d calc(var(--top-border-gap) + 1px), |
| 120 | + transparent 1px, |
| 121 | + transparent var(--top-border-gap) |
| 122 | + )`, |
| 123 | +}); |
| 124 | + |
| 125 | +const selectedStyles = { |
| 126 | + '--selected-height': '4px', |
| 127 | + '--selected-opacity': '1', |
| 128 | +}; |
| 129 | + |
| 130 | +const listItem = css({ |
| 131 | + position: 'relative', |
| 132 | + '&::before': { |
| 133 | + content: '""', |
| 134 | + display: 'block', |
| 135 | + position: 'absolute', |
| 136 | + left: 0, |
| 137 | + top: 0, |
| 138 | + width: '100%', |
| 139 | + height: 'var(--selected-height, 0)', |
| 140 | + opacity: 'var(--selected-opacity, 0)', |
| 141 | + backgroundColor: palette.neutral[100], |
| 142 | + transition: 'height 0.3s ease-in-out, opacity 0.05s 0.1s linear', |
| 143 | + }, |
| 144 | + '&:hover': selectedStyles, |
| 145 | + [from.leftCol]: { |
| 146 | + flexBasis: 160, |
| 147 | + }, |
| 148 | +}); |
| 149 | + |
| 150 | +const smallLink = css({ |
| 151 | + ...headlineBold15Object, |
| 152 | + padding: '4px 10px 6px', |
| 153 | + display: 'block', |
| 154 | + lineHeight: 1, |
| 155 | + color: palette.neutral[100], |
| 156 | + textDecoration: 'none', |
| 157 | + '&::after': { |
| 158 | + content: '""', |
| 159 | + display: 'block', |
| 160 | + position: 'absolute', |
| 161 | + top: 0, |
| 162 | + right: 0, |
| 163 | + width: 1, |
| 164 | + height: '1.3rem', |
| 165 | + backgroundColor: '#d84d4d', |
| 166 | + }, |
| 167 | + [from.tablet]: headlineBold17Object, |
| 168 | + [from.leftCol]: { |
| 169 | + padding: '9px 10px 10px', |
| 170 | + }, |
| 171 | +}); |
| 172 | + |
| 173 | +const lastSmallLink = css(smallLink, { |
| 174 | + ...headlineMedium15Object, |
| 175 | + lineHeight: 1, |
| 176 | + [from.tablet]: headlineMedium17Object, |
| 177 | +}); |
0 commit comments