Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
14ef79b
DS layout support optional sidebar
FilisLiu Feb 19, 2026
9110804
sidebar
FilisLiu Feb 19, 2026
0329532
breakdown
FilisLiu Feb 19, 2026
d7488f7
ignore openspec
FilisLiu Feb 19, 2026
de2a14d
rename layout to 'two_column'
FilisLiu Feb 19, 2026
3fb289d
add newline after sidebar heading
FilisLiu Feb 19, 2026
5da78db
Refactor sidebar handling in Components and Pages controllers
FilisLiu Feb 19, 2026
7869228
Sidebar one-quarter
FilisLiu Feb 19, 2026
54d7ba7
ds_code (WIP)
FilisLiu Feb 20, 2026
971f119
code hljs
FilisLiu Feb 20, 2026
a86dc8c
register code highlighter controller
FilisLiu Feb 20, 2026
3fbd0fd
self host hljs 11.11.1
FilisLiu Feb 20, 2026
a3b857b
install hljs as a dependency
FilisLiu Feb 24, 2026
048c514
add hljs minimal css to system level stylesheet
FilisLiu Feb 24, 2026
ebda95d
adopt hljs stackoverflow style
FilisLiu Feb 24, 2026
1faa281
clipboard and copy button (WIP)
FilisLiu Feb 24, 2026
07938cb
remove margin for app-example-code
FilisLiu Feb 24, 2026
4651423
Merge branch 'main' into feature/showcase
FilisLiu Feb 24, 2026
571141f
button page with more content
FilisLiu Feb 24, 2026
8923373
tmp form demo
FilisLiu Feb 24, 2026
8b295f6
Strip for form components
FilisLiu Feb 24, 2026
9a148be
reek
FilisLiu Feb 24, 2026
a996c2f
use Assistant.new
FilisLiu Feb 24, 2026
c577430
pretty chunk form group
FilisLiu Feb 24, 2026
ccfa9c8
mirror nhsuk preview structure
FilisLiu Feb 24, 2026
5fc3106
padding
FilisLiu Feb 24, 2026
a782dad
linting
FilisLiu Feb 24, 2026
11b3e51
LLM generated partials for the rest of form elements
FilisLiu Feb 24, 2026
611458b
better css for button
FilisLiu Feb 25, 2026
c17432e
action link
FilisLiu Feb 25, 2026
ed92e0b
move backlink and breadcrumb under fixed element
FilisLiu Feb 25, 2026
1d30dad
remove form error snippets for now
FilisLiu Feb 25, 2026
2779323
text inpu special fields
FilisLiu Feb 25, 2026
b724522
todo notes
FilisLiu Feb 25, 2026
1ca79cb
checkboxes
FilisLiu Feb 25, 2026
6bf9151
refactor component_preview method to use render for ERB processing
FilisLiu Mar 2, 2026
66dce54
can override html output
FilisLiu Mar 2, 2026
36ab8a6
remove sidebar helpers and use a partial html direclty
FilisLiu Mar 2, 2026
db98147
fix outdated arg
FilisLiu Mar 2, 2026
688a3ef
Add sidebar partials for components and pages
FilisLiu Mar 2, 2026
391c75f
breadcrumbes for each component page
FilisLiu Mar 2, 2026
1231530
render demo breadcrumb
FilisLiu Mar 2, 2026
6a29949
override backlink render output
FilisLiu Mar 2, 2026
7c066d2
rm err pages
FilisLiu Mar 2, 2026
5429133
lead paragraphs
FilisLiu Mar 2, 2026
457dec9
Refactor ComponentsController to set component instance variable in a…
FilisLiu Mar 2, 2026
b194bec
Update component view to use design system helpers for main heading a…
FilisLiu Mar 2, 2026
c39c606
TODO note to details page
FilisLiu Mar 2, 2026
e5beccc
fix notification yielding issue
FilisLiu Mar 2, 2026
a374dc8
unique tab id
FilisLiu Mar 2, 2026
a569de5
Styles controller
FilisLiu Mar 2, 2026
6c08834
Typography heading and body
FilisLiu Mar 2, 2026
b36e18f
layout grid
FilisLiu Mar 2, 2026
191f3bc
better pages heading
FilisLiu Mar 2, 2026
e8132f7
Refactor details component to use design system helpers for paragraphs
FilisLiu Mar 2, 2026
3cf6ccc
rm noto
FilisLiu Mar 2, 2026
c5acc80
Merge branch 'main' into feature/showcase
FilisLiu Mar 3, 2026
ddfe6d3
Add new styles for Grid, Headings, Lists, and Paragraphs; update Sidebar
FilisLiu Mar 3, 2026
ce578c8
Refactor details component to utilize ds_list for bullet items
FilisLiu Mar 3, 2026
d37509f
Remove commented-out heading and inset text from checkboxes and text …
FilisLiu Mar 3, 2026
0842d0e
Hide demo attr; fixed multi-line ERB render (omit spaces); Extract fi…
FilisLiu Mar 3, 2026
0caec1f
demo purpose fixes
FilisLiu Mar 3, 2026
b369719
tidy up todo notes
FilisLiu Mar 3, 2026
01b16e7
Refactor pagination handling by extracting demo data into a method an…
FilisLiu Mar 3, 2026
fd5c176
cleanup
FilisLiu Mar 3, 2026
7242ee6
changelog
FilisLiu Mar 3, 2026
f837bd9
Update homepage links in GOV.UK and NHS.UK layouts to use main_app.ro…
FilisLiu Mar 3, 2026
78593ce
fix footer cy test
FilisLiu Mar 3, 2026
c33a55e
Update changelog
FilisLiu Mar 3, 2026
bf2bd5b
inclusive language fix
FilisLiu Mar 3, 2026
86345f6
Update CHANGELOG with new features for ds_paragraph, ds_inset_text, a…
FilisLiu Mar 3, 2026
9db28d3
Merge branch 'main' into feature/showcase
FilisLiu Mar 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Refurbished preview pages to mirror NHSUK and GOVUK design system websites
- Added `ds_code` to render a block of code
- Added `ds_list` for plain lists, bullet lists, and numberedlists
- Added `ds_paragraph` for creating a normal `<p>` body paragraph, and `lead_paragraph` to `fixed_elements` for creating a page-top introductory paragraph
- Added `ds_inset_text` for differentiating a block of text (e.g. quotes) from the surrounding content
- Added `ds_grid` for building grid layout

