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: (Core) introduce new Carousel component #3551

Merged
merged 11 commits into from
Oct 30, 2020
Merged

Conversation

DeepakSap14
Copy link
Contributor

@DeepakSap14 DeepakSap14 commented Oct 5, 2020

Please provide a link to the associated issue.

#3279

Please provide a brief summary of this pull request.

Introducing carousel component in core.

Please check whether the PR fulfills the following requirements

Documentation checklist:

  • update README.md
  • Documentation Examples
  • Stackblitz works for all examples

Known issues:

  1. Looping is not working for Multiple active item.
  2. Mobile swipe functionality not implemented.

@DeepakSap14 DeepakSap14 self-assigned this Oct 5, 2020
@DeepakSap14 DeepakSap14 added 1p core Core library specific issues labels Oct 5, 2020
@DeepakSap14 DeepakSap14 added this to In progress in Development via automation Oct 5, 2020
@DeepakSap14 DeepakSap14 linked an issue Oct 5, 2020 that may be closed by this pull request
@netlify
Copy link

netlify bot commented Oct 5, 2020

Deploy preview for fundamental-ngx ready!

Built with commit 40dad4c

https://deploy-preview-3551--fundamental-ngx.netlify.app

@InnaAtanasova InnaAtanasova removed this from In progress in Development Oct 5, 2020
@InnaAtanasova InnaAtanasova changed the title fix: Introduce Core carousel component feat: (Core) introduce new Carousel component Oct 5, 2020
})
export class CarouselComponent implements OnInit, AfterContentInit, OnDestroy {
/** @hidden */
@ContentChildren(CarouselItemComponent)
Copy link
Contributor

Choose a reason for hiding this comment

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

we need to follow angular coding guidelines for properties alignment. reference angular.io, we can update where ever it is applicable

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. followed angular guidelines.


/** Id for the Carousel. */
@Input()
@HostBinding('attr.id')
Copy link
Contributor

Choose a reason for hiding this comment

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

It is recommended not to use @HostBinding() along with @input()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see its getting used in core components. Do you have any other approach?

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO IT's correct

changeDetection: ChangeDetectionStrategy.OnPush,
encapsulation: ViewEncapsulation.None
})
export class CarouselItemComponent {
Copy link
Contributor

Choose a reason for hiding this comment

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

Base component extension won't help here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Base component is in platform. carousel is in core. so will not be able to use base component.

it('should create', () => {
expect(component).toBeTruthy();
});
});
Copy link
Contributor

Choose a reason for hiding this comment

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

having few test scenarios will help.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

have included tests in carousel component for carousel items as well. removed this file.

imports: [CommonModule],
exports: [CarouselComponent, CarouselItemComponent]
})
export class CarouselNewModule {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Only core we have a carousel why should we have "New"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

using CarouselModule now.

@mikerodonnell89
Copy link
Member

The images in the preview take a very long time to load if they're not cached, perhaps each example can share a service that will load the images so they'll only need to be downloaded once. Also I think that service itself is just very slow so maybe use a different service, placeimg seems to be faster

@mikerodonnell89
Copy link
Member

mikerodonnell89 commented Oct 5, 2020

Thumb swiping for the mobile example (hidden navigation buttons) does not work. This does work for cozy sized multiinputs, check the css

@mikerodonnell89
Copy link
Member

Playing with the width/height inputs, the carousel items overflow beyond the boundaries, is that intentional?

@mikerodonnell89
Copy link
Member

I think <div style="display: flex; justify-content: center; margin-top: 0px;"> can be built in to the component rather than requiring the dev to add it themselves

@droshev droshev added this to In progress in Development via automation Oct 5, 2020
@droshev droshev self-requested a review October 5, 2020 23:44
Copy link
Contributor

@droshev droshev left a comment

Choose a reason for hiding this comment

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

have you implemented the sliding effect:

When the user navigates from the current item to another item, the current item is moved out of the content area, and the next or previous item slides in (depending on the direction of navigation).

On touch devices, users navigate with swipe gestures (swipe right or swipe left).

also the animation is missing when you change the component in

@droshev
Copy link
Contributor

droshev commented Oct 5, 2020

I think <div style="display: flex; justify-content: center; margin-top: 0px;"> can be built in to the component rather than requiring the dev to add it themselves

I agree with @mikerodonnell89 and also it doesn't follow the markup from styles

@droshev
Copy link
Contributor

droshev commented Oct 5, 2020

ork for coz

the sliding should work on any device including the browser

@@ -0,0 +1,39 @@
<fd-carousel [navigatorInPageIndicator]="false" [pageIndicatorContainerPlacement]="'top'">
Copy link
Contributor

Choose a reason for hiding this comment

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

remove "'top'" [] binding here and at other places

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

})
export class CarouselComponent implements OnInit, AfterContentInit, OnDestroy {
/** @hidden */
@ContentChildren(CarouselItemComponent, { descendants: true })
Copy link
Contributor

Choose a reason for hiding this comment

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

I think @ContentChildren is supposed to come after Input() and Output(), right?

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

const ICON_PAGE_INDICATOR_LIMIT = 8;
let carouselUniqueId = 0;

class CarouselActiveItem {
Copy link
Contributor

Choose a reason for hiding this comment

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

would this need to be exported?

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. export added

@@ -0,0 +1,35 @@
<fd-carousel [showPageIndicator]="false" [pageIndicatorContainerPlacement]="'top'">
Copy link
Contributor

Choose a reason for hiding this comment

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

unnecessary binding

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

@JKMarkowski
Copy link
Contributor

I agree with @droshev, this should be used with some functionality of carousel.directive from utils. There is already implemented swipe support

@InnaAtanasova
Copy link
Contributor

InnaAtanasova commented Oct 22, 2020

Hey @DeepakSap14 ,
I found some minor issues testing the component on a mobile device:

