GSA / uswds-sf-lightning-community

A Salesforce Lightning Community Theme and related components built upon US Web Design System
Other
32 stars 15 forks source link

USWDS Button #126

Open mvogelgesang opened 2 years ago

mvogelgesang commented 2 years ago

Is your feature request related to a problem? Please describe.

Build out a reusable Button component which can be referenced and used to compose larger components

Describe the solution you'd like

Describe alternatives you've considered

Additional context

mvogelgesang commented 2 years ago

Initial implementation completed, test cases to be addressed.

In the course of implementing, tried to incorporate the NPM classnames package which is used in the Truss React USWDS implementation. Classnames enables an object to be passed to it containing classnames along with true/false as the value. It then evaluates the object returning a well formatted string of css classes. For components like Buttons and others, this helps mitigate the need for ternary operators on many settings. The implementation of classnames was fine and buttons rendered correctly. However, upon attempting to run test cases, the test would fire off after component initialization rather than after the classnames.js file was loaded. As a result, there would be nothing to test. Trying to work around this issue by checking for variables to change status or by implementing promises did not allow the tests to complete successfully. In the end, ternary operators will be used to address the toggling of settings such as Unstyled and Big.

mvogelgesang commented 1 year ago

Moving to 2.1 as more testing and implementation examples are needed