### Fixed

- Fixed the broken cypress test for the footer

## [0.12.0] - 2026-02-02

Expand Down
131 changes: 131 additions & 0 deletions app/assets/stylesheets/design_system/_hljs.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
/*!
Theme: StackOverflow Light
Description: Light theme as used on stackoverflow.com
Author: stackoverflow.com
Maintainer: @Hirse
Website: https://github.com/StackExchange/Stacks
License: MIT
Updated: 2021-05-15

Updated for @stackoverflow/stacks v0.64.0
Code Blocks: /blob/v0.64.0/lib/css/components/_stacks-code-blocks.less
Colors: /blob/v0.64.0/lib/css/exports/_stacks-constants-colors.less
*/

.hljs {
/* var(--highlight-color) */
color: #2f3337;
/* var(--highlight-bg) */
background: #f6f6f6;
}

.hljs-subst {
/* var(--highlight-color) */
color: #2f3337;
}

.hljs-comment {
/* var(--highlight-comment) */
color: #656e77;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-meta .hljs-keyword,
.hljs-doctag,
.hljs-section {
/* var(--highlight-keyword) */
color: #015692;
}

.hljs-attr {
/* var(--highlight-attribute); */
color: #015692;
}

.hljs-attribute {
/* var(--highlight-symbol) */
color: #803378;
}

.hljs-name,
.hljs-type,
.hljs-number,
.hljs-selector-id,
.hljs-quote,
.hljs-template-tag {
/* var(--highlight-namespace) */
color: #b75501;
}

.hljs-selector-class {
/* var(--highlight-keyword) */
color: #015692;
}

.hljs-string,
.hljs-regexp,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable,
.hljs-link,
.hljs-selector-attr {
/* var(--highlight-variable) */
color: #54790d;
}

.hljs-meta,
.hljs-selector-pseudo {
/* var(--highlight-keyword) */
color: #015692;
}

.hljs-built_in,
.hljs-title,
.hljs-literal {
/* var(--highlight-literal) */
color: #b75501;
}

.hljs-bullet,
.hljs-code {
/* var(--highlight-punctuation) */
color: #535a60;
}

.hljs-meta .hljs-string {
/* var(--highlight-variable) */
color: #54790d;
}

.hljs-deletion {
/* var(--highlight-deletion) */
color: #c02d2e;
}

.hljs-addition {
/* var(--highlight-addition) */
color: #2f6f44;
}

.hljs-emphasis {
font-style: italic;
}

.hljs-strong {
font-weight: bold;
}

.hljs-formula,
.hljs-operator,
.hljs-params,
.hljs-property,
.hljs-punctuation,
.hljs-tag {
/* purposely ignored */
}

pre code.hljs {
display: block;
white-space: pre;
}
38 changes: 38 additions & 0 deletions app/assets/stylesheets/design_system/govuk.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
);

