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

Nick Berens GridList Component Test #10

Open
wants to merge 37 commits into
base: master
Choose a base branch
from

Conversation

nickberens360
Copy link

@nickberens360 nickberens360 commented Sep 19, 2021

Component Created: /components/gallery/List.vue from #3

Stories: GalleryList.stories.js

Imports:

Imports into component

  • import _dropRight from "lodash/dropRight"
  • import _takeRight from "lodash/takeRight"
  • @font-face RM Neue

Imports into story

  • import WpImage from "~/components/WpImage"
  • import { data as API } from "~/stories/mock-api.json"

Notes:

A good chunk of the excess time went into seeing what the WpImage component was doing under the hood and playing around with using the figcaption element in place of items with media 404s. I would never bill for that extra time of exploration. Also on an actual component request I would ask first about using the figcaption in the way I did. I liked the way it turned out so decided to include it in the test.

The event @error-video from WpImage seems to return true if @error-image is triggered even if @loaded-video and @playing is true. Not sure if this is a bug with the WpImage @error-video event, or if it's simply my misunderstanding of those particular events. So ended up having to use different combinations of @error-video, @error-image, @loaded-image and @loaded-video to handle different media errors.

I created a story to show the handling of 404s.

In the story GalleryList > List With Errors you will find the following:

  • Ace Norton: has 404s on all images and the video which results in the WpImage figcaption being displayed instead of the image or video
  • Michael McCourt: has a video 404 so the image shows instead
  • Andreas Roth: no errors
  • Pedro Pinto: the image for Pedro was broken from the start in mock-api.json but the video is fine

Time Report:

This took me 7 hours to build.

Checklist:

  • I double checked it looks like the designs
  • I completed any required mobile breakpoint styling
  • I completed any required hover state styling
  • I included a working Storybook file
  • I included a Story that showed some edge case working correctly (long text, short screen, missing image etc.)
  • I added notes above about how long it took to build this component
  • I assigned this PR to someone to review

@nickberens360
Copy link
Author

@drewbaker ready for review.

@nickberens360
Copy link
Author

@drewbaker just wanted to follow up on this.

@nickberens360
Copy link
Author

✌️

@drewbaker
Copy link
Member

drewbaker commented Nov 12, 2021

Nick I'm sorry that I lagged on this! Reopening to review today!

@drewbaker drewbaker reopened this Nov 12, 2021
Copy link
Member

@drewbaker drewbaker left a comment

Choose a reason for hiding this comment

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

