Skip to content

DEV - Update Datepicker: Start Date, End Date, Remove Chips #1868

@traycn

Description

@traycn

Dependency

Overview

We need to update the DatePicker component to utilize two different fields for Start Date and End Date, as well as remove the pre-defined date chips. This will reduce user confusion around how to complete their date range selection.

Action Items

Before getting started...

  • ⚠️ I acknowledge that we are not implementing the pre-selected date chips in the spec ⚠️
    • see Resource, Screenshot: Date Chips In Spec, Do Not Implement

Updating the date picker form fields and dropdowns...

  • Modify the DateSelector component to replace the pre-selected date chips with the ReactDayPicker modal
    • Remove the <DateRanges> component within SelectorBox.Collapse, replace with <ReactDayPicker>
    • Remove the separator div
  • Modify the DatePicker component to have two new fields, StartDate and EndDate
    • Update the Calendar icon to use the new SVG (see references)
    • Move the Calendar icon to the same form field as StartDate
    • Modify renderSelectedDays() to populate these two fields, rather than populating the spans
      • Extra Credit: write in a comment how you might write tests for this user flow
    • Modify border styles on focus
      • border size is 2px
      • border color is SecondaryFocus
    • Modify text color styles...
      • White (#FFFFFF) when a date is provided (pls confirm w/ design)
      • TextSecondaryLight when a date is not provided
  • Modify ReactDayPicker...
    • previous and next arrows should be PrimaryFocus from theme/colors.js
    • Selected Start Day styles are modified...
      • background color will be SecondaryFocus
      • text color will be TextPrimaryDark
      • border is removed
    • Selected range (without start and end dates) styles are modified...
      • background color will be PrimaryLight
    • Selected End Day styles are modified...
      • background color will be PrimaryLight
      • border color is SecondaryFocus
      • border size should be 1px
      • text color should be TextSecondaryLight
    • Extra Credit: find a way to standardize styles within this file, try to reduce usage of magic numbers, but without adding unnecessary indirection
  • Ensure functionality matches the specification, document how you would test the interaction
    • ReactDayPicker should highlight the StartDate/EndDate form field when selecting a new start date/end date (respectively)
    • Clicking the StartDate/EndDate should open the ReactDayPicker dropdown
    • The ReactDayPicker dropdown should close once both StartDate and EndDate have been selected
  • Optional: Consider refactoring components to use more sensible names and/or organization
    • Suggestion: combine DateSelector with DatePicker component, named DateSelectionForm
    • Suggestion: rename ReactDayPicker to DayPickerContainer
  • Extra Credit: make a ticket(s) to do the following...
    • ensure colors are being chosen from our theme file, everywhere in the app
    • consider adopting Tailwind CSS, or some other way of moving our theme data out of bundled JS files

Resources/Instructions

Calendar Icon SVG

<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.6667 3.16671H12V1.83337H10.6667V3.16671H5.33333V1.83337H4V3.16671H3.33333C2.59333 3.16671 2 3.76671 2 4.50004V13.8334C2 14.5667 2.59333 15.1667 3.33333 15.1667H12.6667C13.4 15.1667 14 14.5667 14 13.8334V4.50004C14 3.76671 13.4 3.16671 12.6667 3.16671ZM12.6667 13.8334H3.33333V6.50004H12.6667V13.8334ZM4.33333 9.16671C4.33333 8.24671 5.08 7.50004 6 7.50004C6.92 7.50004 7.66667 8.24671 7.66667 9.16671C7.66667 10.0867 6.92 10.8334 6 10.8334C5.08 10.8334 4.33333 10.0867 4.33333 9.16671Z" fill="#A8A8A8"/>
</svg>

Screenshot: Date Chips In Spec, Do Not Implement

⚠️ We are not adding the chips shown below. Please disregard area marked by the red box ⚠️

Image

Screenshot: Figma Section at a Glance

Date picker components with no parent components

Image

Date picker components within the Search and Filters modal

Image

Hand Off Materials

Screenshot before proposed changes

Screen Shot

Screenshot after proposed changes

Screen Shot

Metadata

Metadata

Assignees

Labels

Complexity: Mediumrequire research/investigation before completing; internal team info/input or external team questionRole: FrontendReact front end workp-feature: Mapassociated with the MAP page for public viewing/interactionp-feature: Search/Filter Modalassociated with the Search/Filter Modal for public interaction/viewingready for dev leadready for developer lead to review the issuesize: 3ptCan be done in 13-18 hours

Type

No type

Projects

Status

In Review

Relationships

None yet

Development

No branches or pull requests

Issue actions