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

[React]: Create ButtonLink component in shared UI component library #143

Open
georgewrmarshall opened this issue Nov 21, 2024 · 0 comments
Assignees

Comments

@georgewrmarshall
Copy link
Contributor

georgewrmarshall commented Nov 21, 2024

Description

Create a ButtonLink variant for the Button component in React. This variant will be styled as a link, adhering to the design specifications outlined in the Button Audit and Insight Report Figma Board. It should integrate seamlessly with the shared UI component library and follow best practices for accessibility and responsiveness.

Technical Details

  • Component Implementation:

    • Extend or compose the ButtonBase component to create the ButtonLink variant.
    • Default props for this variant:
      • variant: "link"
      • Styles specific to the link button, such as underlined text and hover/active/focus states.
    • Props to support:
      • href?: string (optional, for cases where it is rendered as an <a> tag)
      • size?: ButtonSize.Xs | ButtonSize.Sm | ButtonSize.Md | ButtonSize.Lg | ButtonSize.Xl
      • disabled?: boolean
      • onClick?: (event: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => void
      • iconLeft?: ReactNode
      • iconRight?: ReactNode
      • className?: string
  • Styling:

    • Apply TailwindCSS classes or CSS-in-JS to implement the button's link-like appearance.
    • Include styles for hover, focus, active, and disabled states.
    • The styling should ensure a clear visual distinction between links and other button variants while maintaining design system harmony.
  • Integration:

    • Ensure compatibility with design tokens for typography and spacing.
    • The component should dynamically render as a <button> or <a> element depending on the presence of an href prop.
    • Accessibility features such as aria-disabled and focus outlines must be included.
  • Testing:

    • Add unit tests using Jest and React Testing Library.
    • Include tests for correct rendering as <button> or <a>, based on the href prop.
    • Validate hover, focus, and active states, as well as keyboard and screen reader accessibility.
  • Documentation:

    • Add stories for the ButtonLink variant in Storybook, including:
      • Default appearance.
      • Examples with and without href props.
      • Different sizes and states.
    • Provide usage examples in the component library documentation.

Acceptance Criteria

  • The ButtonLink variant matches the design specs in the Button Audit and Insight Report Figma Board.
  • Component implementation includes:
    • Support for both <button> and <a> elements.
    • Styling for link appearance and all interactive states.
    • Compatibility with all required props and their variations.
  • Unit tests cover at least 80% of the component’s functionality.
  • Component is reviewed and approved by both engineering and design teams.
  • Documentation includes examples, prop descriptions, and integration details.
  • Meets all aspects of the Definition of Done.

References

@georgewrmarshall georgewrmarshall self-assigned this Nov 21, 2024
@georgewrmarshall georgewrmarshall changed the title Copy of [React]: Create ButtonSecondary component in shared UI component library [React]: Create ButtonLink component in shared UI component library Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant