Skip to content

feat(ProductTour): new component - #449

Merged
eszthoff merged 6 commits into
masterfrom
240-product-tour
Feb 26, 2021
Merged

feat(ProductTour): new component#449
eszthoff merged 6 commits into
masterfrom
240-product-tour

Conversation

@eszthoff

@eszthoff eszthoff commented Feb 18, 2021

Copy link
Copy Markdown
Contributor

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. Use imperative, present tense in your commit description ("change", not "changed" or "changes") without uppercases or period (.) at the end.

Checklist

  • The implementation has been manually tested and complies with Textkernel browser support guidelines
  • The implementation complies with accessibility standards.
  • The component has a displayName defined.
  • The component comes with a detailed PropTypes (and defaultProps) definition.
  • Component PropTypes are sufficiently described / documented.
  • There is a story in Storybook.

Comment thread src/components/ProductTour/ProductTour.tsx Outdated
@carlobernardini

Copy link
Copy Markdown
Contributor

How does your API deal with the JF use case for remembering not to show this modal again? I see how to render that checkbox but how do you intend to deal with the business logic.

@eszthoff

Copy link
Copy Markdown
Contributor Author

How does your API deal with the JF use case for remembering not to show this modal again? I see how to render that checkbox but how do you intend to deal with the business logic.

It is up to the application. The state of the checkbox is passed to the application during the onCancel and onFinish callback. The application then can decide what it wants to do, e.g. save in local storage, put in the backend, etc. Does that answer your question?

Comment thread src/components/ProductTour/ProductTour.tsx
Comment thread src/components/ProductTour/ProductTour.tsx
Comment thread stories/ProductTour.tsx Outdated
Comment thread stories/ProductTour.tsx Outdated
onCancel={handleCancel}
onFinished={handleFinished}
>
{slides.slice(0, numberOfSlides)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this can be simplified:

{ Array(numberOfSlides).fill(0).map((_, i) => <div key={slide-${ i }}>Lipsum...</div>) }

@eszthoff eszthoff Feb 24, 2021

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also changed it now, so that different slides are a bit different to see what happens if the text is too long for the fixed size window, so this approach won't work very well. In addition the mock is reused in tests.

@eszthoff eszthoff changed the title WIP: feat(ProductTour): new component feat(ProductTour): new component Feb 24, 2021

&__footer {
position: absolute;
bottom: 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure that position: absolute, bottom: 0 and width: 100% are necessary.
The previous sibling will already push the footer down since it has a fixed height.
And the footer seems to be a block level element, so it should take up full width without explicit definition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I had it without it, and this solution seemed to me a pix better, but indeed it would work without it as well

Comment thread stories/ProductTour.tsx
const isMultiSlide = numberOfSlides > 1;

return (
<ProductTour

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe consider making it possible to dismiss the modal in the story, otherwise I can't read the documentation behind the backdrop ;)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You can :-) just click the show tour checkbox in the knobs. I think adding an actual implementation story for it will be misleading a bit - it is clearer this way that you have to control it from the outside.

};

const handleFinish = () => {
onFinished(isChecked);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very much of a corner case but still FYI:
Consider you have checked the checkbox, then prop checkboxLabel is changed to undefined, isChecked will still be true while there is no checkbox.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed an edge case. I can add code to not return anything if there is no checkbox. For now I assumed the application knows if they want to read this variable or not. It might make it easier for TS if the def always have the (last) value of the checkbox sent over. But if you think there is real danger here, I can remove it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No danger :) just so you know

isOpen={isOpen}
isPositionFixed
{...rest}
{...block()}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this not be {...block(props)}?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Normally yes. But with modal classname is used a bit differently, so no need. They are passed with {...rest}.

@igorarkhipenko

Copy link
Copy Markdown
Contributor

There's a blue outline around the dot once it's clicked. I think it should be removed.
image

{cancelLabel || ''}
</Button>
<Button context="brand" onClick={handleNext}>
{continueLabel || ''}

@igorarkhipenko igorarkhipenko Feb 26, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these two label values can be set to '' as default parameters during props object deconstruction

@eszthoff

Copy link
Copy Markdown
Contributor Author

There's a blue outline around the dot once it's clicked. I think it should be removed.
image

It does help with keyboard navigation, otherwise you don't know you are on the button. As far as I can tell, it is only visible during the click, so I think it is fine. @carlobernardini ?

@igorarkhipenko

Copy link
Copy Markdown
Contributor

There's a blue outline around the dot once it's clicked. I think it should be removed.
image

It does help with keyboard navigation, otherwise you don't know you are on the button. As far as I can tell, it is only visible during the click, so I think it is fine. @carlobernardini ?

For me it remains there even after the click is done. I agree it might get in handy in terms of accessibility but I'm just checking since it's something which was not in the original AC.
BTW I also noticed that switching the focus between dots by pressing Tab behaves a bit oddly. It resets the position of the next dot-to-be-focused each time the selection is made. This is something out of the scope for sure but maybe to consider together with outlining.

@carlobernardini

Copy link
Copy Markdown
Contributor

The outline can stay, it's actually an accessibility best practice. It remains after the click because the element is still focused.
I can't reproduce the positioning issue you describe.

@igorarkhipenko

Copy link
Copy Markdown
Contributor

Nevermind, it just disappeared for me as well while I was trying to record a demo.

@igorarkhipenko

igorarkhipenko commented Feb 26, 2021

Copy link
Copy Markdown
Contributor

Just found how to reproduce that navigating thing. I was testing it in Safari and there you can (hopefully) reproduce it. But I'm not sure how crucial it is for now.

@eszthoff
eszthoff merged commit 143ef95 into master Feb 26, 2021
@eszthoff
eszthoff deleted the 240-product-tour branch February 26, 2021 13:53
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