Skip to content

Commit

Permalink
address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
G07cha committed Nov 27, 2023
1 parent f4fce76 commit 1456591
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
9 changes: 5 additions & 4 deletions docs-site/src/components/Examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import DisabledKeyboardNavigation from "../../examples/disabledKeyboardNavigatio
import ReadOnly from "../../examples/readOnly";
import ClearInput from "../../examples/clearInput";
import OnBlurCallbacks from "../../examples/onBlurCallbacks";
import ConfigurePopper from "../../examples/configurePopper";
import ConfigureFloatingUI from "../../examples/configureFloatingUI";
import Portal from "../../examples/portal";
import PortalById from "../../examples/portalById";
import WithPortalById from "../../examples/withPortalById";
Expand Down Expand Up @@ -154,11 +154,12 @@ export default class exampleComponents extends React.Component {
component: CloseOnScrollCallback,
},
{
title: "Configure Popper Properties",
component: ConfigurePopper,
title: "Configure Floating UI Properties",
component: ConfigureFloatingUI,
description: (
<div>
Full docs for the popper can be found at{" "}
Full docs for the underlying library that manages the overlay used can
be found at{" "}
<a
href="https://floating-ui.com/"
target="_blank"
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import PropTypes from "prop-types";
import Calendar from "./calendar";
import CalendarIcon from "./calendar_icon";
import Portal from "./portal";
import PopperComponent, { popperPlacementPositions } from "./popper_component";
import PopperComponent from "./popper_component";
import { popperPlacementPositions } from "./with_floating";
import classnames from "classnames";
import set from "date-fns/set";
import startOfDay from "date-fns/startOfDay";
Expand Down
5 changes: 2 additions & 3 deletions src/popper_component.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import classnames from "classnames";
import React from "react";
import PropTypes from "prop-types";
import { Manager } from "react-popper";
import { FloatingArrow } from "@floating-ui/react";
import TabLoop from "./tab_loop";
import Portal from "./portal";
Expand Down Expand Up @@ -94,12 +93,12 @@ export class PopperComponent extends React.Component {
);

return (
<Manager className="react-datepicker-manager">
<React.Fragment>
<div ref={popperProps.refs.setReference} className={wrapperClasses}>
{targetComponent}
</div>
{popper}
</Manager>
</React.Fragment>
);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/stylesheets/datepicker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
border-radius: $datepicker__border-radius;
display: inline-block;
position: relative;

// Reverting value set in .react-datepicker-popper
line-height: initial;
}
Expand All @@ -34,6 +35,7 @@

.react-datepicker-popper {
z-index: 1;

// Eliminating extra space at the bottom of the container
line-height: 0;

Expand Down
3 changes: 3 additions & 0 deletions src/with_floating.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export default function withFloating(Component) {
const WithFloating = (props) => {
const arrowRef = React.useRef();
const floatingProps = useFloating({
open: !props.hidePopper,
whileElementsMounted: autoUpdate,
placement: props.popperPlacement,
middleware: [
Expand All @@ -47,11 +48,13 @@ export default function withFloating(Component) {
popperPlacement: PropTypes.oneOf(popperPlacementPositions),
popperModifiers: PropTypes.arrayOf(PropTypes.object),
popperProps: PropTypes.object,
hidePopper: PropTypes.bool,
};

WithFloating.defaultProps = {
popperModifiers: [],
popperProps: {},
hidePopper: true,
};

return WithFloating;
Expand Down

0 comments on commit 1456591

Please sign in to comment.