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

changed the add documents and reorder links from p tags to list tags … #8347

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

RodneyJohnsonGDS
Copy link
Contributor

@RodneyJohnsonGDS RodneyJohnsonGDS commented Oct 10, 2023

…as these are more semantically and stylistally correct

This commit is a continuation from a previously closed and merged branch, can be founder here:
#8318 (comment)

This commit user story can be found in this Trello link: https://trello.com/c/kEcGRQ1X/531-allow-for-the-reordering-of-documents-within-a-group

⚠️ This repo is Continuously Deployed: make sure you follow the guidance ⚠️

Follow these steps if you are doing a Rails upgrade.

@davidtrussler
Copy link
Contributor

davidtrussler commented Oct 10, 2023

@RodneyJohnsonGDS I think that markup is more appropriate now and consistent but I think the use of display: flex here is a little problematic as it is aligning the links centrally to the header and distorting their vertical alignment, albeit only marginally, so I would prefer to style it without that.

Also, we should probably be a bit more generic in the way the margins and borders for the links are applied so that it could potentially work for single or multiple links.

I'll suggest an alternative in the CSS file.

@@ -15,7 +15,7 @@
display: flex;
align-items: center;

& > p:first-child {
& > li:first-child {
@include govuk-responsive-padding(2, "right");
@include govuk-responsive-margin(2, "right");
border-right: 1px solid $govuk-border-colour;
Copy link
Contributor

@davidtrussler davidtrussler Oct 10, 2023

Choose a reason for hiding this comment

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

I think it would be better to lose the whole app-view-document-collection-group-memberships-index__heading-links class and add a more generic style nested in the app-view-document-collection-group-memberships-index__heading element like below.

That way we can just allow the <li> elements to flow more naturally and add the separating border in a way that doesn't rely on a specific number of links to be present (as it is it would add a rule to the single link for "Add document" when there are none to display). It also centres the vertical rule better and keeps the horizontal alignment with the header.

I think I'd also lose the flexbox layout in the containing element as well because that makes it display oddly on smaller viewports. By floating the <ul> element we can let it flow underneath the heading in this case, though we do need to change the heading from a block level element to allow this, and give it a bit of a margin to avoid the elements clashing.

Once we're nested inside the very specific app-view-document-collection-group-memberships-index__heading element I think we can afford to be far more generic in the way we reference elements so I don't think we need to add specific classes for those.

See what you think. I know it's quite a big change but it makes it closer to the sort of styles we are using in related components. (Also I think flexbox can be overused. 😄)

.app-view-document-collection-group-memberships-index__heading {
  .gem-c-heading {
    display: inline-block;
    @include govuk-responsive-margin(2, "right");
  }

  .govuk-list {
    float: right; 

    li {
      display: inline-block;
      @include govuk-responsive-padding(2, "left");
      @include govuk-responsive-margin(2, "left");
      border-left: 1px solid $govuk-border-colour;

      &:first-child {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
      }
    }
  }
}


<div class="app-view-document-collection-group-memberships-index__heading-links">
<p class="govuk-body govuk-!-text-align-right">
<ul class="govuk-list app-view-document-collection-group-memberships-index__heading-links">
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use the approach above we can lose the app-view-document-collection-group-memberships-index__heading-links class here.

<p class="govuk-body govuk-!-text-align-right">
<%= link_to "Add document", admin_document_collection_group_search_options_path(@collection, @group), class: "govuk-link" %>
</p>
<ul class="govuk-list govuk-body govuk-!-text-align-right">
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, if we use the above approach we can lose the govuk-!-text-align-right class here, and we shouldn't have the govuk-body class at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good, done!

@RodneyJohnsonGDS RodneyJohnsonGDS force-pushed the 531-reordering-of-groups branch 3 times, most recently from 454c598 to bafd479 Compare October 13, 2023 08:34
.gitignore Outdated
@@ -29,3 +29,4 @@
/node_modules
/yarn-error.log
.cache/
.DS_Store/
Copy link
Contributor

Choose a reason for hiding this comment

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

This would need to be more generic to catch all instances of this file as it occurs in many directories and subdirectories (e.g. the one in the app directory has survived). I'm not sure we should need to add this though if we make sure we don't commit those files.

@RodneyJohnsonGDS RodneyJohnsonGDS force-pushed the 531-reordering-of-groups branch from bafd479 to 688bf80 Compare October 13, 2023 13:21
Copy link
Contributor

@davidtrussler davidtrussler left a comment

Choose a reason for hiding this comment

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

LGTM 👍

…cuments within Document Collections

In this commit we changed the way that the css class responsible for the heading links were designed, making them more generic and therefore easier to reuse for future developments.
@RodneyJohnsonGDS RodneyJohnsonGDS force-pushed the 531-reordering-of-groups branch from 75a6035 to da31330 Compare October 13, 2023 13:36
@minhngocd minhngocd merged commit bd4b514 into main Oct 16, 2023
15 checks passed
@minhngocd minhngocd deleted the 531-reordering-of-groups branch October 16, 2023 10:12
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.

3 participants