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

fix(css): fp-1791 button auto width & django cms form button tweak #560

Merged
merged 5 commits into from
Oct 31, 2022

Conversation

wesleyboar
Copy link
Member

@wesleyboar wesleyboar commented Oct 28, 2022

Overview

  • Buttons should be automatic width by default.
  • Fix button font size, given Core Styles update.
  • More specific selector for Django CMS form button styles.

Related

Changes

  • Load auto width for buttons from Core Styles.
  • Use accurate font-size variable.
  • Add [type="submit"] because not every button is primary.
  • Add .form-button because it should appear in a search.

Testing

Pages:

Steps:

  1. Submit button is brown.
  2. All form buttons are as wide as their text content (plus padding).
  3. All form buttons widths are not resolved by a snippet's code.

UI

Buttons Snippet
code commented out
fp-1791 fp-1791 snippet disabled

- Add `[type="submit"]` because not every button is primary.
- Add `.form-button` because it should appear in a search.
@wesleyboar wesleyboar changed the title fix(css): fp-1791 more specific django cms form button selectors fix(css): fp-1791 tacc button auto width & django cms form button specificity Oct 28, 2022
@wesleyboar wesleyboar changed the title fix(css): fp-1791 tacc button auto width & django cms form button specificity fix(css): fp-1791 core button auto width & django cms form button tweak Oct 28, 2022
@wesleyboar wesleyboar changed the title fix(css): fp-1791 core button auto width & django cms form button tweak fix(css): fp-1791 button auto width & django cms form button tweak Oct 28, 2022
wesleyboar added a commit to TACC/Core-CMS-Custom that referenced this pull request Oct 28, 2022
@wesleyboar wesleyboar force-pushed the fix/fp-1791-form-button-selector-tweak branch from 60aa4f9 to f27c67b Compare October 28, 2022 23:20
wesleyboar added a commit to TACC/Core-CMS-Custom that referenced this pull request Oct 28, 2022
Previous image was missing commit that loaded fix from core-styles.

TACC/Core-CMS#560
Cuz #531 did not test button size.
wesleyboar added a commit to TACC/Core-CMS-Custom that referenced this pull request Oct 29, 2022
TACC/Core-Styles@98cdc10

This APCD testing on #560 did NOT use this, BUT that is okay, BEACUSE this code change would not affect render.

CMS sets button font size explicitely (i.e. overrides this removed code).
Copy link
Member Author

@wesleyboar wesleyboar left a comment

Choose a reason for hiding this comment

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

Notes for reviewers.

Comment on lines -145 to 149
.button-wrapper button {
.form-button,
.button-wrapper button[type="submit"] {
@extend .c-button;
@extend .c-button--primary;
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Explanation. More specific selectors. (Judge my logic, please.)

Background. I want TACC form component classes, but APCD switched to manual forms faster than I could create styles for them, so we are re-using Django CMS form plugin classes.

Reasons.
I assume1 devs will:

  • use .form-button for submit button, with or without .button-wrapper, so style as primary.
  • use .button-wrapper for one or more buttons, so only a submit button should be primary.

Footnotes

  1. I should document2 these instead of assume usage. Even if I make TACC form component, these styles still exist for Django CMS form plugin forms.

  2. So far, the documentation I have is CMS form creation guides. I could document Django CMS form styles during FP-1828.

font-size: var(--global-font-size--medium);
font-size: var(--global-font-size--small);
Copy link
Member Author

@wesleyboar wesleyboar Oct 31, 2022

Choose a reason for hiding this comment

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

Explanation. I had guessed the wrong font size when I first set up these untested CMS-specific c-button styles. [It had been untested], even though CMS has buttons, because the first CMS button was not a .c-button, it was a Django CMS form1 button2.

Footnotes

  1. taccsite_cms/static/site_cms/css/src/_imports/components/django.cms.forms.css

  2. The first c-button came when "+ Add …" and "– Remove" buttons were added to APCD "Request to Submit" form.

"@tacc/core-styles": "^0.9.0",
"@tacc/core-styles": "github:TACC/Core-Styles#fix/fp-1791-automatic-button-width",
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@rstijerina rstijerina left a comment

Choose a reason for hiding this comment

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

Makes sense, LGTM

@wesleyboar wesleyboar merged commit 0cde4e3 into main Oct 31, 2022
@wesleyboar wesleyboar deleted the fix/fp-1791-form-button-selector-tweak branch October 31, 2022 20:49
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.

2 participants