Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Task 2: Update front end and add logic to change position by toggle in Sanity

...

  • Update the sanity graphql to add this new toggle in the query: src/queries/sanity/fragments/combo.graphql

  • After updating the query, we need to adjust the ProductCustomizationOptions comp to use the new toggle from Sanity and add a new logic to adjust the order of the items by this toggle.

    • Comp path: src/components/product-detail/product-customization/product-customization-options.tsx

    • This is the part of the code that holds the logic for the list order. The first position of the array is for regular items, and the second object represents the premium options item. We can make a new function and change this to something dynamic based on the new toggle.

...

  • Condition the UI based on the new toggle

  • Test manually the logic

  • The premium options list should be ordered first if the toggle is ON and last if the toggle is OFF

  • Add a new UNIT test using the each from Jest to test if the behavior is correct based in the toggle value (true/false)