Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[PBNTR-479] Expose margin bottom on Text Input within Typeahead #3654

Merged
merged 7 commits into from
Sep 6, 2024

Conversation

ElisaShapiro
Copy link
Contributor

@ElisaShapiro ElisaShapiro commented Sep 4, 2024

What does this PR do? A clear and concise description with your runway ticket url.
PBNTR-479 exposes the margin bottom on the text input that lies within a wrapper inside the Typeahead kit so that a dev can to modify kit's margin_bottom. The doc examples showcase margin_bottom values of: none, xxs, xs, sm, md, lg, and xl. The Rails doc example show a react-rendered rails version of the kit but functions the same in the rails-only version as well. The initial doc example showed both rails versions within the doc example but that felt like overkill.

This work is modeled after work previously done on the datepicker kit here, and functions the same. There was an additional incidental finding discovered here: the dark margin bottom doc examples for both typeahead (rails and react) and datepicker (rails) did not initially work as expected due to the margin_bottom still being hardcoded into the dark mode section of text_input.scss. All doc examples where the prescribed margin_bottom was small or smaller (none through sm) had margin_bottom values that calculated to sm due to the hardcoded value on the text-input-wrapper. The larger ones visually appeared right but upon inspection one can see the additional margin on the text-input-wrapper. This is fixed in this PR (see datepicker screenshots in screenshot section).

PBNTR-373's doc examples will require the work from this ticket as this previously-unreachable internal margin prevents the ability to vertically align the child Typeahead kit with the Radio button.

Screenshots: Screenshots to visualize your addition/change
Rails margin bottom doc example
for PR rails doc ex
React margin bottom doc example
for PR react dark mode typeahead doc ex

Incidental dark mode issue shown with datepicker:
margin bottom not working as expected in prod (see first three examples all with margin_bottom small)
dark mode margin bottom wrong datepicker prod
margin bottom fixed (all margin bottoms correctly responsive)
dark mode fix datepicker kit

How to test? Steps to confirm the desired behavior:

  1. Go to margin bottom doc example (rails/react).
  2. Inspect each typeahead to see margin_bottom prop in action.
  3. Test typeaheads/typical paths in nitro-web milano environment to ensure works.

Checklist:

  • LABELS Add a label: enhancement, bug, improvement, new kit, deprecated, or breaking. See Changelog & Labels for details.
  • DEPLOY I have added the milano label to show I'm ready for a review.
  • TESTS I have added test coverage to my code.

@ElisaShapiro ElisaShapiro added the enhancement New Features, Props, & Variants (USED IN CHANGELOG) label Sep 4, 2024
@ElisaShapiro ElisaShapiro self-assigned this Sep 4, 2024
@ElisaShapiro ElisaShapiro added milano 20 MAX - Deploy this PR to a review environment via Milano alpha labels Sep 4, 2024
Copy link

github-actions bot commented Sep 4, 2024

🎉 Congratulations on creating an Alpha Version!

Your Alpha for Ruby Gems is 14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3669

Your Alpha for NPM is 14.2.1-alpha.PBNTR479removeextraspacingfromradiochildren3669

Copy link

github-actions bot commented Sep 4, 2024

🎉 Congratulations on creating an Alpha Version!

Your Alpha for Ruby Gems is 14.2.1.pre.alpha.PBNTR479removeextraspacingfromradiochildren3671

Your Alpha for NPM is 14.2.1-alpha.PBNTR479removeextraspacingfromradiochildren3671

