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

Initial implementation of KImg component #404

Merged

Conversation

thanksameeelian
Copy link
Contributor

@thanksameeelian thanksameeelian commented Jan 11, 2023

Description

This is the initial implementation of the KImg component, which will ultimately fulfill all the specifications of the KImg epic, but for this round only includes src, altText, isDecorative, height, width, min-width, max-width, min-height, and max-height.

Issue addressed

Addresses #369

Steps to test

  1. yarn install
  2. yarn dev
  3. KImg doc page should be accessible at http://localhost:4000/kimg
  4. can edit any of the examples in docs/pages/kimg.vue to test functionality and see results reflected on the KImg doc page

Testing checklist

  • Contributor has fully tested the PR manually

Reviewer guidance

  • Is the code clean and well-commented?
  • Are there tests for this change?
  • Are all UI components LTR and RTL compliant (if applicable)?
  • Add other things to check for here

Comments

@MisRob
Copy link
Member

MisRob commented Jan 12, 2023

@jtamiace if you'd like to read through the documentation, we'd appreciate your input

@MisRob
Copy link
Member

MisRob commented Jan 12, 2023

new Page({
path: '/kimg',
title: 'KImg',
isCode: true,
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to add the keywords property to allow for better searching within the documentation. For example, currently when you try to search an image component using the "image" keyword, the search would yield no results. Please see usages within this file for implementation details

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this isn't automatically showing up as outdated since i added code on the line below, but after checking the code please let me know whether you think the additions in my most recent commit are sufficient or you'd like to see additional keywords.

Copy link
Member

Choose a reason for hiding this comment

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

I think the changes made should suffice. Thanks @thanksameeelian. Non-blocking but would be good to follow existing patterns i.e. pass variable to keywords as opposed to the actual array object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks! i checked out that pattern when i was adding the keywords here, but only saw the pattern of using a variable when multiple items had the same keywords, so the variable was being used in at least two places.

i don't think that pattern is applicable here, as KImg is the only item using those specific keywords. i am following the pattern i saw for each item that had a unique list of variables, as in those cases the array itself was passed. you can see this patten in KSelect and KSwitch in the table of contents. i think this makes sense because it avoids unnecessary abstraction.

but if another item were to share the same keywords at kimg, i would totally agree that a variable would be the right call!

docs/pages/kimg.vue Outdated Show resolved Hide resolved
docs/pages/kimg.vue Outdated Show resolved Hide resolved
lib/KImg.vue Outdated Show resolved Hide resolved
lib/KImg.vue Outdated Show resolved Hide resolved
lib/KImg.vue Outdated
return `${propValue}px`;
} else {
// split numbers apart from units
const [, ...arr] = propValue.match(/(\d*)([\s\S]*)/);
Copy link
Member

Choose a reason for hiding this comment

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

@thanksameeelian Awesome approach 💯 :) This was so much fun and exciting to review. It felt like a sprinkling of magic dust!

lib/KImg.vue Outdated Show resolved Hide resolved
lib/KImg.vue Outdated Show resolved Hide resolved
@akolson
Copy link
Member

akolson commented Jan 12, 2023

Hi @thanksameeelian I reviewed your code alongside @MisRob and we think your code generally looks good! Great Job :). We found few issues for you to look into. Also, to give us better design perspective especially on the documentation, we've added @jtamiace to give her thoughts on https://deploy-preview-404--kolibri-design-system.netlify.app/kimg/

@akolson
Copy link
Member

akolson commented Jan 12, 2023

Something that we pondered about was whether it was necessary to widen the scope of units used. At the moment, only px, em rem, vh are being used. @marcellamaki We are happy to hear your thoughts

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

Please see comments

@thanksameeelian
Copy link
Contributor Author

Hi @thanksameeelian I reviewed your code alongside @MisRob and we think your code generally looks good! Great Job :). We found few issues for you to look into. Also, to give us better design perspective especially on the documentation, we've added @jtamiace to give her thoughts on https://deploy-preview-404--kolibri-design-system.netlify.app/kimg/

