Skip to content

Commit

Permalink
UI/wsdot (#348)
Browse files Browse the repository at this point in the history
* feat: ✨ Added WSDOT logo to header

* build: ➕ Added @wsdot/web-styles dependency
* build: :down_arrow: Downgraded lefthook dependency due to issues

Reverted to the previous version of lefthook due to it not working.
That newer version was also being detected as a virus.
(See evilmartians/lefthook#722)

My issue could possibly be related to this one:
- evilmartians/lefthook#708
  • Loading branch information
JeffJacobson authored May 21, 2024
1 parent ebaa124 commit fadcd76
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 54 deletions.
3 changes: 3 additions & 0 deletions .cspell/custom-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ fontnik
Geoportal
geouri
GNIS
Haettenschweiler
inconsolata
JURDSG
JURFIPSDSG
JURNM
latlng
lato
lcov
mlat
mlon
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<body class="calcite-mode-auto">
<calcite-loader></calcite-loader>
<calcite-shell>
<h2 slot="header">%VITE_TITLE%</h2>
<h2 slot="header" id="header-title">%VITE_TITLE%</h2>
<calcite-shell-panel slot="panel-start">
<calcite-panel>
<calcite-block heading="SRMP" collapsible open>
Expand Down
107 changes: 57 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"clean": "git clean -dfx --exclude \"node_modules/**\" --exclude \".mailmap\"",
"dev": "vite",
"lint": "eslint . --fix",
"prettier": "prettier .",
"prettier": "prettier . --write",
"publish": "npm run build && node tools/publish.mjs",
"test": "vitest run",
"test:watch": "vitest",
Expand All @@ -38,7 +38,7 @@
"eslint-plugin-sonarjs": "^1.0.3",
"gh-pages": "^6.1.1",
"jsdom": "^24.0.0",
"lefthook": "^1.6.12",
"lefthook": "1.6.11",
"optionator": "^0.9.4",
"prettier": "^3.2.5",
"tsx": "^4.10.5",
Expand Down Expand Up @@ -71,6 +71,7 @@
"dependencies": {
"@esri/calcite-components": "^2.8.2",
"@types/geojson": "^7946.0.14",
"@wsdot/web-styles": "github:WSDOT-GIS/wsdot-web-styles",
"dms-conversion": "^3.1.3"
}
}
9 changes: 8 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
:root {
font-family: "Lato", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
}

#wsdot-logo {
fill: var(--wsdot-logo-green);
margin-right: 1rem;
}

html,
body,
Expand Down Expand Up @@ -29,4 +36,4 @@ calcite-loader {

calcite-rating {
margin-top: 0.25rem;
}
}
25 changes: 25 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@ import { createElcErrorAlert } from "./createElcErrorAlert";
import { emitErrorEvent } from "./errorEvent";
import type MapView from "@arcgis/core/views/MapView";
import "@esri/calcite-components";
import "@fontsource/inconsolata";
import "@fontsource/lato";

import("@wsdot/web-styles/css/wsdot-colors.css");

async function addWsdotLogo() {
const { default: svg } = await import(
"@wsdot/web-styles/images/wsdot-logo/wsdot-logo-black.svg?raw"
);
const dp = new DOMParser();
const wsdotLogo = dp.parseFromString(svg, "image/svg+xml").documentElement;

wsdotLogo.id = "wsdot-logo";

/* __PURE__ */ console.debug("wsdot logo", wsdotLogo);
const headingSelector = "h2";
const headingElement = document.body.querySelector(headingSelector);
if (!headingElement) {
throw new Error("Heading element not found");
}
headingElement.prepend(wsdotLogo);
return wsdotLogo;
}

void addWsdotLogo();

window.addEventListener("elc-error", (event) => {
/* __PURE__ */ console.group("elc-error event listener");
Expand Down

0 comments on commit fadcd76

Please sign in to comment.