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

feat: add CrossFlicking Preset #901

Merged
merged 24 commits into from
Dec 6, 2024
Merged

Conversation

malangfox
Copy link
Contributor

@malangfox malangfox commented Nov 21, 2024

Details

CrossFlicking supports flicking that can move in both horizontal and vertical directions.
You can easily create UIs with panels with multiple categories with this preset.

Documentation

https://malangfox.github.io/egjs-flicking/Presets

Examples

Rules

  • Moving the first panel up in the vertical Flicking changes to the previous category and changes the index in the horizontal Flicking.
  • Moving the last panel down in the vertical Flicking changes to the next category and changes the index in the horizontal Flicking.

@coveralls
Copy link

coveralls commented Nov 21, 2024

Coverage Status

coverage: 82.653% (-0.2%) from 82.888%
when pulling 5f632ca on malangfox:feat/crossflicking
into 0305df3 on naver:master.

*/
import React, { ReactNode } from "react";

const CrossGroup = React.forwardRef((props: { children?: ReactNode }, ref: React.Ref<HTMLDivElement>) => <div ref={ref}>{props.children}</div>);
Copy link
Member

Choose a reason for hiding this comment

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

It seems that CrossGroup should also have Element properties (className).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed to use properties of elements in CrossGroup.

}

public render() {
const props = this.props;
Copy link
Member

Choose a reason for hiding this comment

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

It seems like you'll need to filter only the parts you need from Cross's props.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added logic to filter props before passing them to the CrossFlicking instance.


Object.keys(SIDE_EVENTS).forEach((eventKey: keyof typeof EVENTS) => {
const eventName = SIDE_EVENTS[eventKey];
this._bindEvent(eventName);
Copy link
Member

Choose a reason for hiding this comment

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

Must be paired with unmount.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extended from react-flicking, react-crossflicking calls destroy on unmount to remove all event handlers.

onSideChanged: (e: CrossFlickingEvent<ChangedEvent>) => {},
};

class CrossFlicking extends Flicking {
Copy link
Member

Choose a reason for hiding this comment

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

Is the method available?

Copy link
Contributor Author

@malangfox malangfox Nov 28, 2024

Choose a reason for hiding this comment

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

CrossFlicking extends Flicking in react, and Flicking includes a @withFlickingMethods decorator that allows to use existing methods.

@malangfox malangfox requested a review from daybrush November 28, 2024 07:44
@malangfox malangfox merged commit 1eaa5b0 into naver:master Dec 6, 2024
4 checks passed
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.

3 participants