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

Related items component #704

Merged
merged 9 commits into from
Jan 13, 2016
Merged

Related items component #704

merged 9 commits into from
Jan 13, 2016

Conversation

binaryberry
Copy link
Contributor

Headed sections of related items.
Accepts an array of sections. Each section can have a title, url, id and a list of related items.
Each item is a hash with a title and url. If the url is external, a rel value can also be provided.

Create a related-items component based on188e526 and on core stylesheets

Care must be taken when using the component so that navigation is always
correctly labelled (pattern based on http://tink.uk/screen-readers-aria-roles-html5-support/). When passing in a section id, use this to add an id attribute and a labelledby attribute. This is in favour of generating an id (eg. by parameterising the title) so that the component isn't using rails specific
features.

screen shot 2016-01-11 at 16 37 44

Trello

paired with @fofr
cc @dsingleton


h2 {
@include core-24;
font-weight: 600;
Copy link
Contributor

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 using 600 here? 700 maps to bold and there's a bold mixin for 24px text which would allow these two lines to be combined.

@include bold-24 from the front end toolkit's _typography.scss.

Copy link
Contributor

Choose a reason for hiding this comment

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

@benlovell
Copy link
Contributor

The ruby bits look good to me. 👍

@fofr
Copy link
Contributor

fofr commented Jan 12, 2016

@gemmaleigh @tombye I've simplified the styles in 7d9fa7e

I haven't added the print mixin as it appears to not yet be imported for components – weirdly the print mixin doesn't come from the toolkit as I expected.

@dsingleton
Copy link
Contributor

I haven't added the print mixin as it appears to not yet be imported for components – weirdly the print mixin doesn't come from the toolkit as I expected.

Component print styles work differently, see #638 (this is something we may want to re-examine, I can't remember the reason for going with this vs print mixin right now)

@fofr
Copy link
Contributor

fofr commented Jan 12, 2016

@dsingleton @tombye Updated print styles in edd2e45

@tombye
Copy link
Contributor

tombye commented Jan 12, 2016

Looks good to me then 👍

items:
- title: "Wikivorce"
url: "http://www.wikivorce.com"
rel: external
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you have other rel values in mind?

If not, it might be simpler to have a boolean is_external field instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I preferred the flexibility of setting rel.

Copy link
Contributor

Choose a reason for hiding this comment

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

To expand, rel values that might be relevant: nofollow, prefetch.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 those make sense, possibly rel="up" too.

I was thinking that in a mustache environment, if we were to do something conditional on a specific value of rel then we'd have issues, but thats theoretical, and it wouldn't be a hard API chance to accommodate that.

@dsingleton
Copy link
Contributor

The component API looks good, markup/styling looks good.

Couple of small comments. The only one i'd want to resolve before merging is the use of rel (happy with that now)

As discussed offline with @fofr having a list of objects, rather than an object of key/value (as we do for the metadata component) is a lot more robust. Arrays preserve order, unlike objects, and support additional values (eg, rel in this case).

We've already run into problems with the later on the metadata component, so I think thats a pattern we should avoid for future components (and consider moving away from with metadata).

Tatiana Soukiassian and others added 8 commits January 13, 2016 15:37
bundle exec rails generate govuk_component related_items
Put back visually hidden part of more link, based on related.raw.html.erb
This distinguishes each more link for accessibility.
When passing in a section id, use this to add an id attribute and a
labelledby attribute. This is in favour of generating an id, eg. by
parameterising the title so that the component isn't using rails specific
features.
Care must be taken when using the component so that navigation is always
correctly labelled.
Pattern based on http://tink.uk/screen-readers-aria-roles-html5-support/
* Use `bold-24` to avoid an extra (and incorrect) font-weight property
* Remove text-colour, the heading colour isn’t being overridden by
anything
* Remove overflow hidden, nothing within the list is being floated
* Remove padding and margin overrides, instead specifying just the
property that’s needed
Follow existing components convention for print styling.
@fofr fofr force-pushed the related-items-component branch from edd2e45 to 73005ef Compare January 13, 2016 15:38
All section titles must be explicitly provided.
dsingleton added a commit that referenced this pull request Jan 13, 2016
@dsingleton dsingleton merged commit 42f6352 into master Jan 13, 2016
@dsingleton dsingleton deleted the related-items-component branch January 13, 2016 16:38
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.

6 participants