Some general notes:

  1. I see scroll bars on Firefox
  2. The center column of names should be center of the screen. The way to do this is to divide the names into 3 columns, and then use flex between.

},
components: {
GalleryList,
WpImage,
Copy link
Member

Choose a reason for hiding this comment

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

This isn't being used, can be removed.

Copy link
Author

@nickberens360 nickberens360 Nov 14, 2021

Choose a reason for hiding this comment

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

Removed.

Comment on lines 156 to 160
font-family: 'RM Neue';
src: url('../../assets/fonts/RMNeue-Regular.woff2') format('woff2'),
url('../../assets/fonts/RMNeue-Regular.woff') format('woff');
font-weight: normal;
font-style: normal;
Copy link
Member

Choose a reason for hiding this comment

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

Read this for the correct way we use fonts https://github.com/funkhaus/fuxt/wiki/Fonts

Copy link
Author

@nickberens360 nickberens360 Nov 14, 2021

Choose a reason for hiding this comment

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

Ok this got pretty gross. storybook was breaking because it couldn't resolve the alias ~ to the font files src: url("~/assets/fonts/RMNeue-Regular.woff2") format("woff2"),. After google search hell (I even stumbled upon this :) I pulled down fuxt from your repo and tried setting up the custom font in that project and everything worked as expected so ended up replacing the programming-partners package.json and the nuxt.config.js with the ones from the fuxt repo and it works. I know this isn't ideal but I was going crazy and just wanted to move on.

Comment on lines 2 to 3
<div class="gallery-list">
<ul class="list list-main">
Copy link
Member

Choose a reason for hiding this comment

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

I suspect you don't need both of this elements. Probably can be done with just the ul.

Copy link
Author

Choose a reason for hiding this comment

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

I needed .galler-list to vertically center the hover image and list of items. Also to set the outer width to 1280px. The .list-main class I needed to handle the list columns layout and set max-width to 1180px. Totally cool if there's a better way to handle this but it's pretty much what I landed on.

Comment on lines 41 to 42
:alt="image.altText"
:caption="caption"
Copy link
Member

Choose a reason for hiding this comment

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

These are done by wp-image already

Copy link
Author

@nickberens360 nickberens360 Nov 14, 2021

Choose a reason for hiding this comment

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

I removed the alt tag but I wanted to use the caption incase both the video and image had errors then I could display the caption as a fallback. You can view the story with errors here.
image

Comment on lines +81 to +82
'has-loaded-media': this.isImageLoaded || this.isVideoLoaded,
'has-full-media-error': this.isVideoError && this.isImageError && !this.isImageLoaded && !this.isVideoLoaded,
Copy link
Member

Choose a reason for hiding this comment

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

If you were just trying to show off classes, then cool.

But I think wp-image adds error and loading classes to itself already.

Copy link
Author

Choose a reason for hiding this comment

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

WpImage adds the class has-error if there is a video error OR image error. So if the video fails to load but the image fallback does load WpImage still adds the class had-error. I needed to add a class based on whether or not one of the two media types loaded successfully .has-loaded-media. I also needed a way to add a class based on whether or not both the image and video fully errored .has-full-media-error and then show the caption if so.

Comment on lines 136 to 146
shapeListData(array, offset) {
let count = array.length
let trimLastCount = Math.floor(count / offset)
let rightArray = _takeRight(array, trimLastCount)
let leftArray = _dropRight(array, trimLastCount)

return {
left: leftArray,
right: rightArray
}
},
Copy link
Member

Choose a reason for hiding this comment

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

If you are going to do a function like this, then you can actually do this outside of methods. If the method has no need for anything Vue related, then make a utility function instead and call that.

Copy link
Author

Choose a reason for hiding this comment

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

Good call and moved to utils

Comment on lines 201 to 204
flex: 1 1 37%;

&:last-child {
flex: 1 1 63%;
Copy link
Member

Choose a reason for hiding this comment

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

These look like magic numbers, I'd say generally avoid this approach.

Copy link
Author

@nickberens360 nickberens360 Nov 14, 2021

Choose a reason for hiding this comment

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

Updated, please see the screencast below which explains this madness.

@nickberens360 nickberens360 marked this pull request as draft November 14, 2021 19:26
@nickberens360
Copy link
Author

Some general notes:

  1. I see scroll bars on Firefox
  2. The center column of names should be center of the screen. The way to do this is to divide the names into 3 columns, and then use flex between.

I updated handling of the column layouts but wanted to share a quick screencast of my initial reasoning.
https://www.awesomescreenshot.com/video/6010161?key=211dc6030e4afd8d04052b7d26a6206f

@nickberens360 nickberens360 marked this pull request as ready for review November 14, 2021 20:00
@nickberens360
Copy link
Author

@drewbaker safe to assume this was a fail?

@drewbaker
Copy link
Member

Sorry nick! no safe to assume we’ve just been under the gun trying to get through end of year. I’ll look at this on Monday!

@nickberens360
Copy link
Author

nickberens360 commented Dec 9, 2021 via email

@nickberens360
Copy link
Author

@drewbaker just so we are on the same page, I'm going to keep annoying you until you give me an opportunity :)

@drewbaker
Copy link
Member

@nickberens360 Thanks man you should! I'll need the help in January! We are back from break January 3rd, so I'll get to all this then.

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.

2 participants