-
Notifications
You must be signed in to change notification settings - Fork 20
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
Move form components into gem #116
Conversation
a395080
to
c0f7806
Compare
startup.sh
Outdated
bundle install | ||
|
||
PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-assets.publishing.service.gov.uk} \ | ||
bundle exec rackup spec/dummy/config.ru --port=3212 --host=0.0.0.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this as running the app is addressed in #115
expect(page).to_not have_selector("[@class='gem-c-radio__input'][@value='govuk-verify'][@checked='checked']", visible: input_visible) | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job on fixing these tests, they look tricky. 🎉
c0f7806
to
a11c968
Compare
This component was originally added in alphagov/government-frontend#552 Moved from government-frontend for use in email-alert-frontend Also renames the namespace to `gem`
Moved from government-frontend for use in email-alert-frontend Also renames the namespace to `gem` This was originally implemented in government-frontend in alphagov/government-frontend#552
Moved from government-frontend for use in email-alert-frontend Also renames the namespace to `gem` Originally implemented in alphagov/government-frontend#561
a11c968
to
7333c6f
Compare
classes ||= '' | ||
text_classes ||= '' | ||
hint_text_classes ||= '' | ||
html_for ||= '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is for
reserved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mirroring the DOM here https://developer.mozilla.org/en-US/docs/Web/API/HTMLLabelElement/htmlFor
Should the components be called:
So their ID and file name matches their component name? |
@fofr I believe the components should be called how they're called, but ideally the guide would have categories to group components. I've halfway got there by prefixing the name that is displayed... Can we raise an issue to allow grouping by category maybe? |
@@ -0,0 +1,25 @@ | |||
// Forked from GOV.UK Frontend, namespace changed to ensure no conflicts. | |||
|
|||
$gem-spacing-scale-0: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you expect an app in a component to also use these variables? eg Spacing is a common thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, that's a good point.
For now since these are forked lets keep them in here, the main reason to namespace these is to avoid collisions when importing GOV.UK Frontend, I'd imagine long term using the proper GOV.UK Frontend scale variables within downstream components is OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, apparently was a bit slow in getting this in. Have only reviewed the first commit so far.
// Fix legend text wrapping in Edge and IE | ||
// 1. IE9-11 & Edge 12-13 | ||
// 2. IE8-11 | ||
box-sizing: border-box; // 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't there a mixin for this? Is there a reason it's not being used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not aware of a mixin for box-sizing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's useful to use this mixin since the support for the unprefixed version is so high at 98%
@@ -0,0 +1,40 @@ | |||
<% | |||
classes ||= '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are most of these declarations empty strings, apart from bold, which is false? They all mostly seem to be handled the same way i.e. if (thing) do something with (thing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bold is a boolean that toggles, the others expect strings, so it seemed reasonable to instantiate them with their expected types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except they're all being treated the same way, as described. Seems inconsistent, but maybe that's just me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What issues are you anticipating? This is how most of the components are done as far as I know?
gem-c-label__hint | ||
<%= hint_text_classes if hint_text_classes %> | ||
" | ||
id="<%= hint_id %>" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint_id looks like an optional parameter but it seems like it's quite important for accessibility? Would it be worth doing a check here to ensure developers remember to pass it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If hint_text
is used but hint_id
is not passed the component will throw an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I suppose it will, won't it. Ah okay.
gem-c-label__text | ||
<%= text_classes if text_classes %> | ||
" | ||
<% if html_for %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would a label not have a for attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in another PR
assert_select ".gem-c-label__text", text: "National Insurance number" | ||
assert_select ".gem-c-label--bold" | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a test for some of the parameters (perhaps added in a later commit, will check) i.e. classes, text_classes, hint_text_classes, html_for.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in another PR, but we havent tested or documented the classes yet, feel free to raise an issue.
padding: 0 0 0 em(40px, 19px); | ||
|
||
clear: left; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason for all the line spaces here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe clean them up at some point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will raise an issue to lint the scss in this repo 👍
Moves form related components needed in email-alert-frontend into the gem so they can be used across applications.
We're avoiding static here since these pages need strong integration tests within the applications they are used in, and
static
mocks components.These were originally implemented in the following pull requests to
government-frontend
We'll move the error related components later to make the PR smaller.
We will do a follow up PR to remove these components from
government-frontend
As part of https://trello.com/c/HSre7K10/453-style-the-mvp-email-collection-page-needed-by-jan