  • if you slide slowly sometimes two images are visible at the same time. I understand it's a performance issue but if it's not addressed now could you create an issue for targeting this in the future. Here's a screenshot of the issue:
    Image from iOS (3)

  • Landscape view, you can't make the last card appear in the view. The right button is disabled and the last "dot" is marked as active but you basically can't display the last item. See screenshot:
    Image from iOS (2)

  • this is similar to the issue above. In portrait mode you can't display cards 7th and 8th:
    Image from iOS (1)

  • Message page is not centered on a mobile device
    Image from iOS

@DeepakSap14
Copy link
Contributor Author

Great work! Few things:

  • it looks like there is a double border on the bottom part:
Screen Shot 2020-10-21 at 9 26 36 PM
  • there is a weird effect when you try to drag images:
    carousel
  • can we achieve this sliding with the mouse from the carousel with multiple items in the carousel with 1 active item?
    sliding-carousel
  1. carousel styles does not define focus. So each browser was behaving differently by default. Now for documentation i have included, fd-carousel:focus styles. It is consistent now.
  2. fixed by pointer-event: none style.
  3. fixed. swipe working for single active item as well.

@DeepakSap14
Copy link
Contributor Author

Hey @DeepakSap14 ,
I found some minor issues testing the component on a mobile device:

  • if you slide slowly sometimes two images are visible at the same time. I understand it's a performance issue but if it's not addressed now could you create an issue for targeting this in the future. Here's a screenshot of the issue:
    Image from iOS (3)
  • Landscape view, you can't make the last card appear in the view. The right button is disabled and the last "dot" is marked as active but you basically can't display the last item. See screenshot:
    Image from iOS (2)
  • this is similar to the issue above. In portrait mode you can't display cards 7th and 8th:
    Image from iOS (1)
  • Message page is not centered on a mobile device
    Image from iOS

@InnaAtanasova

  1. I did not get this issue. When animation effect is sliding. then in this current active item slides out and new item slides in. In this process, until sliding is completed. part of both item will be visible. see this example: http://css3.bradshawenterprises.com/sliding/

  2. fixed hidden card issue in Mobile view portrait and landscape.

  3. fixed hidden card issue in Mobile view portrait and landscape.

  4. Error message is center aligned in every screen now.

@DeepakSap14
Copy link
Contributor Author

@InnaAtanasova @droshev This can be reviewed now.
I will hold this for merge as you had suggested.

Copy link
Contributor

@InnaAtanasova InnaAtanasova left a comment

Choose a reason for hiding this comment

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

@DeepakSap14 I verified that my comments have been addressed. Thanks for doing this. Also, great job with the component.

@droshev droshev added this to the Sprint 49 - ariba milestone Oct 26, 2020
Copy link
Contributor

@droshev droshev left a comment

Choose a reason for hiding this comment

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

carousel
looks much better!
One thing i noticed when you Tab over the carousel with multiple items the content gets shifted but the little dots indicating the current page don't.

@manavs
Copy link

manavs commented Oct 27, 2020

carousel
looks much better!
One thing i noticed when you Tab over the carousel with multiple items the content gets shifted but the little dots indicating the current page don't.

May be I am viewing this incorrectly, but looks like when tabbing through to the card which is current is always the middle one. Not sure whether that it part of the requirement spec. This happens when the new set of cards come under view

@DeepakSap14
Copy link
Contributor Author

carousel
looks much better!
One thing i noticed when you Tab over the carousel with multiple items the content gets shifted but the little dots indicating the current page don't.

@droshev
taborder issue has been fixed now.
please review.

Copy link
Contributor

@droshev droshev left a comment

Choose a reason for hiding this comment

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

@DeepakSap14 Great work! LGTM 🚀

@droshev droshev self-requested a review October 30, 2020 12:31
@DeepakSap14 DeepakSap14 merged commit 2c625cb into master Oct 30, 2020
@DeepakSap14 DeepakSap14 deleted the coreCarouselComponent branch October 30, 2020 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core library specific issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Carousel component implementation in ngx-core