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 Placeholder Styling in CustomSelect #69

Open
ccatherinetan opened this issue Dec 30, 2024 · 0 comments
Open

Fix Placeholder Styling in CustomSelect #69

ccatherinetan opened this issue Dec 30, 2024 · 0 comments

Comments

@ccatherinetan
Copy link
Collaborator

Currently, CustomSelect expects value: T as a prop, and styles the placeholder/value like so:

<P2 $color={COLORS.midgray}>
    {options.find(option => option.value === value)?.label || placeholder}
</P2>

Instead of searching through options to find the corresponding label, we should consider

  1. typing value as DropdownOption<T> so we automatically have access to the label/value pair
  2. making value optional, i.e. value: DropdownOption<T> | undefined so that we can have different styling for the Placeholder vs. the Selected Value (i.e. placeholder should be grey while value should be black).

Alternatively, we can just directly use/style Select from React-Select

This change would affect (i.e. CustomSelect is used in):

  1. Onboarding (for the Review and Submit Screen)
    • no issues arise here b/c the value will always be non-null when a user reaches the review screen
  2. PlantDetails, for the PlantingType input in Add Details Page
    • we're currently handling this by just passing in '' if there's no selected value yet
    • see line 141 of add-details/page.tsx
 <PlantDetails
              plant={plantsToAdd[currentIndex - 1]}
              date={details[currentIndex - 1].date_added ?? getDefaultDate()}
              plantingType={details[currentIndex - 1].planting_type ?? ''}
              onDateChange={date =>
                updateInput('date_added', date, currentIndex - 1)
              }
              onPlantingTypeChange={type =>
                updateInput('planting_type', type, currentIndex - 1)
              }
            />
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

No branches or pull requests

1 participant