thanks so much @akolson & @MisRob! i've read through your comments & i don't think i have any questions about them, but will be sure to ask if i end up needing clarification. i'll get on these changes but also keep my eyes open for feedback from the design team!

@thanksameeelian
Copy link
Contributor Author

Something that we pondered about was whether it was necessary to widen the scope of units used. At the moment, only px, em rem, vh are being used. @marcellamaki We are happy to hear your thoughts

it was just an oversight that i didn't include a more exhaustive list of units initially, so i'm def happy to update and try to catch 'em all! 😀

@marcellamaki
Copy link
Member

Something that we pondered about was whether it was necessary to widen the scope of units used. At the moment, only px, em rem, vh are being used. @marcellamaki We are happy to hear your thoughts

@akolson @MisRob @thanksameeelian - I think having more units would be great idea! At the same time, in my opinion it isn't necessarily a blocker, unless we can think of a specific use case in one of our products right now where we would likely be needing/using some other unit. If so, that should be prioritized - otherwise I see no problem with expanding this on an as-needed basis.

Thanks Amelia for this great work, and Misha and Samson for the very thoughtful and comprehensive review! Very exciting to see this happening :)

@jtamiace
Copy link
Member

This looks great! In terms of additional content, I'm not 100% sure if this suggestion is appropriate for this page which is focused on technical guidance and documentation, but I'm wondering if it makes sense to record any general patterns we use for missing images or error states if an image is broken, or if this is something that's out of the scope of KImg and handled elsewhere. For example in Studio and the Learning Platform we use a light background gray along with a centered icon of the resource type or a generic "image" icon.

@MisRob
Copy link
Member

MisRob commented Jan 17, 2023

One unit I'd suggest adding would be % since it's used commonly

… css units, adjust regex, change code sample display
@thanksameeelian
Copy link
Contributor Author

This looks great! In terms of additional content, I'm not 100% sure if this suggestion is appropriate for this page which is focused on technical guidance and documentation, but I'm wondering if it makes sense to record any general patterns we use for missing images or error states if an image is broken, or if this is something that's out of the scope of KImg and handled elsewhere. For example in Studio and the Learning Platform we use a light background gray along with a centered icon of the resource type or a generic "image" icon.

thank you so much for your feedback jessica!! we've split this project up over several prs (here's the epic!) so creating a placeholder image will be handled in the next pr, and additional error states potentially after that. i'd really appreciate your feedback on those once they're ready if you have the time, so i'll be sure to add examples of them in the doc & tag you/request your review!

@thanksameeelian
Copy link
Contributor Author

thanks so much for the initial round of review, @akolson, @MisRob, @marcellamaki, & @jtamiace!! i made all the changes indicated and would love to hear your thoughts on this new version! in terms of CSS units, i added % (and adjusted the regex) as well as all of the units i think i've encountered in the wild, based on lists provided here - i'd be happy to list all of them if you think that's appropriate, but just didn't want to create anything overwhelming at the moment 🙂 really interested to hear your thoughts!

Copy link
Member

@akolson akolson left a comment

Choose a reason for hiding this comment

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

Hi @thanksameeelian, Thanks for the changes, they LGTM! @MisRob @jtamiace, any other thoughts? Also @marcellamaki , at what point do we do manual QA on this? Should we wait for the component to develop further or have QA take a first look?

@marcellamaki
Copy link
Member

While I think some manual QA would be ideal in most situations, since we don't an immediate github issue in Kolibri that requires this as a fix, and we don't have plans to refactor immediately, I think it's okay to proceed without manual QA for now. There have been a lot of eyes on this, and thoughtful work and feedback, so I feel okay about moving forward without that testing. And, we should remain open to the possibility that some tweaks may be needed as we start integrating this into our products, and that's okay 😄

Copy link
Member

@MisRob MisRob left a comment

Choose a reason for hiding this comment

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

Thank you @thanksameeelian, good work.

I too feel fine about doing manual QA as soon as the component is complete, as some upcoming issues may perhaps require tweaking code here and there a bit in areas that were implemented before.

@thanksameeelian thanksameeelian merged commit 858a85f into learningequality:develop Jan 20, 2023
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.

5 participants