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

Add panel component #1012

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Add panel component #1012

wants to merge 13 commits into from

Conversation

davidhunter08
Copy link
Contributor

@davidhunter08 davidhunter08 commented Sep 10, 2024

Description

Add panel component for use on confirmation pages.

Large screens

Screenshot 2024-09-12 at 14 19 35

Small screens

Screenshot 2024-09-12 at 14 19 51

Checklist

@edwardhorsford
Copy link
Contributor

@davidhunter08 can you add some screenshots?

packages/components/panel/_panel.scss Show resolved Hide resolved
packages/components/panel/_panel.scss Outdated Show resolved Hide resolved
padding: nhsuk-spacing(6) - $nhsuk-border-width-panel;

@include mq($until: tablet) {
padding: nhsuk-spacing(4) - $nhsuk-border-width-panel;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment for why this is differenet?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure a comment is needed, having different sizing (padding) on desktop and mobile is pretty much standard. Or do you mean the fact we're calculating the padding size (by subtracting the border width)?

@davidhunter08
Copy link
Contributor Author

Font sizes

After reviewing the panel font sizes, taking into consideration the proposed type scale updates, I've change the panel body font size to 24px(20px on mobile).

panel-font-sizes

@davidhunter08 davidhunter08 marked this pull request as ready for review November 22, 2024 14:57
@anandamaryon1
Copy link
Collaborator

@davidhunter08 Thoughts on padding? I can see this totals 40px with the border and padding. Our cards tend to have 32px padding. I wonder whether this should have the same padding amount as cards? Possibly not an issue since they shouldn't ever appear on the same page. But worth considering?

Side note, any idea why the panel includes a 4px border? I assume for print/high-contrast styles?

@davidhunter08
Copy link
Contributor Author

@davidhunter08 Thoughts on padding? I can see this totals 40px with the border and padding. Our cards tend to have 32px padding. I wonder whether this should have the same padding amount as cards? Possibly not an issue since they shouldn't ever appear on the same page. But worth considering?

It makes sense and looks ok having the padding 32px.

32px 40px
32px 40px

Side note, any idea why the panel includes a 4px border? I assume for print/high-contrast styles?

I presumed this was for changed/forced colours, same as the buttons, but I haven't tested it. We can test in the accessibility lab.

@anandamaryon1
Copy link
Collaborator

Tested on Windows with high contrast, 4px transparent border shows white 👍
image

frankieroberto
frankieroberto previously approved these changes Jan 21, 2025
Copy link
Contributor

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Left some minor suggestions.

I also tested it locally without the body as I don’t think that’ll always be needed, and looks good.

packages/components/panel/README.md Outdated Show resolved Hide resolved
Comment on lines +3 to +10
{% set headingLevel = params.headingLevel if params.headingLevel else 1 -%}

<div class="nhsuk-panel
{%- if params.classes %} {{ params.classes }}{% endif %}"
{{- nhsukAttributes(params.attributes) }}>
<h{{ headingLevel }} class="nhsuk-panel__title">
{{ params.titleHtml | safe if params.titleHtml else params.titleText }}
</h{{ headingLevel }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this would be slightly nicer if there was a title object, with text or html and headingLevel as attributes? Might be slightly more consistent with text and html params elsewhere, and then we could potentially also allow adding classes to the heading if needed?

That said, might be over-complicated and introduces a deviation from the govuk component?

Suggested change
{% set headingLevel = params.headingLevel if params.headingLevel else 1 -%}
<div class="nhsuk-panel
{%- if params.classes %} {{ params.classes }}{% endif %}"
{{- nhsukAttributes(params.attributes) }}>
<h{{ headingLevel }} class="nhsuk-panel__title">
{{ params.titleHtml | safe if params.titleHtml else params.titleText }}
</h{{ headingLevel }}>
{% set headingLevel = params.title.headingLevel if params.title.headingLevel else 1 -%}
<div class="nhsuk-panel
{%- if params.classes %} {{ params.classes }}{% endif %}"
{{- nhsukAttributes(params.attributes) }}>
<h{{ headingLevel }} class="nhsuk-panel__title">
{{ params.title.html | safe if params.title.html else params.title.text }}
</h{{ headingLevel }}>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too sure tbh. I am leaning more towards keeping it as is, as (like you said) it might be over-complicating it.

Maybe the question is, does it currently do all the things we need it to do? If yes, then probably best keeping it in line with the govuk component.

It'd be good to get others thoughts on this - cc @anandamaryon1 @edwardhorsford

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inclined to agree @davidhunter08, aligning with gov is a good reason. Once we do a discovery and decide whether we will adopt govuk frontend, it could be that we don't adopt and we diverge more (though unlikely) and make changes like this, but before that, we should align where we can.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me - although perhaps we should quickly check in with the govuk team on if they have any plans to change this.

packages/components/panel/template.njk Outdated Show resolved Hide resolved
Co-authored-by: Frankie Roberto <[email protected]>
Co-authored-by: Frankie Roberto <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants