-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: master
Are you sure you want to change the base?
Conversation
…en text is hovered
@drewbaker ready for review. |
@drewbaker just wanted to follow up on this. |
✌️ |
Nick I'm sorry that I lagged on this! Reopening to review today! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some general notes:
- I see scroll bars on Firefox
- 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.
stories/GalleryList.stories.js
Outdated
}, | ||
components: { | ||
GalleryList, | ||
WpImage, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
components/gallery/List.vue
Outdated
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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
components/gallery/List.vue
Outdated
<div class="gallery-list"> | ||
<ul class="list list-main"> |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
components/gallery/List.vue
Outdated
:alt="image.altText" | ||
:caption="caption" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
'has-loaded-media': this.isImageLoaded || this.isVideoLoaded, | ||
'has-full-media-error': this.isVideoError && this.isImageError && !this.isImageLoaded && !this.isVideoLoaded, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
components/gallery/List.vue
Outdated
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 | ||
} | ||
}, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
components/gallery/List.vue
Outdated
flex: 1 1 37%; | ||
|
||
&:last-child { | ||
flex: 1 1 63%; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…g trying to resolve ~ alias in font.css. also use server-middleware file from fuxt
I updated handling of the column layouts but wanted to share a quick screencast of my initial reasoning. |
@drewbaker safe to assume this was a fail? |
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! |
Totally understandable. Especially seeing as how all my PR comments add up
to a small novel. Just wanted to follow up.
…On Wed, Dec 8, 2021, 7:42 PM Drew Baker ***@***.***> wrote:
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!
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#10 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJZOXRL5DW4MPKRQNKZR33UQACPPANCNFSM5EKNTIBA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
@drewbaker just so we are on the same page, I'm going to keep annoying you until you give me an opportunity :) |
@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. |
Component Created:
/components/gallery/List.vue
from #3Stories:
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:
mock-api.json
but the video is fineTime Report:
This took me 7 hours to build.
Checklist: