|
| 1 | +<script lang="ts"> |
| 2 | + // Define types for news items |
| 3 | + interface NewsItem { |
| 4 | + date: string; |
| 5 | + content: string; |
| 6 | + releaseNotesUrl?: string; |
| 7 | + releaseVersion?: string; |
| 8 | + componentLinks?: Array<{ |
| 9 | + text: string; |
| 10 | + href: string; |
| 11 | + }>; |
| 12 | + } |
| 13 | +
|
| 14 | + // Define component props with types and default values |
| 15 | + let { |
| 16 | + title = "What's new", |
| 17 | + titleId = "whats-new", |
| 18 | + componentLinksIntroText = "This the first step to refresh the GOV.UK brand. It includes updates to the:", |
| 19 | + newsItems = [ |
| 20 | + { |
| 21 | + date: "15 May 2025", |
| 22 | + content: |
| 23 | + "We released GOV.UK Frontend v5.10.1 with the correct colour for the dot in the refreshed GOV.UK logo, as well as small fixes to the implementation of the brand refresh.", |
| 24 | + releaseNotesUrl: |
| 25 | + "https://github.com/alphagov/govuk-frontend/releases/tag/v5.10.1", |
| 26 | + releaseVersion: "v5.10.1", |
| 27 | + }, |
| 28 | + { |
| 29 | + date: "1 May 2025", |
| 30 | + content: "We released GOV.UK Frontend v5.10.0.", |
| 31 | + releaseNotesUrl: |
| 32 | + "https://github.com/alphagov/govuk-frontend/releases/tag/v5.10.0", |
| 33 | + releaseVersion: "v5.10.0", |
| 34 | + componentLinks: [ |
| 35 | + { text: "GOV.UK header component", href: "/components/header/" }, |
| 36 | + { text: "GOV.UK footer component", href: "/components/footer/" }, |
| 37 | + { |
| 38 | + text: "Service navigation component", |
| 39 | + href: "/components/service-navigation/", |
| 40 | + }, |
| 41 | + { |
| 42 | + text: "Cookie banner component", |
| 43 | + href: "/components/cookie-banner/", |
| 44 | + }, |
| 45 | + ], |
| 46 | + }, |
| 47 | + ] as NewsItem[], |
| 48 | + } = $props<{ |
| 49 | + title?: string; |
| 50 | + titleId?: string; |
| 51 | + componentLinksIntroText?: string; |
| 52 | + newsItems?: NewsItem[]; |
| 53 | + }>(); |
| 54 | +</script> |
| 55 | + |
| 56 | +<div class="app-whats-new"> |
| 57 | + <div class="govuk-width-container"> |
| 58 | + <div class="govuk-main-wrapper govuk-main-wrapper--l"> |
| 59 | + <div class="govuk-grid-row"> |
| 60 | + <div class="govuk-grid-column-two-thirds-from-desktop"> |
| 61 | + <h2 id={titleId} class="govuk-heading-l">{title}</h2> |
| 62 | + |
| 63 | + {#each newsItems as item, index} |
| 64 | + <p class="govuk-body"> |
| 65 | + <strong>{item.date}:</strong> |
| 66 | + {item.content} |
| 67 | + </p> |
| 68 | + |
| 69 | + {#if item.releaseNotesUrl && item.releaseVersion} |
| 70 | + <p class="govuk-body"> |
| 71 | + Read the <a href={item.releaseNotesUrl} class="govuk-link" |
| 72 | + >release notes for {item.releaseVersion}</a |
| 73 | + > to see what's changed. |
| 74 | + </p> |
| 75 | + {/if} |
| 76 | + |
| 77 | + {#if item.componentLinks && item.componentLinks.length > 0} |
| 78 | + <p class="govuk-body"> |
| 79 | + {componentLinksIntroText} |
| 80 | + </p> |
| 81 | + <ul class="govuk-list govuk-list--bullet"> |
| 82 | + {#each item.componentLinks as link} |
| 83 | + <li> |
| 84 | + <a href={link.href} class="govuk-link">{link.text}</a> |
| 85 | + </li> |
| 86 | + {/each} |
| 87 | + </ul> |
| 88 | + {/if} |
| 89 | + {/each} |
| 90 | + </div> |
| 91 | + </div> |
| 92 | + </div> |
| 93 | + </div> |
| 94 | +</div> |
| 95 | + |
| 96 | +<style> |
| 97 | + .app-whats-new { |
| 98 | + border-bottom: 1px solid #b1b4b6; |
| 99 | + background-color: #f8f8f8; |
| 100 | + } |
| 101 | +</style> |
0 commit comments