aboveyunhai / chakra-dayzed-datepicker

Chakra UI + Dayzed = datepicker
https://aboveyunhai.github.io/chakra-dayzed-datepicker/
MIT License
223 stars 46 forks source link

make it possible to change selected color #7

Closed JohnDeved closed 2 years ago

JohnDeved commented 2 years ago

setting selectedBg to a dark color makes it impossible to read the selected text. and there seems to be no way to change selectedColor

JohnDeved commented 2 years ago

https://github.com/aboveyunhai/chakra-dayzed-datepicker/blob/a5ae792600b3173b146f3fb23060102217ed351a/src/components/dayOfMonth.tsx#L24-L25

there needs to be a line added here that sets a color variable and passes it to the Button component

aboveyunhai commented 2 years ago

can u take a screenshot to show how the issue looks like with your current configs. @JohnDeved and you can always change the text color of the button based on your need.

JohnDeved commented 2 years ago

its seems you are only able to change text color of all buttons, not only the selected ones

aboveyunhai commented 2 years ago

good catch, will take a look at it

JohnDeved commented 2 years ago

here is a snipped on how i used it @aboveyunhai

      <RangeDatepicker
        selectedDates={selectedDates}
        onDateChange={setSelectedDates}
        propsConfigs={{
          dayOfMonthBtnProps: {
            borderColor: 'primary.500',
            selectedBg: 'ruefaGray.600',
            // color: 'white',
            _hover: { bg: 'ruefaGray.500' },
          },
        }}
      />
aboveyunhai commented 2 years ago

@JohnDeved it seems like we need a dedicated props for selected button, let me come out a more general solution over the weekend so it's not limited to background but every styles you want to modify on the selected btn. But the selectedBg will be deprecated most likely.

JohnDeved commented 2 years ago

@aboveyunhai may I give a suggestion?

    <Button
       // [...]
      {...(selected || isInRange ? customBtnSelectedProps : customBtnProps)}
    >

this way you have full control of all selected styles of the button

aboveyunhai commented 2 years ago

@aboveyunhai may I give a suggestion?

    <Button
       // [...]
      {...(selected || isInRange ? customBtnSelectedProps : customBtnProps)}
    >

this way you have full control of all selected styles of the button

u got what I mean, just want to make sure we don't accidentally override something that should stay the same.