@communitiesuk/svelte-component-library 0.1.17 → 0.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -98
- package/dist/assets/css/base.css +9 -0
- package/dist/assets/css/code-block.css +116 -0
- package/dist/assets/css/components.css +47 -0
- package/dist/assets/css/fonts.css +19 -0
- package/dist/assets/css/govuk-additional.css +142 -0
- package/dist/assets/css/govuk-frontend.min.css +2 -2
- package/dist/assets/css/moduk.css +1 -0
- package/dist/assets/css/moj-frontend.min copy.css +4108 -0
- package/dist/assets/css/moj-frontend.min.css +2 -0
- package/dist/assets/css/moj-frontend.min.css.map +1 -0
- package/dist/assets/css/utilities.css +0 -0
- package/dist/assets/images/govuk-crest.svg +1 -1
- package/dist/assets/js/govuk-frontend.min.js +1 -0
- package/dist/assets/js/moj-frontend.min.js +1 -0
- package/dist/assets/rebrand/images/favicon.ico +0 -0
- package/dist/assets/rebrand/images/favicon.svg +1 -0
- package/dist/assets/rebrand/images/govuk-crest.svg +1 -0
- package/dist/assets/rebrand/images/govuk-icon-180.png +0 -0
- package/dist/assets/rebrand/images/govuk-icon-192.png +0 -0
- package/dist/assets/rebrand/images/govuk-icon-512.png +0 -0
- package/dist/assets/rebrand/images/govuk-icon-mask.svg +1 -0
- package/dist/assets/rebrand/images/govuk-opengraph-image.png +0 -0
- package/dist/assets/rebrand/manifest.json +39 -0
- package/dist/components/data-vis/line-chart/Line.svelte +48 -41
- package/dist/components/data-vis/line-chart/Line.svelte.d.ts +6 -4
- package/dist/components/data-vis/line-chart/LineChart.svelte +145 -36
- package/dist/components/data-vis/line-chart/LineChart.svelte.d.ts +25 -9
- package/dist/components/data-vis/line-chart/Lines.svelte +10 -23
- package/dist/components/data-vis/line-chart/Lines.svelte.d.ts +8 -4
- package/dist/components/data-vis/line-chart/Marker.svelte +31 -5
- package/dist/components/data-vis/line-chart/Marker.svelte.d.ts +6 -2
- package/dist/components/data-vis/line-chart/SeriesLabel.svelte +7 -8
- package/dist/components/data-vis/line-chart/SeriesLabel.svelte.d.ts +2 -2
- package/dist/components/data-vis/line-chart/ValueLabel.svelte +26 -34
- package/dist/components/data-vis/line-chart/ValueLabel.svelte.d.ts +8 -4
- package/dist/components/data-vis/map/Map.svelte +299 -71
- package/dist/components/data-vis/map/Map.svelte.d.ts +39 -12
- package/dist/components/data-vis/map/NonStandardControls.svelte +10 -1
- package/dist/components/data-vis/map/NonStandardControls.svelte.d.ts +12 -11
- package/dist/components/data-vis/map/Tooltip.svelte +3 -4
- package/dist/components/data-vis/map/Tooltip.svelte.d.ts +0 -2
- package/dist/components/data-vis/map/mapUtils.d.ts +2 -0
- package/dist/components/data-vis/map/mapUtils.js +50 -0
- package/dist/components/data-vis/table/Table.svelte +28 -40
- package/dist/components/data-vis/table/Table.svelte.d.ts +0 -2
- package/dist/components/layout/Breadcrumbs.svelte +10 -12
- package/dist/components/layout/Breadcrumbs.svelte.d.ts +1 -0
- package/dist/components/layout/Footer.svelte +69 -4
- package/dist/components/layout/Footer.svelte.d.ts +3 -0
- package/dist/components/layout/Header.svelte +56 -16
- package/dist/components/layout/Header.svelte.d.ts +1 -0
- package/dist/components/layout/InternalHeader.svelte +155 -150
- package/dist/components/layout/InternalHeader.svelte.d.ts +1 -0
- package/dist/components/ui/Button.svelte +78 -4
- package/dist/components/ui/Button.svelte.d.ts +2 -0
- package/dist/components/ui/CookieBanner.svelte +356 -0
- package/dist/components/ui/CookieBanner.svelte.d.ts +18 -0
- package/dist/components/ui/FilterPanel.svelte +167 -158
- package/dist/components/ui/FilterPanel.svelte.d.ts +2 -0
- package/dist/components/ui/Masthead.svelte +35 -23
- package/dist/components/ui/Masthead.svelte.d.ts +2 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte +200 -0
- package/dist/components/ui/PostcodeOrAreaSearch.svelte.d.ts +37 -0
- package/dist/components/ui/Search.svelte +2 -2
- package/dist/components/ui/SearchAutocomplete.svelte +104 -14
- package/dist/components/ui/SearchAutocomplete.svelte.d.ts +4 -0
- package/dist/data/IMD2019.json +32846 -0
- package/dist/data/places.csv +20039 -0
- package/dist/data/places.json +100192 -0
- package/dist/data/svgFontDimensions.json +90 -0
- package/dist/data/testData.json +52632 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/package-wrapping/BaseInformation.svelte +0 -33
- package/dist/package-wrapping/SidebarContainer.svelte +0 -7
- package/dist/utils/area-search/geoConfig.d.ts +435 -0
- package/dist/utils/area-search/geoConfig.js +291 -0
- package/dist/utils/cookiesNavigation.d.ts +44 -0
- package/dist/utils/cookiesNavigation.js +63 -0
- package/dist/utils/data-transformations/convert-csv-to-json-proper.cjs +88 -0
- package/dist/utils/data-transformations/convert-csv-to-json-proper.d.cts +1 -0
- package/dist/utils/data-transformations/convertCSV.d.ts +6 -0
- package/dist/utils/data-transformations/convertCSV.js +40 -21
- package/dist/utils/text-string-conversion/textStringConversion.d.ts +6 -0
- package/dist/utils/text-string-conversion/textStringConversion.js +10 -0
- package/package.json +18 -7
- package/dist/components/ui/Breadcrumbs.svelte +0 -198
- package/dist/components/ui/Breadcrumbs.svelte.d.ts +0 -24
- package/dist/components/ui/Footer.svelte +0 -171
- package/dist/components/ui/Footer.svelte.d.ts +0 -30
- package/dist/components/ui/Header.svelte +0 -43
- package/dist/components/ui/Header.svelte.d.ts +0 -7
- package/dist/components/ui/ServiceNavigation.svelte +0 -143
- package/dist/components/ui/ServiceNavigation.svelte.d.ts +0 -13
- package/dist/components/ui/SideNavigation.svelte +0 -346
- package/dist/components/ui/SideNavigation.svelte.d.ts +0 -25
|
@@ -78,12 +78,16 @@
|
|
|
78
78
|
applyButtonText = "Apply",
|
|
79
79
|
// GA4 related props
|
|
80
80
|
ga4BaseEvent = { event_name: "select_content", type: "finder" },
|
|
81
|
+
filterPanelSectionsExpanded = false,
|
|
82
|
+
filterPanelExpanded = true,
|
|
81
83
|
} = $props<{
|
|
82
84
|
resultsCount?: string;
|
|
83
85
|
sectionsData?: Section[];
|
|
84
86
|
filterButtonText?: string;
|
|
85
87
|
applyButtonText?: string;
|
|
86
88
|
ga4BaseEvent?: Record<string, any>;
|
|
89
|
+
filterPanelSectionsExpanded?: boolean;
|
|
90
|
+
filterPanelExpanded?: boolean;
|
|
87
91
|
}>();
|
|
88
92
|
|
|
89
93
|
let sections = $derived(sectionsData);
|
|
@@ -91,7 +95,7 @@
|
|
|
91
95
|
// Call $props.id() once at the top level
|
|
92
96
|
const componentId = $props.id();
|
|
93
97
|
|
|
94
|
-
let panelOpen = $
|
|
98
|
+
let panelOpen = $derived(filterPanelExpanded);
|
|
95
99
|
// Use the stored componentId to create other IDs
|
|
96
100
|
const panelId = `filter-panel-${componentId}`;
|
|
97
101
|
const filterButtonId = `filter-button-${componentId}`;
|
|
@@ -131,173 +135,178 @@
|
|
|
131
135
|
}
|
|
132
136
|
</script>
|
|
133
137
|
|
|
134
|
-
|
|
135
|
-
<div class="app-c-filter-
|
|
136
|
-
<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
138
|
+
{#key `${filterPanelExpanded}-${filterPanelSectionsExpanded}`}
|
|
139
|
+
<div data-module="filter-panel ga4-event-tracker" class="app-c-filter-panel">
|
|
140
|
+
<div class="app-c-filter-panel__header">
|
|
141
|
+
<button
|
|
142
|
+
id={filterButtonId}
|
|
143
|
+
class="app-c-filter-panel__button govuk-link"
|
|
144
|
+
aria-expanded={panelOpen}
|
|
145
|
+
aria-controls={panelId}
|
|
146
|
+
onclick={togglePanel}
|
|
147
|
+
data-ga4-expandable=""
|
|
148
|
+
data-ga4-event={getGa4Event({
|
|
149
|
+
section: filterButtonText,
|
|
150
|
+
text: filterButtonText,
|
|
151
|
+
index_section: 0,
|
|
152
|
+
index_section_count: sections.length,
|
|
153
|
+
})}
|
|
154
|
+
>
|
|
155
|
+
<span class="app-c-filter-panel__button-inner">{filterButtonText}</span>
|
|
156
|
+
</button>
|
|
157
|
+
<h2 id="js-result-count" class="app-c-filter-panel__count">
|
|
158
|
+
{resultsCount}
|
|
159
|
+
</h2>
|
|
160
|
+
</div>
|
|
156
161
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
index_section: section.ga4IndexSection,
|
|
168
|
-
index_section_count: section.ga4IndexSectionCount,
|
|
169
|
-
})}
|
|
170
|
-
data-module="filter-section"
|
|
171
|
-
data-ga4-section={section.ga4Section}
|
|
172
|
-
data-ga4-filter-parent={section.ga4Section}
|
|
173
|
-
data-ga4-change-category={`update-filter ${section.type === "radios" || section.type === "checkboxes" ? section.type.slice(0, -2) : section.type}`}
|
|
174
|
-
class="app-c-filter-section {section.type === 'select' &&
|
|
175
|
-
section.title === 'Topic'
|
|
176
|
-
? 'js-all-content-finder-taxonomy-select'
|
|
177
|
-
: ''}"
|
|
178
|
-
open={section.openByDefault === undefined
|
|
179
|
-
? true
|
|
180
|
-
: section.openByDefault}
|
|
181
|
-
>
|
|
182
|
-
<summary
|
|
183
|
-
class="app-c-filter-section__summary"
|
|
184
|
-
data-ga4-expandable=""
|
|
185
|
-
data-ga4-event={getGa4Event({
|
|
186
|
-
section: section.ga4Section,
|
|
187
|
-
text: section.ga4Section,
|
|
162
|
+
{#if panelOpen}
|
|
163
|
+
<div
|
|
164
|
+
class="app-c-filter-panel__content"
|
|
165
|
+
id={panelId}
|
|
166
|
+
role="region"
|
|
167
|
+
aria-labelledby={filterButtonId}
|
|
168
|
+
>
|
|
169
|
+
{#each sections as section (section.id)}
|
|
170
|
+
<details
|
|
171
|
+
data-ga4-index={JSON.stringify({
|
|
188
172
|
index_section: section.ga4IndexSection,
|
|
189
173
|
index_section_count: section.ga4IndexSectionCount,
|
|
190
174
|
})}
|
|
175
|
+
data-module="filter-section"
|
|
176
|
+
data-ga4-section={section.ga4Section}
|
|
177
|
+
data-ga4-filter-parent={section.ga4Section}
|
|
178
|
+
data-ga4-change-category={`update-filter ${section.type === "radios" || section.type === "checkboxes" ? section.type.slice(0, -2) : section.type}`}
|
|
179
|
+
class="app-c-filter-section {section.type === 'select' &&
|
|
180
|
+
section.title === 'Topic'
|
|
181
|
+
? 'js-all-content-finder-taxonomy-select'
|
|
182
|
+
: ''}"
|
|
183
|
+
open={section.openByDefault !== undefined
|
|
184
|
+
? section.openByDefault
|
|
185
|
+
: filterPanelSectionsExpanded}
|
|
191
186
|
>
|
|
192
|
-
<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
187
|
+
<summary
|
|
188
|
+
class="app-c-filter-section__summary"
|
|
189
|
+
data-ga4-expandable=""
|
|
190
|
+
data-ga4-event={getGa4Event({
|
|
191
|
+
section: section.ga4Section,
|
|
192
|
+
text: section.ga4Section,
|
|
193
|
+
index_section: section.ga4IndexSection,
|
|
194
|
+
index_section_count: section.ga4IndexSectionCount,
|
|
195
|
+
})}
|
|
196
|
+
>
|
|
197
|
+
<h2 class="app-c-filter-section__summary-heading">
|
|
198
|
+
{#if section.type !== "radios"}
|
|
199
|
+
<span class="govuk-visually-hidden">Filter by</span>{/if}
|
|
200
|
+
{section.title}
|
|
201
|
+
</h2>
|
|
202
|
+
</summary>
|
|
203
|
+
<div class="app-c-filter-section__content">
|
|
204
|
+
{#if section.type === "radios"}
|
|
205
|
+
{@const radioData = section}
|
|
206
|
+
<div class="govuk-form-group govuk-!-margin-bottom-2">
|
|
207
|
+
<Radios
|
|
208
|
+
name={radioData.name}
|
|
209
|
+
legend={radioData.legend}
|
|
210
|
+
legendSize="m"
|
|
211
|
+
isPageHeading={false}
|
|
212
|
+
options={radioData.options.map((opt) => ({ ...opt }))}
|
|
213
|
+
selectedValue={radioData.selectedValue}
|
|
214
|
+
small={true}
|
|
215
|
+
/>
|
|
216
|
+
</div>
|
|
217
|
+
{:else if section.type === "date"}
|
|
218
|
+
{@const dateData = section}
|
|
219
|
+
<div data-ga4-section="Updated after">
|
|
220
|
+
<DateInput
|
|
221
|
+
id={`${dateData.id}-from`}
|
|
222
|
+
namePrefix={dateData.fromNamePrefix}
|
|
223
|
+
items={createDateInputItems(dateData.fromInitialValue)}
|
|
224
|
+
fieldset={{
|
|
225
|
+
legend: {
|
|
226
|
+
text: dateData.fromLegend,
|
|
227
|
+
isPageHeading: false,
|
|
228
|
+
},
|
|
229
|
+
}}
|
|
230
|
+
hint={{ text: dateData.fromHint }}
|
|
231
|
+
legendSize={undefined}
|
|
232
|
+
/>
|
|
233
|
+
</div>
|
|
234
|
+
<div data-ga4-section="Updated before">
|
|
235
|
+
<DateInput
|
|
236
|
+
id={`${dateData.id}-to`}
|
|
237
|
+
namePrefix={dateData.toNamePrefix}
|
|
238
|
+
items={createDateInputItems(dateData.toInitialValue)}
|
|
239
|
+
fieldset={{
|
|
240
|
+
legend: { text: dateData.toLegend, isPageHeading: false },
|
|
241
|
+
}}
|
|
242
|
+
hint={{ text: dateData.toHint }}
|
|
243
|
+
legendSize={undefined}
|
|
244
|
+
/>
|
|
245
|
+
</div>
|
|
246
|
+
{:else if section.type === "select"}
|
|
247
|
+
{@const selectData = section}
|
|
248
|
+
{#each selectData.selects as sel, selIdx (sel.id)}
|
|
249
|
+
<div
|
|
250
|
+
class={`govuk-form-group gem-c-select ${selIdx === 1 ? "js-required" : ""}`}
|
|
251
|
+
style={selIdx === 1 ? "display: block;" : undefined}
|
|
252
|
+
data-ga4-section={selIdx === 1 ? sel.label : undefined}
|
|
253
|
+
>
|
|
254
|
+
<Select
|
|
255
|
+
id={sel.id}
|
|
256
|
+
name={sel.name}
|
|
257
|
+
label={sel.label}
|
|
258
|
+
items={sel.options.map((opt) => ({
|
|
259
|
+
value: opt.value,
|
|
260
|
+
text: opt.label,
|
|
261
|
+
disabled: opt.disabled,
|
|
262
|
+
}))}
|
|
263
|
+
value={sel.value}
|
|
264
|
+
fullWidth={sel.fullWidth}
|
|
265
|
+
labelIsPageHeading={false}
|
|
266
|
+
/>
|
|
267
|
+
</div>
|
|
268
|
+
{/each}
|
|
269
|
+
{:else if section.type === "checkboxes"}
|
|
270
|
+
{@const checkboxData = section}
|
|
241
271
|
<div
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
272
|
+
id={`checkboxes-${checkboxData.id}`}
|
|
273
|
+
data-module="gem-checkboxes govuk-checkboxes"
|
|
274
|
+
class="gem-c-checkboxes govuk-form-group govuk-checkboxes--small"
|
|
245
275
|
>
|
|
246
|
-
<
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
}))}
|
|
255
|
-
value={sel.value}
|
|
256
|
-
fullWidth={sel.fullWidth}
|
|
257
|
-
labelIsPageHeading={false}
|
|
276
|
+
<CheckBox
|
|
277
|
+
name={checkboxData.name}
|
|
278
|
+
legend={checkboxData.legend}
|
|
279
|
+
legendSize="m"
|
|
280
|
+
isPageHeading={false}
|
|
281
|
+
options={checkboxData.options.map((opt) => ({ ...opt }))}
|
|
282
|
+
selectedValues={checkboxData.selectedValues}
|
|
283
|
+
small={true}
|
|
258
284
|
/>
|
|
259
285
|
</div>
|
|
260
|
-
{/
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
</details>
|
|
281
|
-
{/each}
|
|
282
|
-
|
|
283
|
-
<div class="app-c-filter-panel__actions">
|
|
284
|
-
<input
|
|
285
|
-
type="submit"
|
|
286
|
-
value={applyButtonText}
|
|
287
|
-
class="govuk-button app-c-filter-panel__action app-c-filter-panel__action--submit"
|
|
288
|
-
data-ga4-event={getGa4Event({
|
|
289
|
-
text: applyButtonText,
|
|
290
|
-
section: filterButtonText,
|
|
291
|
-
action: "apply",
|
|
292
|
-
index_section: 0,
|
|
293
|
-
index_section_count: sections.length,
|
|
294
|
-
})}
|
|
295
|
-
data-disable-with={applyButtonText}
|
|
296
|
-
/>
|
|
286
|
+
{/if}
|
|
287
|
+
</div>
|
|
288
|
+
</details>
|
|
289
|
+
{/each}
|
|
290
|
+
|
|
291
|
+
<div class="app-c-filter-panel__actions">
|
|
292
|
+
<input
|
|
293
|
+
type="submit"
|
|
294
|
+
value={applyButtonText}
|
|
295
|
+
class="govuk-button app-c-filter-panel__action app-c-filter-panel__action--submit"
|
|
296
|
+
data-ga4-event={getGa4Event({
|
|
297
|
+
text: applyButtonText,
|
|
298
|
+
section: filterButtonText,
|
|
299
|
+
action: "apply",
|
|
300
|
+
index_section: 0,
|
|
301
|
+
index_section_count: sections.length,
|
|
302
|
+
})}
|
|
303
|
+
data-disable-with={applyButtonText}
|
|
304
|
+
/>
|
|
305
|
+
</div>
|
|
297
306
|
</div>
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
307
|
+
{/if}
|
|
308
|
+
</div>
|
|
309
|
+
{/key}
|
|
301
310
|
|
|
302
311
|
<style>
|
|
303
312
|
/* Test comment to see if line 1 error changes */
|
|
@@ -68,6 +68,8 @@ type $$ComponentProps = {
|
|
|
68
68
|
filterButtonText?: string;
|
|
69
69
|
applyButtonText?: string;
|
|
70
70
|
ga4BaseEvent?: Record<string, any>;
|
|
71
|
+
filterPanelSectionsExpanded?: boolean;
|
|
72
|
+
filterPanelExpanded?: boolean;
|
|
71
73
|
};
|
|
72
74
|
declare const FilterPanel: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
73
75
|
type FilterPanel = ReturnType<typeof FilterPanel>;
|
|
@@ -1,56 +1,61 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import homepageIllustration from "
|
|
2
|
+
import homepageIllustration from "./../../assets/images/homepage-illustration.svg";
|
|
3
3
|
|
|
4
4
|
// Define component props with types and default values
|
|
5
5
|
let {
|
|
6
6
|
title = "Design your service using GOV.UK styles, components and patterns",
|
|
7
7
|
description = "Use this design system to make government services consistent with GOV.UK. Learn from the research and experience of other service teams and avoid repeating work that's already been done.",
|
|
8
|
+
includeButton = true,
|
|
8
9
|
buttonText = "Get started",
|
|
9
10
|
buttonHref = "/get-started/",
|
|
10
11
|
imageSrc = homepageIllustration,
|
|
11
12
|
imageAlt = "",
|
|
12
13
|
backgroundColor = "#1d70b8", // GOV.UK blue by default
|
|
14
|
+
textColor = "#FFFFFF",
|
|
13
15
|
} = $props<{
|
|
14
16
|
title?: string;
|
|
15
17
|
description?: string;
|
|
18
|
+
includeButton?: boolean;
|
|
16
19
|
buttonText?: string;
|
|
17
20
|
buttonHref?: string;
|
|
18
21
|
imageSrc?: string;
|
|
19
22
|
imageAlt?: string;
|
|
20
23
|
backgroundColor?: string;
|
|
24
|
+
textColor?: string;
|
|
21
25
|
}>();
|
|
22
26
|
</script>
|
|
23
27
|
|
|
24
28
|
<div
|
|
25
29
|
class="app-masthead"
|
|
26
|
-
style="background-color: {backgroundColor}; border-bottom-color: {backgroundColor};"
|
|
30
|
+
style="background-color: {backgroundColor}; border-bottom-color: {backgroundColor}; --masthead-text-color: {textColor};"
|
|
27
31
|
>
|
|
28
32
|
<div class="govuk-width-container">
|
|
29
33
|
<div class="govuk-grid-row">
|
|
30
34
|
<div class="govuk-grid-column-two-thirds-from-desktop">
|
|
31
35
|
<h1 class="govuk-heading-xl app-masthead__title">{@html title}</h1>
|
|
32
36
|
<p class="app-masthead__description">{description}</p>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>
|
|
41
|
-
{buttonText}
|
|
42
|
-
<svg
|
|
43
|
-
class="govuk-button__start-icon"
|
|
44
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
45
|
-
width="17.5"
|
|
46
|
-
height="19"
|
|
47
|
-
viewBox="0 0 33 40"
|
|
48
|
-
aria-hidden="true"
|
|
49
|
-
focusable="false"
|
|
37
|
+
{#if includeButton === true}
|
|
38
|
+
<a
|
|
39
|
+
href={buttonHref}
|
|
40
|
+
role="button"
|
|
41
|
+
draggable="false"
|
|
42
|
+
class="govuk-button govuk-button--inverse govuk-!-margin-top-6 govuk-!-margin-bottom-0 govuk-button--start"
|
|
43
|
+
data-module="govuk-button"
|
|
50
44
|
>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
{buttonText}
|
|
46
|
+
<svg
|
|
47
|
+
class="govuk-button__start-icon"
|
|
48
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
49
|
+
width="17.5"
|
|
50
|
+
height="19"
|
|
51
|
+
viewBox="0 0 33 40"
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
focusable="false"
|
|
54
|
+
>
|
|
55
|
+
<path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"></path>
|
|
56
|
+
</svg>
|
|
57
|
+
</a>
|
|
58
|
+
{/if}
|
|
54
59
|
</div>
|
|
55
60
|
|
|
56
61
|
<div class="govuk-grid-column-one-third-from-desktop">
|
|
@@ -247,7 +252,10 @@
|
|
|
247
252
|
|
|
248
253
|
/* GOV.UK Typography - Scoped to our component with high specificity */
|
|
249
254
|
.app-masthead .govuk-heading-xl.govuk-heading-xl {
|
|
250
|
-
color:
|
|
255
|
+
color: var(
|
|
256
|
+
--masthead-text-color,
|
|
257
|
+
#ffffff
|
|
258
|
+
); /* Override to textColor prop if specified otherwise fall back to white */
|
|
251
259
|
font-family: "GDS Transport", arial, sans-serif;
|
|
252
260
|
font-weight: 700;
|
|
253
261
|
font-size: 2rem;
|
|
@@ -264,4 +272,8 @@
|
|
|
264
272
|
margin-bottom: 3.125rem;
|
|
265
273
|
}
|
|
266
274
|
}
|
|
275
|
+
|
|
276
|
+
.app-masthead__description {
|
|
277
|
+
color: var(--masthead-text-color);
|
|
278
|
+
}
|
|
267
279
|
</style>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
type $$ComponentProps = {
|
|
2
2
|
title?: string;
|
|
3
3
|
description?: string;
|
|
4
|
+
includeButton?: boolean;
|
|
4
5
|
buttonText?: string;
|
|
5
6
|
buttonHref?: string;
|
|
6
7
|
imageSrc?: string;
|
|
7
8
|
imageAlt?: string;
|
|
8
9
|
backgroundColor?: string;
|
|
10
|
+
textColor?: string;
|
|
9
11
|
};
|
|
10
12
|
declare const Masthead: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
11
13
|
type Masthead = ReturnType<typeof Masthead>;
|