@ElisaShapiro ElisaShapiro marked this pull request as ready for review September 5, 2024 19:57
@ElisaShapiro ElisaShapiro requested review from a team as code owners September 5, 2024 19:57
nidaqg
nidaqg previously approved these changes Sep 6, 2024
@nidaqg nidaqg added the Code Approved Approved by a Playbook Admin label Sep 6, 2024
@nidaqg nidaqg added this pull request to the merge queue Sep 6, 2024
Merged via the queue into master with commit cff399f Sep 6, 2024
6 checks passed
@nidaqg nidaqg deleted the PBNTR-479-remove-extra-spacing-from-radio-children branch September 6, 2024 19:41
nidaqg added a commit that referenced this pull request Sep 9, 2024
github-merge-queue bot pushed a commit that referenced this pull request Sep 20, 2024
…479 (#3680)

**What does this PR do?** A clear and concise description with your
runway ticket url.
[PBNTR-515](https://runway.powerhrg.com/backlog_items/PBNTR-515) is
attempt #2 at
[PBNTR-479](https://runway.powerhrg.com/backlog_items/PBNTR-479), which
had to be reverted from the Playbook 14.3.1 release due to an issue
found in ninja testing where the
[Creatable-async-data](https://playbook.powerapp.cloud/kits/typeahead/react#createable-async-data)
typeahead used here ([nitroqa
link](https://nitro.powerhrg.com/connect/nitroqa.powerhrg.com/powerlife/admin/dizzles_sizzle/new),
[component code
link](https://github.com/powerhome/nitro-web/blob/297ab6ada0a694f65d91740d17572c2b04d98036/components/brand_headlines/app/javascript/Shared/TagSelector.tsx#L5))
did not work.

The change to the React in this PR vs PBNTR-479 mirrors the Rails
version of the code much more closely - I realized that there was no
need to pass the `marginBottom` prop from the Typeahead.tsx component to
it's Control.tsx subcomponent because the `marginBottom="none"` in the
subcomponent was being applied to a TextInput, not to anything Typeahead
related (so no need to pass props).

Steps for PR completion:
- [x] Step 1: rectify this specific issue by reworking the React
Typeahead margin bottom change (still inspired by the previous
datepicker change) and alpha test immediately in nitro-web in this
specific location.
- [x] Step 2: add in the rest of the work (Rails Typeahead margin bottom
work and dark mode margin bottom work from [PBNTR-479's
PR](#3654) into this one, and
re-alpha test. (Note, the [React Radio Children doc
example](https://playbook.powerapp.cloud/kits/radio/react#children)
alignment task will no longer included here as PBNTR-373 required a
revert as well - this task will likely be a part of that ticket's fix
PR).



**Screenshots:** Screenshots to visualize your addition/change
Rails margin bottom doc example
<img width="1308" alt="for PR rails dark mode mb"
src="https://github.com/user-attachments/assets/03cab2f3-6c4a-4713-ac4f-3b3d40e08c32">
React margin bottom doc example
<img width="1319" alt="for PR react light mode mb"
src="https://github.com/user-attachments/assets/3d0c4a0c-0ae9-4826-8e1e-c536544a1765">
Datepicker dark mode margin bottom doc example works (compare vs current
prod)
<img width="1316" alt="for PR datepicker rails dark"
src="https://github.com/user-attachments/assets/761c0100-4335-4bb7-89ae-18ebfde9e548">



**How to test?** Steps to confirm the desired behavior:
1. Go to margin bottom doc example
([rails](https://pr3680.playbook.beta.px.powerapp.cloud/kits/typeahead#margin-bottom)/[react](https://pr3690.playbook.beta.px.powerapp.cloud/kits/typeahead/react#margin-bottom)).
2. Inspect each typeahead to see margin_bottom prop in action.
3. Test typeaheads/typical paths in [nitro-web milano
environment](https://pr42423.nitro-web.beta.gm.powerapp.cloud/) to
ensure works. The particular typeahead with issues initially inspiring
the revert is located
[here](https://pr42423.nitro-web.beta.gm.powerapp.cloud/powerlife/admin/dizzles_sizzle/new)
(definitely test this one).


#### Checklist:
- [x] **LABELS** Add a label: `enhancement`, `bug`, `improvement`, `new
kit`, `deprecated`, or `breaking`. See [Changelog &
Labels](https://github.com/powerhome/playbook/wiki/Changelog-&-Labels)
for details.
- [x] **DEPLOY** I have added the `milano` label to show I'm ready for a
review.
- [x] **TESTS** I have added test coverage to my code.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
alpha Code Approved Approved by a Playbook Admin enhancement New Features, Props, & Variants (USED IN CHANGELOG) milano 20 MAX - Deploy this PR to a review environment via Milano Product Approved pending technical review, OK to merge to master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants