Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button menu updates #825

Merged
merged 34 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d80fb39
feat(button menu): update the button menu to new specification
chrispymm Oct 7, 2024
c8fa1f6
feat(button menu): wip - continued work on updated button menu
chrispymm Oct 8, 2024
fecd754
feat(button menu): wip - work on styles and interaction details
chrispymm Oct 9, 2024
6f8b3da
ci(husky): prevent husky failing on staging deploy
chrispymm Oct 10, 2024
8f1164c
docs(updating documentation content): updating button menu documentat…
robertjmccarthy Oct 10, 2024
a49a7a7
feat(button menu): final updates to button menu and adjust page heade…
chrispymm Oct 10, 2024
3a74705
feat(button menu): create examples for button menui
chrispymm Oct 11, 2024
7d2a7b4
feat(button menu): remove menu and menuitem roles and switch to list
chrispymm Oct 14, 2024
1c7a0ce
feat(button menu): update tests for new structure and test js and dat…
chrispymm Oct 14, 2024
50ccb1d
Changes to button menu guidance
murrlipp Oct 15, 2024
8e9c1db
Updating example image
murrlipp Oct 15, 2024
4380893
feat(button menu): styling changes to improve accessibility
chrispymm Oct 15, 2024
acd499b
feat(button menu): refactor initMenu method
chrispymm Oct 15, 2024
76c53a8
refactor(button menu): tidy up for code review
chrispymm Oct 16, 2024
7e19ee1
feat(button menu): updates to identity bar and page header actions
chrispymm Oct 16, 2024
56a8ac9
feat(button menu): changes from code review and add tests for single …
chrispymm Oct 16, 2024
37f2043
feat(button menu): update examples to use secondary button style, fix…
chrispymm Oct 17, 2024
59790e0
Button menu updates
murrlipp Oct 17, 2024
5597401
docs(identity bar component updates): updates to the identity bar com…
robertjmccarthy Oct 17, 2024
5e4eb1d
docs(updating documentation content): updating identity bar documenta…
helennickols Oct 17, 2024
9bea821
docs(updating documentation content): updating button menu documentation
helennickols Oct 17, 2024
f9017e7
feat(button menu): set default example to use button tags
chrispymm Oct 17, 2024
0d7ce91
docs(updating documentation content): updating button menu documentation
helennickols Oct 18, 2024
3132655
feat(button menu and date picker): update example images to png
murrlipp Oct 24, 2024
7b953c7
feat(page header actions): update to use moj-button-group instead of …
chrispymm Oct 25, 2024
6096bc4
feat(button menu): update the nunjucks arguments documentation
chrispymm Oct 25, 2024
87ef879
fix(button menu): add in anchor link to button attributes within nunj…
chrispymm Oct 25, 2024
7891a4c
fix(button menu): remove space to fix anchor link
chrispymm Oct 25, 2024
7a96974
docs(button menu): fix references to input in items text and html docs
chrispymm Oct 25, 2024
b00d86d
docs(button menu): remove unnecessary govuk button include in default…
chrispymm Oct 28, 2024
5bfed5b
docs(button menu): final few tweaks
chrispymm Oct 28, 2024
3a8daae
docs(button menu): minor content changes
chrispymm Oct 28, 2024
3b12870
docs(identity bar): update relative links in page
chrispymm Oct 28, 2024
475ee1c
fix(button menu): fix button spacings on very small screens
chrispymm Oct 28, 2024
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
145 changes: 145 additions & 0 deletions docs/examples/button-menu-all/index.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
---
layout: layouts/example.njk
title: Button menu (example)
arguments: button-menu
figma_link: https://www.figma.com/file/N2xqOFkyehXwcD9DxU1gEq/MoJ-Figma-Kit?type=design&node-id=66-5816&mode=design
---

{%- from "moj/components/button-menu/macro.njk" import mojButtonMenu -%}
{%- from "govuk/components/button/macro.njk" import govukButton %}


<h3>Single button</h3>
{{ mojButtonMenu({
items: [{
text: "Primary action",
href: "#"
}]
}) }}

