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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow replacing the DatePicker's icon through props. #2315

Closed
ldelia opened this issue Nov 19, 2021 · 0 comments 路 Fixed by #2324
Closed

feat: Allow replacing the DatePicker's icon through props. #2315

ldelia opened this issue Nov 19, 2021 · 0 comments 路 Fixed by #2324
Assignees

Comments

@ldelia
Copy link

ldelia commented Nov 19, 2021

Currently, there is no easy way to change the default DatePicker's icon.

Expected Behavior 馃

 <DatePicker 
    {...props} 
    icon={<IconComponent />}
/>

Workaround

import {DatePicker as RRDatePicker} from "react-rainbow-components";

const Holder = styled.span`
  float: left;
  position: relative;
  width: 100%;
  & i {
    position: absolute;
    top: 6px;
    right: 18px;
    background-color: blue;
  }
`;

const CustomDatePicker = styled(RRDatePicker)`
  svg {
    display: none;
  }
`;

const DatePicker = (props: DatePickerProps): JSX.Element => {
    return (
        <Holder>
            <CustomDatePicker {...props} />
            <AssetIcon assetName={"Calendar"} />
        </Holder>
    )
}

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

Successfully merging a pull request may close this issue.

2 participants