// Use extreme caution when making any design system level style changes or additions here.
@use 'hljs';

.app-header-layout {
display: flex;
Expand Down Expand Up @@ -67,3 +68,40 @@
border: none;
cursor: pointer;
}

.app-example__code {
background-color: #f6f6f6;
box-sizing: border-box;
max-width: 100%;
min-width: 0;
padding: 10px;
padding-top: 2.75rem;
position: relative;
width: 100%;
}

.app-example__scroll {
box-sizing: border-box;
width: 100%;
max-width: 100%;
min-width: 0;
overflow-x: auto;
overflow-y: auto;
padding: 0.5rem;
}

.app-example__code pre {
margin: 0;
min-width: min-content;
}

.app-example__copy-button {
@extend .govuk-button;
@extend .govuk-button--inverse;
font-size: 0.875rem;
line-height: 1.25;
margin: 0;
position: absolute;
top: 0.5rem;
right: 0.5rem;
}
61 changes: 61 additions & 0 deletions app/assets/stylesheets/design_system/nhsuk.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,64 @@
@use 'nhsuk-frontend-10.3.1/components';

// Use extreme caution when making any design system level style changes or additions here.
@use 'hljs';

// Code example block: fixed gray box, only __scroll + content scroll (like GOV.UK app-example).
.app-example__code {
background-color: #f6f6f6;
box-sizing: border-box;
max-width: 100%;
min-width: 0;
padding: 10px;
padding-top: 2.75rem;
position: relative;
width: 100%;
}

.app-example__scroll {
box-sizing: border-box;
width: 100%;
max-width: 100%;
min-width: 0;
overflow-x: auto;
overflow-y: auto;
padding: 0.5rem;
}

.app-example__code pre {
margin: 0;
min-width: min-content;
}

.app-example__copy-button {
@extend .nhsuk-button;
@extend .nhsuk-button--reverse;
@extend .nhsuk-button--small;
margin: 0;
position: absolute;
top: 0.5rem;
right: 0.5rem;
background-color: rgb(255, 255, 255);
color: rgb(0, 127, 59);
border-top-color: rgb(0, 127, 59);
border-top-style: solid;
border-top-width: 1px;
border-right-color: rgb(0, 127, 59);
border-right-style: solid;
border-right-width: 1px;
border-bottom-color: rgb(0, 127, 59);
border-bottom-style: solid;
border-bottom-width: 0px;
border-left-color: rgb(0, 127, 59);
border-left-style: solid;
border-left-width: 1px;
border-radius: 3px;
box-shadow: rgb(0, 127, 59) 0px 4px 0px 0px;
outline-style: none;
font-family: "Frutiger W01";
font-size: 14px;
font-weight: 400;
line-height: 24px;
text-align: center;
text-decoration: none;
}
4 changes: 4 additions & 0 deletions app/helpers/design_system_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,8 @@ def ds_list(type: :default, **options, &block)
def ds_inset_text(text = nil, ...)
DesignSystem::Registry.builder(brand, 'inset_text', self).render_inset_text(text, ...)
end

def ds_code(code, language)
DesignSystem::Registry.builder(brand, 'code', self).render_code(code, language)
end
end
41 changes: 41 additions & 0 deletions app/javascript/design_system/controllers/clipboard_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// app/javascript/controllers/clipboard_controller.js
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
static targets = ['source', 'buttonText']

// Copies the selected text to the clipboard.
copy () {
if (navigator.clipboard && this.hasSourceTarget) {
// The selected text to be copied.
const copytext = this.sourceTarget.value || this.sourceTarget.innerText

navigator.clipboard.writeText(copytext)
.then(() => {
// Fired when the text is successfully copied to the clipboard.
this.showCopiedMessage()
}).catch(err => {
// Fired if an error occurs while copying the text to the clipboard.
console.error('Failed to copy text: ', err)
})
} else {
// Fired if the Clipboard API is not available or the source target is missing.
console.error('Clipboard API not available or source target missing')
}
}

