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

Use popper #299

Merged
merged 11 commits into from
Aug 15, 2019
Merged

Use popper #299

merged 11 commits into from
Aug 15, 2019

Conversation

jquense
Copy link
Member

@jquense jquense commented Jun 14, 2019

I think done

Copy link
Member

@taion taion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good

package.json Outdated Show resolved Hide resolved
src/usePopper.js Outdated Show resolved Hide resolved
src/usePopper.js Show resolved Hide resolved
import DropdownContext from './DropdownContext';

export function useDropdownMenu(options = {}) {
// const prevProps = usePrevious(props);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

i guess this is all in usePopper now?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I think it's unneeded here now, but i need to try in RB to confirm

src/Dropdown.js Outdated
import PropTypes from 'prop-types';
import uncontrollable from 'uncontrollable';
import useUncontrolled from 'uncontrollable/hook';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgrade uncontrollable

@TrySound
Copy link
Contributor

TrySound commented Jul 2, 2019

Hi @jquense do you need some help with this?

@jquense
Copy link
Member Author

jquense commented Jul 2, 2019

happy to get some help if you wanna jump in I'm just a bit short on time at the moment

@taion taion mentioned this pull request Jul 9, 2019
@jquense jquense mentioned this pull request Jul 22, 2019
@bpas247

This comment has been minimized.

src/Dropdown.js Outdated Show resolved Hide resolved
src/Dropdown.js Outdated

if (show && !prevOpen) {
this.maybeFocusFirst();
if (focusStype == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to useMemo this outside of this callback? I don't think this needs to be calculated on-the-fly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in practice it only runs on show so it's probably fine

focusInDropdown.current = false;
focusToggle();
}
// only `show` should be changing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense to guard and check the previous value of show anyway?

const handleClose = e => {
if (!context.toggle) return;

context.toggle(false, e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
context.toggle(false, e);
context.toggle?.(false, e);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional chaining plugin is not specified in babel config

}

const handleClose = e => {
if (!context.toggle) return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!context.toggle) return;

src/DropdownMenu.js Outdated Show resolved Hide resolved
src/DropdownMenu.js Outdated Show resolved Hide resolved
src/DropdownMenu.js Outdated Show resolved Hide resolved
Co-Authored-By: Jimmy Jia <tesrin@gmail.com>
@TrySound
Copy link
Contributor

TrySound commented Aug 8, 2019

Is this ready to merge guys?

@jquense jquense merged commit bb5c51f into master Aug 15, 2019
@jquense jquense deleted the usePopper branch August 15, 2019 16:39
@jquense jquense restored the usePopper branch August 15, 2019 16:39
@jquense jquense deleted the usePopper branch August 15, 2019 16:39
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 this pull request may close these issues.

4 participants