Skip to content

Commit

Permalink
Add a nasty workaround for loading ONS Design System on each route
Browse files Browse the repository at this point in the history
A.M.A.
  • Loading branch information
designorant committed Nov 24, 2021
1 parent aad865c commit 14c0312
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 5 deletions.
5 changes: 5 additions & 0 deletions src/routes/categories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
import Feedback from "./../ui/Feedback.svelte";
</script>

<svelte:head>
<title>2021 Census Data Atlas Categories</title>
<script defer src="https://cdn.ons.gov.uk/sdc/design-system/44.1.2/scripts/main.js"></script>
</svelte:head>

<BasePage>
<span slot="header">
<Header
Expand Down
5 changes: 5 additions & 0 deletions src/routes/components.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
let selectedCode = "QS302EW002";
</script>

<svelte:head>
<title>2021 Census Data Atlas Components</title>
<script defer src="https://cdn.ons.gov.uk/sdc/design-system/44.1.2/scripts/main.js"></script>
</svelte:head>

<BasePage {serviceTitle} {description}>
<DesignSystemPanel
title="Default header"
Expand Down
5 changes: 5 additions & 0 deletions src/routes/data/[categoryId].svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
];
</script>

<svelte:head>
<title>2021 Census Data Atlas Category</title>
<script defer src="https://cdn.ons.gov.uk/sdc/design-system/44.1.2/scripts/main.js"></script>
</svelte:head>

<BasePage>
<span slot="header">
<DataHeader tableName={categoryId} />
Expand Down
5 changes: 5 additions & 0 deletions src/routes/data/[categoryId]/locations/[locationId].svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
$: appIsInitialised, $appIsInitialised && fetchCensusData("QS119EW005", null);
</script>

<svelte:head>
<title>2021 Census Data Atlas Category & Location</title>
<script defer src="https://cdn.ons.gov.uk/sdc/design-system/44.1.2/scripts/main.js"></script>
</svelte:head>

<BasePage>
<span slot="header">
<DataHeader tableName={categoryId} location={locationId} />
Expand Down
5 changes: 5 additions & 0 deletions src/routes/design-system.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
let autosuggestValue = "";
</script>

<svelte:head>
<title>2021 Census Data Atlas Design System</title>
<script defer src="https://cdn.ons.gov.uk/sdc/design-system/44.1.2/scripts/main.js"></script>
</svelte:head>

<ONSSkipLink />
<ONSExternalHeaderWithDescription {serviceTitle} description={serviceDescription} />
<ONSSkipLink />
Expand Down
1 change: 1 addition & 0 deletions src/routes/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<svelte:head>
<title>2021 Census Data Atlas</title>
<meta name="description" content="Explore 2021 census data for England and Wales at a neighbourhood level." />
<script defer src="https://cdn.ons.gov.uk/sdc/design-system/44.1.2/scripts/main.js"></script>
</svelte:head>

<BasePage>
Expand Down
5 changes: 5 additions & 0 deletions src/routes/locations/[locationId].svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
];
</script>

<svelte:head>
<title>2021 Census Data Atlas Location</title>
<script defer src="https://cdn.ons.gov.uk/sdc/design-system/44.1.2/scripts/main.js"></script>
</svelte:head>

<BasePage>
<span slot="header">
<DataHeader location={locationId} />
Expand Down
5 changes: 0 additions & 5 deletions src/ui/BasePage.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
<script>
import { onMount } from "svelte";
import ONSHeaderLogoLarge from "./ons/svg/ONSHeaderLogoLarge.svelte";
import ONSHeaderLogoSmall from "./ons/svg/ONSHeaderLogoSmall.svelte";
import ONSPhaseBanner from "./ons/ONSPhaseBanner.svelte";
let hasMap = $$slots.map ? "ons-page--has-map" : "";
onMount(async () => {
await import("./../../node_modules/@ons/design-system/scripts/main");
});
</script>

<div class="ons-page {hasMap}">
Expand Down

0 comments on commit 14c0312

Please sign in to comment.