showCopiedMessage () {
// The text to be displayed in the button.
this.buttonTextTarget.textContent = 'Copied!'

// The time interval after which the button text should be reset to "Copy".
const resetInterval = 2000

// Resets the button text to "Copy" after the specified time interval.
const resetButtonText = () => {
this.buttonTextTarget.textContent = 'Copy'
}

setTimeout(resetButtonText, resetInterval)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Controller } from '@hotwired/stimulus'
import hljs from 'highlight.js'

// Connects to data-controller="code-highlight"
export default class extends Controller {
connect () {
hljs.highlightElement(this.element)
}
}
4 changes: 4 additions & 0 deletions app/javascript/design_system/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// Import and register all your controllers
import ClipboardController from './controllers/clipboard_controller'
import CodeHighlightController from './controllers/code_highlight_controller'
import HelloWorldController from './controllers/hello_world_controller'
import ShowPasswordController from './controllers/show_password_controller'
import Timeago from '@stimulus-components/timeago'

// Register design system controllers with Stimulus
export const registerControllers = (application) => {
application.register('ds--clipboard', ClipboardController)
application.register('ds--code-highlight', CodeHighlightController)
application.register('ds--hello-world', HelloWorldController)
application.register('ds--show-password', ShowPasswordController)
application.register('timeago', Timeago)
Expand Down
10 changes: 7 additions & 3 deletions app/views/layouts/govuk/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<header class="govuk-header" data-module="govuk-header">
<div class="govuk-header__container govuk-width-container">
<div class="govuk-header__logo">
<a href="#" class="govuk-header__link govuk-header__link--homepage">
<a href="<%= main_app.root_path %>" class="govuk-header__link govuk-header__link--homepage">
<svg
focusable="false"
role="img"
Expand Down Expand Up @@ -120,8 +120,12 @@
<%= yield :breadcrumbs %>
<%= yield :backlink %>
<main class="govuk-main-wrapper" id="main-content">
<%= render :partial => 'layouts/alert_and_notice' %>
<%= yield %>
<% if content_for?(:main_content_wrapper) %>
<%= yield :main_content_wrapper %>
<% else %>
<%= render :partial => 'layouts/alert_and_notice' %>
<%= yield %>
<% end %>
</main>
</div>
<footer class="govuk-footer">
Expand Down
17 changes: 10 additions & 7 deletions app/views/layouts/nhsuk/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<div class="nhsuk-header__container nhsuk-width-container">
<div class="nhsuk-header__service">
<a class="nhsuk-header__service-logo nhsuk-header__link--service" href="/" aria-label="NHS homepage">
<a class="nhsuk-header__service-logo nhsuk-header__link--service" href="<%= main_app.root_path %>" aria-label="NHS homepage">
<svg class="nhsuk-header__logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" height="40" width="100" focusable="false" role="img" aria-label="NHS">
<title>NHS</title>
<path fill="currentcolor" d="M200 0v80H0V0h200Zm-27.5 5.5c-14.5 0-29 5-29 22 0 10.2 7.7 13.5 14.7 16.3l.7.3c5.4 2 10.1 3.9 10.1 8.4 0 6.5-8.5 7.5-14 7.5s-12.5-1.5-16-3.5L135 70c5.5 2 13.5 3.5 20 3.5 15.5 0 32-4.5 32-22.5 0-19.5-25.5-16.5-25.5-25.5 0-5.5 5.5-6.5 12.5-6.5a35 35 0 0 1 14.5 3l4-13.5c-4.5-2-12-3-20-3Zm-131 2h-22l-14 65H22l9-45h.5l13.5 45h21.5l14-65H64l-9 45h-.5l-13-45Zm63 0h-18l-13 65h17l6-28H117l-5.5 28H129l13.5-65H125L119.5 32h-20l5-24.5Z" />
Expand Down Expand Up @@ -68,13 +68,16 @@
<%= yield :backlink %>

<main class="nhsuk-main-wrapper " id="maincontent" role="main">
<%= render :partial => 'layouts/alert_and_notice' %>
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-full">
<%= yield %>
<% if content_for?(:main_content_wrapper) %>
<%= yield :main_content_wrapper %>
<% else %>
<%= render :partial => 'layouts/alert_and_notice' %>
<div class="nhsuk-grid-row">
<div class="nhsuk-grid-column-full">
<%= yield %>
</div>
</div>
</div>

<% end %>
</main>
</div>

Expand Down
Loading
Loading