|
26 | 26 | * ? Tested - The component's use within products or prototyping (i.e. in a real-use example, using real props) has been tested and approved.
|
27 | 27 | */
|
28 | 28 | let statusObject = {
|
29 |
| - progress: "To be developed", |
| 29 | + progress: "Baseline completed", |
30 | 30 | statusRows: [
|
31 | 31 | {
|
32 |
| - obj: { Accessible: false, Responsive: false, "Prog. enhanced": false }, |
33 |
| - visibleOnHompepage: false, |
| 32 | + obj: { Accessible: false, Responsive: true, "Prog. enhanced": false }, |
| 33 | + visibleOnHompepage: true, |
34 | 34 | },
|
35 | 35 | {
|
36 | 36 | obj: { Reviewed: false, Tested: false },
|
37 |
| - visibleOnHomepage: false, |
| 37 | + visibleOnHomepage: true, |
38 | 38 | },
|
39 | 39 | ],
|
40 | 40 | };
|
|
46 | 46 | * ? You can add other categories to the detailsArray or, if you need a more flexible solution, edit the WrapperInformation snippet directly.
|
47 | 47 | *
|
48 | 48 | */
|
49 |
| - let descriptionArray = ["Explain here what the component does."]; |
| 49 | + let descriptionArray = [ |
| 50 | + "The WhatsNew component displays news, updates, and release information in a structured format. It's designed to communicate recent changes, new features, or important announcements to users.", |
| 51 | + "The component supports flexible content including dates, descriptions, release notes links, and related component links displayed as bulleted lists.", |
| 52 | + ]; |
50 | 53 |
|
51 | 54 | let contextArray = [
|
52 |
| - "Explain here the different contexts in which the component should be used.", |
| 55 | + "Use the WhatsNew component on homepages or documentation sites to highlight recent updates and changes.", |
| 56 | + "Include it in service dashboards to communicate new features or important announcements to users.", |
| 57 | + "Use it in component libraries to showcase new components or updates to existing ones.", |
| 58 | + "Consider using it in admin interfaces to keep users informed about system updates and improvements.", |
53 | 59 | ];
|
54 | 60 |
|
55 | 61 | let detailsArray = [
|
|
70 | 76 | /**
|
71 | 77 | * CUSTOMISETHIS Update connectedComponentsArray to provide links to any children, parent or related components.
|
72 | 78 | */
|
73 |
| - let connectedComponentsArray = []; |
| 79 | + let connectedComponentsArray = [ |
| 80 | + { |
| 81 | + label: "Related UI Components", |
| 82 | + arr: [ |
| 83 | + { |
| 84 | + name: "Masthead", |
| 85 | + folder: "ui", |
| 86 | + }, |
| 87 | + ], |
| 88 | + }, |
| 89 | + { |
| 90 | + label: "Layout Components", |
| 91 | + arr: [ |
| 92 | + { |
| 93 | + name: "Header", |
| 94 | + folder: "layout", |
| 95 | + }, |
| 96 | + ], |
| 97 | + }, |
| 98 | + ]; |
74 | 99 | </script>
|
75 | 100 |
|
76 | 101 | <script>
|
|
91 | 116 |
|
92 | 117 | import { defaultScreenWidthBreakpoints } from "$lib/config.js";
|
93 | 118 |
|
94 |
| -import WhatsNew from "$lib/components/ui/WhatsNew.svelte"; |
95 |
| -import Examples from "./whats-new/Examples.svelte"; |
| 119 | + import WhatsNew from "$lib/components/ui/WhatsNew.svelte"; |
| 120 | + import Examples from "./whats-new/Examples.svelte"; |
96 | 121 |
|
97 | 122 | let { data } = $props();
|
98 | 123 |
|
@@ -157,142 +182,77 @@ import Examples from "./whats-new/Examples.svelte";
|
157 | 182 | let parametersSourceArray = $derived(
|
158 | 183 | addIndexAndInitalValue([
|
159 | 184 | {
|
160 |
| - name: "componentNameProp", |
161 |
| - category: "Input props", |
162 |
| - propType: "fixed", |
163 |
| - value: pageName, |
164 |
| - }, |
165 |
| - { |
166 |
| - name: "textProp", |
167 |
| - category: "Input props", |
168 |
| - value: `This is a string input - edit me using the UI and see it reflected in the component.`, |
| 185 | + name: "title", |
| 186 | + category: "Content", |
| 187 | + value: "What's new", |
169 | 188 | description: {
|
170 | 189 | markdown: true,
|
171 | 190 | arr: [
|
172 |
| - `This prop passes a text string to the <code>${pageName}</code> component.`, |
| 191 | + "The main heading text for the news section.", |
| 192 | + "This appears as an h2 element at the top of the component.", |
173 | 193 | ],
|
174 | 194 | },
|
175 |
| - rows: 2, |
176 | 195 | },
|
177 | 196 | {
|
178 |
| - name: "numberProp", |
179 |
| - category: "Input props", |
180 |
| - value: 9, |
| 197 | + name: "titleId", |
| 198 | + category: "Content", |
| 199 | + value: "whats-new", |
181 | 200 | description: {
|
182 | 201 | markdown: true,
|
183 | 202 | arr: [
|
184 |
| - `This prop passes a text string to the <code>${pageName}</code> component.`, |
| 203 | + "The HTML id attribute for the heading element.", |
| 204 | + "Useful for anchor links and accessibility purposes.", |
185 | 205 | ],
|
186 | 206 | },
|
187 |
| - rows: 5, |
188 | 207 | },
|
189 | 208 | {
|
190 |
| - name: "checkboxProp", |
191 |
| - category: "Input props", |
192 |
| - value: false, |
| 209 | + name: "componentLinksIntroText", |
| 210 | + category: "Content", |
| 211 | + value: |
| 212 | + "This initial alpha release includes foundational components for building government services:", |
193 | 213 | description: {
|
194 | 214 | markdown: true,
|
195 | 215 | arr: [
|
196 |
| - `This prop passes <code>false</code> to the component when unchecked, <code>true</code> when checked.`, |
| 216 | + "Introductory text that appears before component links lists.", |
| 217 | + "Set to empty string to hide this text entirely.", |
| 218 | + "Only displays when news items have componentLinks arrays.", |
197 | 219 | ],
|
198 | 220 | },
|
| 221 | + rows: 3, |
199 | 222 | },
|
200 | 223 | {
|
201 |
| - name: "dropdownProp", |
202 |
| - category: "Input props", |
203 |
| - options: ["apple", "banana", "kiwi", "strawberry", "orange"], |
204 |
| - description: { |
205 |
| - markdown: true, |
206 |
| - arr: [ |
207 |
| - `This prop passes the selected <code>option</code> to the component as a string.`, |
208 |
| - ], |
209 |
| - }, |
210 |
| - }, |
211 |
| - { |
212 |
| - name: "radioProp", |
213 |
| - category: "Input props", |
214 |
| - propType: "radio", |
215 |
| - options: ["carrot", "potato", "broccoli", "mushroom", "tomato"], |
216 |
| - description: { |
217 |
| - markdown: true, |
218 |
| - arr: [ |
219 |
| - `This prop passes the selected <code>option</code> to the component as a string.`, |
220 |
| - ], |
221 |
| - }, |
222 |
| - }, |
223 |
| - { |
224 |
| - name: "jsObjectProp", |
225 |
| - category: "Input props", |
| 224 | + name: "newsItems", |
| 225 | + category: "Content", |
226 | 226 | value: [
|
227 | 227 | {
|
228 |
| - name: "Pikachu", |
229 |
| - type: "Electric", |
230 |
| - color: "#fde047", |
231 |
| - }, |
232 |
| - { |
233 |
| - name: "Charmander", |
234 |
| - type: "Fire", |
235 |
| - color: "#fca5a5", |
236 |
| - }, |
237 |
| - { |
238 |
| - name: "Squirtle", |
239 |
| - type: "Water", |
240 |
| - color: "#93c5fd", |
| 228 | + date: "June 2025", |
| 229 | + content: |
| 230 | + "We launched the MHCLG Svelte Component Library alpha version. This library provides Svelte 5 implementations of GOV.UK Design System components, specifically tailored for data-rich digital products and services.", |
| 231 | + releaseNotesUrl: |
| 232 | + "https://github.com/communitiesuk/oflog_svelte_component_library/releases/tag/v0.1.16", |
| 233 | + releaseVersion: "v0.1.16", |
241 | 234 | },
|
242 | 235 | {
|
243 |
| - name: "Bulbasaur", |
244 |
| - type: "Grass", |
245 |
| - color: "#86efac", |
| 236 | + date: "January 2025", |
| 237 | + content: |
| 238 | + "Development began on the component library infrastructure, establishing the foundation for reusable Svelte components that maintain GOV.UK Design System compliance.", |
| 239 | + componentLinks: [ |
| 240 | + { text: "Masthead component", href: "/components/ui/masthead" }, |
| 241 | + { text: "Button component", href: "/components/ui/button" }, |
| 242 | + ], |
246 | 243 | },
|
247 | 244 | ],
|
248 | 245 | description: {
|
249 | 246 | markdown: true,
|
250 | 247 | arr: [
|
251 |
| - `This prop passes the selected a JS object to the component.`, |
252 |
| - `The object can be directly edited. A notification will alert the user is any edits create an invalid object`, |
253 |
| - ], |
254 |
| - }, |
255 |
| - }, |
256 |
| - { |
257 |
| - name: "functionProp", |
258 |
| - category: "Fixed props", |
259 |
| -
|
260 |
| - isRequired: true, |
261 |
| - value: function (event, pokemon) { |
262 |
| - window.alert( |
263 |
| - `The ${this.name} function has been triggered. Open the 'Fixed props' panel to see updated values.`, |
264 |
| - ); |
265 |
| -
|
266 |
| - this.functionElements.counter += 1; |
267 |
| - Object.keys(this.functionElements.dataset).forEach((el) => { |
268 |
| - this.functionElements.dataset[el] = event.currentTarget.dataset[el]; |
269 |
| - }); |
270 |
| - }, |
271 |
| - functionElements: { |
272 |
| - dataset: { role: null, id: null }, |
273 |
| - counter: 0, |
274 |
| - functionAsString: `function (event, pokemon) { |
275 |
| -window.alert( |
276 |
| - "The \${this.name} function has been triggered. Open the 'Fixed props' panel to see updated values.", |
277 |
| -); |
278 |
| -
|
279 |
| -this.functionElements.counter += 1; |
280 |
| -Object.keys(this.functionElements.dataset).forEach((el) => { |
281 |
| - this.functionElements.dataset[el] = event.currentTarget.dataset[el]; |
282 |
| -}); |
283 |
| -}`, |
284 |
| - }, |
285 |
| - description: { |
286 |
| - markdown: true, |
287 |
| - arr: [ |
288 |
| - `This prop passes a function to the ${pageName} component. It works slightly differently to other props.`, |
289 |
| - `Firstly, it is not editable via the UI.`, |
290 |
| - `Secondly, the code snippet on the left is not actually based on the value. Instead, it is example code based on the <code>functionElements.functionAsString</code> property, and is optional.`, |
291 |
| - , |
292 |
| - `For event functions, you can define your function so that it updates the <code>functionElements.counter</code> property each time it runs.`, |
293 |
| - `For event functions, you can also define your function so that it grabs data from its target, which are then stored in <code>functionElements.dataset</code> and displayed in the UI (trigger your event to see this in action).`, |
| 248 | + "Array of news items to display. Each item can include:", |
| 249 | + "• <strong>date</strong>: When the news occurred (required)", |
| 250 | + "• <strong>content</strong>: Main description (required)", |
| 251 | + "• <strong>releaseNotesUrl & releaseVersion</strong>: For linking to release notes (optional)", |
| 252 | + "• <strong>componentLinks</strong>: Array of related component links (optional)", |
294 | 253 | ],
|
295 | 254 | },
|
| 255 | + rows: 10, |
296 | 256 | },
|
297 | 257 | ]),
|
298 | 258 | );
|
@@ -435,7 +395,7 @@ Object.keys(this.functionElements.dataset).forEach((el) => {
|
435 | 395 | -->
|
436 | 396 | {#snippet Component()}
|
437 | 397 | <div class="p-8">
|
438 |
| -<WhatsNew {...parametersObject}></WhatsNew> |
| 398 | + <WhatsNew {...parametersObject}></WhatsNew> |
439 | 399 | </div>
|
440 | 400 | {/snippet}
|
441 | 401 |
|
|
0 commit comments