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(ButtonTwoLines): split rendering of button or link #14521

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

TylerAPfledderer
Copy link
Contributor

Splits ButtonTwoLines component to a dedicated ButtonTwoLines and ButtonLinkTwoLines.

Current Behavior

The current ButtonTwoLines relies on type guarding to check if a button or button link should render and accept the appropriate props.

The unintended side-effect with the current approach is that there is child content with specific props used that should not be sent to the Button/ButtonLink component, adding complexity in addressing unexpected issues.

New Behavior

Split the component into dedicated renders of either the Button or ButtonLink and add a creator function (createSplitProps) to help split the props so that only the needed ones for the child content are sent down, and the rest go to the parent component.

Most props are not explicit and are meant for the parent component only, some are meant for both, so need an intermediary to correctly identify who goes to the child content and not to the parent.

Additional Information

  • Removed the old ButtonTwoLines file.
  • Updated the required href prop for the ButtonLink.
  • Added a ButtonLinkTwoLines story. Although it has the same styling, this will confirm the use of ButtonLink without error or regression.

I will note that this seems like overengineering at the moment, as we currently do not employ the component in prod, and therefore do not even know if a rendering with ButtonLink is necessary. Open to discussion of simplification, reverting to the old approach and modifying that, or something else.

Copy link

netlify bot commented Dec 17, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 70ea4cb
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/6761b5eeaf2b6000080030db
😎 Deploy Preview https://deploy-preview-14521--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 50 (🔴 down 6 from production)
Accessibility: 92 (no change from production)
Best Practices: 89 (🔴 down 9 from production)
SEO: 99 (🟢 up 1 from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

1 participant