Skip to content

Commit 30b7bde

Browse files
Nhsuk styling (#1)
* Rework styling to incorporate nhsuk styling * Resolve styling issues * Updates to reference nhsdigital container registry
1 parent 2a01a2c commit 30b7bde

20 files changed

Lines changed: 444 additions & 242 deletions

File tree

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ jobs:
5555
file: ./Dockerfile
5656
platforms: linux/amd64,linux/arm64/v8
5757
tags: |
58-
ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
59-
ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:latest
58+
ghcr.io/nhsdigital/${{ env.IMAGE_NAME }}:${{ env.VERSION }}
59+
ghcr.io/nhsdigital/${{ env.IMAGE_NAME }}:latest
6060
labels: |
6161
org.opencontainers.image.title=${{ github.event.repository.name }}
6262
org.opencontainers.image.description=${{ github.event.repository.description }}

.github/workflows/release.yml

Lines changed: 7 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ jobs:
7272
file: ./Dockerfile
7373
platforms: linux/amd64,linux/arm64/v8
7474
tags: |
75-
ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
76-
ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:latest
75+
ghcr.io/nhsdigital/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
76+
ghcr.io/nhsdigital/${{ env.IMAGE_NAME }}:latest
7777
labels: |
7878
org.opencontainers.image.title=${{ github.event.repository.name }}
7979
org.opencontainers.image.description=${{ github.event.repository.description }}
@@ -83,20 +83,20 @@ jobs:
8383
org.opencontainers.image.version=${{ github.ref_name }}
8484
- name: sign container image
8585
run: |
86-
cosign sign --yes --key env://COSIGN_KEY ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:${{ github.ref_name }}@${{ steps.build_push.outputs.digest }}
86+
cosign sign --yes --key env://COSIGN_KEY ghcr.io/nhs-digital/${{ env.IMAGE_NAME }}:${{ github.ref_name }}@${{ steps.build_push.outputs.digest }}
8787
shell: bash
8888
env:
8989
COSIGN_KEY: ${{secrets.COSIGN_KEY}}
9090
COSIGN_PASSWORD: ${{secrets.COSIGN_PASSWORD}}
9191

9292
- name: Check images
9393
run: |
94-
docker buildx imagetools inspect ghcr.io/avisi-cloud/${IMAGE_NAME}:${{ github.ref_name }}
95-
docker pull ghcr.io/avisi-cloud/${IMAGE_NAME}:${{ github.ref_name }}
96-
cosign verify --key cosign.pub ghcr.io/avisi-cloud/${IMAGE_NAME}:${{ github.ref_name }}
94+
docker buildx imagetools inspect ghcr.io/nhsdigital/${IMAGE_NAME}:${{ github.ref_name }}
95+
docker pull ghcr.io/nhsdigital/${IMAGE_NAME}:${{ github.ref_name }}
96+
cosign verify --key cosign.pub ghcr.io/nhsdigital/${IMAGE_NAME}:${{ github.ref_name }}
9797
- uses: anchore/sbom-action@v0
9898
with:
99-
image: ghcr.io/avisi-cloud/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
99+
image: ghcr.io/nhsdigital/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
100100

101101
create-draft-release:
102102
runs-on: ubuntu-latest
@@ -122,57 +122,3 @@ jobs:
122122
env:
123123
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124124
run: gh release upload ${{ github.ref_name }} ./build/distributions/*
125-
126-
generate-example-site:
127-
runs-on: ubuntu-latest
128-
needs: build-gradle
129-
steps:
130-
- name: Checkout
131-
uses: actions/checkout@v4
132-
- uses: actions/setup-java@v4
133-
with:
134-
distribution: temurin
135-
java-version: 21
136-
137-
- name: Download binaries
138-
uses: actions/download-artifact@v4
139-
with:
140-
name: binaries
141-
path: build/install
142-
143-
- name: Set up environment
144-
run: |
145-
sudo apt-get install -y graphviz
146-
chmod +x build/install/structurizr-site-generatr/bin/structurizr-site-generatr
147-
148-
- name: Generate example site
149-
run: >
150-
build/install/structurizr-site-generatr/bin/structurizr-site-generatr generate-site
151-
--git-url https://github.com/avisi-cloud/structurizr-site-generatr.git
152-
--workspace-file docs/example/workspace.dsl
153-
--assets-dir docs/example/assets
154-
--branches main
155-
--default-branch main
156-
--version ${{ github.ref_name }}
157-
158-
- name: Upload example site as GitHub Pages artifact
159-
uses: actions/upload-pages-artifact@v3
160-
with:
161-
path: ./build/site
162-
163-
publish-example-site:
164-
runs-on: ubuntu-latest
165-
needs: generate-example-site
166-
167-
permissions:
168-
pages: write
169-
id-token: write
170-
171-
environment:
172-
name: github-pages
173-
url: ${{ steps.deployment.outputs.page_url }}
174-
175-
steps:
176-
- name: Deploy example site to GitHub Pages
177-
id: deployment
178-
uses: actions/deploy-pages@v4

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ Then to download our packaged image, consider the
100100
the version you wish to use. Then, in your terminal, execute the following:
101101

102102
```shell
103-
docker pull ghcr.io/avisi-cloud/structurizr-site-generatr
103+
docker pull ghcr.io/nhsdigital/structurizr-site-generatr
104104
```
105105

106106
Once downloaded, you can execute Structurizr Site Generatr via a temporary Docker container by executing the
107107
following in your terminal:
108108

109109
```shell
110-
docker run -it --rm ghcr.io/avisi-cloud/structurizr-site-generatr --help
110+
docker run -it --rm ghcr.io/nhsdigital/structurizr-site-generatr --help
111111
```
112112

113113
#### [Optional] Verify the Structurizr Site Generatr image with [CoSign](https://github.com/sigstore/cosign)
@@ -118,13 +118,13 @@ cat cosign.pub
118118
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEzezKl0vAWSHosQ0JLEsDzNBd2nGm
119119
08KqX+imYqq2avlbH+ehprJFMqKK0/I/bY0q5W9hQC8SLzTRJ9Q5dB9UiQ==
120120
-----END PUBLIC KEY-----
121-
cosign verify --key cosign.pub ghcr.io/avisi-cloud/structurizr-site-generatr
121+
cosign verify --key cosign.pub ghcr.io/nhsdigital/structurizr-site-generatr
122122
```
123123

124124
Or by using the Github repo url:
125125

126126
```shell
127-
cosign verify --key https://github.com/avisi-cloud/structurizr-site-generatr ghcr.io/avisi-cloud/structurizr-site-generatr
127+
cosign verify --key https://github.com/nhsdigital/structurizr-site-generatr ghcr.io/avisi-cloud/structurizr-site-generatr
128128
```
129129

130130
## Usage
@@ -142,7 +142,7 @@ To learn about available commands, or parameters for individual commands, call S
142142
```shell
143143
installed> structurizr-site-generatr --help
144144

145-
docker> docker run -it --rm ghcr.io/avisi-cloud/structurizr-site-generatr --help
145+
docker> docker run -it --rm ghcr.io/nhsdigital/structurizr-site-generatr --help
146146

147147
Usage: structurizr-site-generatr options_list
148148
Subcommands:
@@ -161,7 +161,7 @@ To query the version of Structurizr Site Generatr installed / used.
161161
```shell
162162
installed> structurizr-site-generatr version
163163

164-
docker> docker run -it --rm ghcr.io/avisi-cloud/structurizr-site-generatr version
164+
docker> docker run -it --rm ghcr.io/nhsdigital/structurizr-site-generatr version
165165

166166
Structurizr Site Generatr v1.1.3
167167
```
@@ -176,7 +176,7 @@ This is the primary use case of Structurizr Site Generatr -- to generate a websi
176176
```shell
177177
installed> structurizr-site-generatr generate-site --workspace-file workspace.dsl --assets-dir assets
178178

179-
docker> docker run -it --rm -v c:/projects/c4:/var/model ghcr.io/avisi-cloud/structurizr-site-generatr generate-site --workspace-file workspace.dsl --assets-dir assets
179+
docker> docker run -it --rm -v c:/projects/c4:/var/model ghcr.io/nhsdigital/structurizr-site-generatr generate-site --workspace-file workspace.dsl --assets-dir assets
180180
```
181181

182182
Here, the `--workspace-file` or `-w` parameter specifies the input
@@ -204,7 +204,7 @@ To explicitly name the branches that you want to build sites from you can use th
204204

205205
```shell
206206
structurizr-site-generatr generate-site
207-
--git-url https://github.com/avisi-cloud/structurizr-site-generatr.git
207+
--git-url https://github.com/nhsdigital/structurizr-site-generatr.git
208208
--workspace-file docs/example/workspace.dsl
209209
--assets-dir docs/example/assets
210210
--branches main,future,old
@@ -215,7 +215,7 @@ or you can choose to build all branches that are found in the repository and exc
215215

216216
```shell
217217
structurizr-site-generatr generate-site
218-
--git-url https://github.com/avisi-cloud/structurizr-site-generatr.git
218+
--git-url https://github.com/nhsdigital/structurizr-site-generatr.git
219219
--workspace-file docs/example/workspace.dsl
220220
--assets-dir docs/example/assets
221221
--all-branches
@@ -235,7 +235,7 @@ web server can be reviewed using the `--help` operator.
235235
```shell
236236
installed> structurizr-site-generatr serve -w workspace.dsl
237237

238-
docker> docker run -it --rm -v c:/projects/c4:/var/model -p 8080:8080 ghcr.io/avisi-cloud/structurizr-site-generatr serve --workspace-file workspace.dsl --assets-dir assets
238+
docker> docker run -it --rm -v c:/projects/c4:/var/model -p 8080:8080 ghcr.io/nhsdigital/structurizr-site-generatr serve --workspace-file workspace.dsl --assets-dir assets
239239
```
240240

241241
By default, a development web server will be started and accessible at http://localhost:8080/ (if available).

src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class SoftwareSystemHomePageViewModel(generatorContext: GeneratorContext, softwa
1414
private fun SoftwareSystem.info() = documentation.sections
1515
.minByOrNull { it.order }
1616
?.content
17-
?: "# Description${System.lineSeparator()}${description}"
17+
?: "### Description${System.lineSeparator()}${description}"
1818

1919
private fun SoftwareSystem.format() = documentation.sections
2020
.minByOrNull { it.order }

src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/ContentDiv.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package nl.avisi.structurizr.site.generatr.site.views
33
import kotlinx.html.*
44

55
fun DIV.contentDiv(block: DIV.() -> Unit) {
6-
div(classes = "content p-3") {
6+
div() {
77
block()
88
}
99
}

src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/Diagram.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ fun FlowContent.diagram(viewModel: DiagramViewModel) {
88
val dialogId = "${viewModel.key}-modal"
99
val svgId = "${viewModel.key}-svg"
1010

11-
figure {
11+
figure ("nhsuk-image") {
1212
style = "width: min(100%, ${viewModel.diagramWidthInPixels}px);"
1313
attributes["id"] = viewModel.key
1414
rawHtml(viewModel.svg)
15-
figcaption {
16-
a {
15+
figcaption ("nhsuk-image__caption") {
16+
a{
1717
onClick = "openSvgModal('$dialogId', '$svgId')"
1818
+viewModel.title
1919
if (!viewModel.description.isNullOrBlank()) {
@@ -37,6 +37,7 @@ fun FlowContent.diagram(viewModel: DiagramViewModel) {
3737
+"]"
3838
}
3939
}
40+
4041
} else
4142
div(classes = "notification is-danger") {
4243
+"No view with key"

src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/HomePage.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package nl.avisi.structurizr.site.generatr.site.views
22

33
import kotlinx.html.*
44
import nl.avisi.structurizr.site.generatr.site.model.HomePageViewModel
5+
import java.io.Console
56

67
fun HTML.homePage(viewModel: HomePageViewModel) {
78
page(viewModel) {

src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/Image.kt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,19 @@ import nl.avisi.structurizr.site.generatr.site.model.ImageViewViewModel
66
fun FlowContent.image(viewModel: ImageViewViewModel) {
77
val dialogId = "${viewModel.key}-modal"
88

9-
figure {
9+
figure ("nhsuk-image") {
1010
style = "width: fit-content;"
1111
attributes["id"] = viewModel.key
1212

1313
p(classes = "has-text-weight-bold") { +viewModel.title }
14-
img { src = viewModel.content }
15-
figcaption {
16-
a {
17-
onClick = "openModal('$dialogId')"
18-
+viewModel.title
19-
if (!viewModel.description.isNullOrBlank()) {
20-
br
21-
+viewModel.description
22-
}
14+
img("nhsuk-image__img") { src = viewModel.content }
15+
figcaption ("nhsuk-image__caption") {
16+
+viewModel.title
17+
if (!viewModel.description.isNullOrBlank()) {
18+
br
19+
+viewModel.description
2320
}
21+
2422
}
2523
}
26-
modal(dialogId) {
27-
img(classes = "modal-box-content modal-image") { src = viewModel.content }
28-
div(classes = "has-text-centered") { +viewModel.title }
29-
}
3024
}

src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/Link.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import nl.avisi.structurizr.site.generatr.site.model.LinkViewModel
66

77
fun FlowOrPhrasingContent.link(viewModel: LinkViewModel, classes: String = "") {
88
a(
9-
href = viewModel.relativeHref,
10-
classes = "$classes ${if (viewModel.active) "is-active" else ""}".trim()
9+
href = viewModel.relativeHref,
10+
classes = "$classes ${if (viewModel.active) "is-active" else ""}".trim()
1111
) {
1212
+viewModel.title
1313
}

src/main/kotlin/nl/avisi/structurizr/site/generatr/site/views/Menu.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,33 @@ import nl.avisi.structurizr.site.generatr.site.model.MenuNodeViewModel
66
import nl.avisi.structurizr.site.generatr.site.model.MenuViewModel
77

88
fun DIV.menu(viewModel: MenuViewModel, nestGroups: Boolean) {
9-
aside(classes = "menu p-3") {
9+
nav(){
1010
generalSection(viewModel.generalItems)
1111
softwareSystemsSection(viewModel, nestGroups)
1212
}
1313
}
1414

15-
private fun ASIDE.generalSection(items: List<LinkViewModel>) {
16-
p(classes = "menu-label") { +"General" }
15+
private fun NAV.generalSection(items: List<LinkViewModel>) {
16+
h2("app-side-nav__heading") { +"General" }
1717
menuItemLinks(items)
1818
}
1919

20-
private fun ASIDE.softwareSystemsSection(viewModel: MenuViewModel, nestGroups: Boolean) {
21-
p(classes = "menu-label") { +"Software systems" }
20+
private fun NAV.softwareSystemsSection(viewModel: MenuViewModel, nestGroups: Boolean) {
21+
h2("app-side-nav__heading") { +"Software systems" }
2222
if (nestGroups) {
23-
ul(classes = "listree menu-list has-site-branding") {
23+
ul(classes = "nhsuk-list app-side-nav__list") {
2424
buildHtmlTree(viewModel.softwareSystemNodes(), viewModel).invoke(this)
2525
}
2626
} else {
2727
menuItemLinks(viewModel.softwareSystemItems)
2828
}
2929
}
3030

31-
private fun ASIDE.menuItemLinks(items: List<LinkViewModel>) {
32-
ul(classes = "menu-list has-site-branding") {
33-
li {
34-
items.forEach {
35-
link(it)
31+
private fun NAV.menuItemLinks(items: List<LinkViewModel>) {
32+
ul(classes = "nhsuk-list app-side-nav__list") {
33+
items.forEach {
34+
li(classes="app-side-nav__item " + if (it.active) "app-side-nav__item--current" else "") {
35+
link(it, "app-side-nav__link")
3636
}
3737
}
3838
}

0 commit comments

Comments
 (0)