<h3>Default</h3>
{{ mojButtonMenu({
items: [{
text: "Primary action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}

<h3>Secondary button</h3>
{{ mojButtonMenu({
button: {
text: "Print options",
classes: "govuk-button--secondary"
},
items: [{
text: "Primary action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}

<h3>Right aligned</h3>
<div style="display: flex; flex-direction: row-reverse;">
{{ mojButtonMenu({
button: {
text: "Print options",
classes: "govuk-button--secondary"
},
alignMenu: "right",
items: [{
text: "Primary action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}
</div>

<h3>Inverse</h3>
<div style="background-color: #1d70b8; padding: 30px 30px 20px 30px;">
{{ mojButtonMenu({
button: {
text: "Print options",
classes: "govuk-button--inverse"
},
items: [{
text: "Primary action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}
</div>


<h3>Govuk button group</h3>
<div class="govuk-button-group">
{{ govukButton({
text: "Primary action"
})}}
{{ govukButton({
text: "Another action",
classes: "govuk-button--secondary"
})}}
{{ govukButton({
text: "Click me!",
classes: "govuk-button--secondary"
})}}
</div>

<h3>MoJ button group</h3>
<div class="moj-button-group">
{{ govukButton({
text: "Primary action"
})}}
{{ govukButton({
text: "Another action",
classes: "govuk-button--secondary"
})}}
{{ govukButton({
text: "Click me!",
classes: "govuk-button--secondary"
})}}
</div>

<h3>MoJ button group inline (with button menu)</h3>
<div class="moj-button-group moj-button-group--inline">
{{ govukButton({
text: "Primary action"
})}}
{{ mojButtonMenu({
button: {
text: "Print options",
classes: "govuk-button--secondary"
},
items: [{
text: "Action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}
</div>
74 changes: 72 additions & 2 deletions docs/examples/button-menu/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,88 @@ figma_link: https://www.figma.com/file/N2xqOFkyehXwcD9DxU1gEq/MoJ-Figma-Kit?type
---

{%- from "moj/components/button-menu/macro.njk" import mojButtonMenu -%}
{%- from "govuk/components/button/macro.njk" import govukButton %}


<h3>Single button</h3>
{{ mojButtonMenu({
items: [{
text: "Primary action",
href: "#"
}]
}) }}

<h3>Default</h3>
{{ mojButtonMenu({
items: [{
text: "Primary action",
href: "#"
}, {
text: "Second action",
href: "#",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}

<h3>Secondary button</h3>
{{ mojButtonMenu({
button: {
text: "Print options",
classes: "govuk-button--secondary"
},
items: [{
text: "Primary action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#",
href: "#"
}]
}) }}

<h3>Right aligned</h3>
{{ mojButtonMenu({
button: {
text: "Print options",
classes: "govuk-button--secondary"
},
alignMenu: "right",
items: [{
text: "Primary action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}


<h3>Button group</h3>
<div class="govuk-button-group">
{{ govukButton({
text: "Primary action"
})}}
{{ mojButtonMenu({
button: {
text: "Print options",
classes: "govuk-button--secondary"
},
items: [{
text: "Action",
href: "#"
}, {
text: "Second action",
href: "#"
}, {
text: "Third action",
href: "#"
}]
}) }}
</div>
2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gulp.task(
gulp.task(
"watch:styles", () => {
gulp.watch(
["docs/assets/**/*.scss", "src/moj/components/**/*.scss"],
["docs/assets/**/*.scss", "src/moj/**/*.scss"],
gulp.series(["docs:styles"]),
)
}
Expand Down
3 changes: 3 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const config = {
testEnvironment: "jsdom",
testEnvironmentOptions: {
url: "https://design-patterns.service.juice.gov.uk",
},
setupFilesAfterEnv: ["./jest.setup.js"],
};
module.exports = config;
6 changes: 6 additions & 0 deletions src/moj/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,10 @@ MOJFrontend.initAll = function (options) {
MOJFrontend.nodeListForEach($datepickers, function ($datepicker) {
new MOJFrontend.DatePicker($datepicker, {}).init();
})

const $buttonMenus = scope.querySelectorAll('[data-module="moj-button-menu"]')
MOJFrontend.nodeListForEach($buttonMenus, function ($buttonmenu) {
new MOJFrontend.ButtonMenu($buttonmenu, {}).init();
})

}
Loading
Loading