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

Implement k responsive window composable #377

Merged

Conversation

akolson
Copy link
Member

@akolson akolson commented Oct 6, 2022

Description

This pr ports the KResponsiveWindowMixin to useKResponsiveWindow composable. Logic has also been refactored to use the Window.matchMedia interface

Issue addressed

Closes #288

Before/after screenshots

Steps to test

(optional) Implementation notes

At a high level, how did you implement this?

useKResponsiveWindow uses Window.matchMedia() to create reactive window properties including width, height, orientation etc

Does this introduce any tech-debt items?

Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical and brittle code paths are covered by unit tests
  • The change has been added to the changelog

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

Post-merge updates and tracking

  • Learning Platform update PR is submitted
  • Learning Platform update PR is merged
  • Studio update PR is submitted
  • Studio update PR is merged
  • Data Portal update PR is submitted
  • Data Portal update PR is merged

Comments

@akolson akolson added the TODO: needs review Waiting for review label Oct 6, 2022
@akolson akolson marked this pull request as ready for review October 6, 2022 17:24
@akolson
Copy link
Member Author

akolson commented Oct 6, 2022

Hi @jtamiace, I am tagging you here so you could have a look at the documentation. Would appreciate your feedback on this. Thanks

Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

Left some comments, but this looks awesome!

lib/useKResponsiveWindow.js Outdated Show resolved Hide resolved
`(max-width: ${1440 - SCROLL_BAR}px)`,
`(max-width: ${1600 - SCROLL_BAR}px)`,
`(min-width: 1601px)`,
];
Copy link
Member

Choose a reason for hiding this comment

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

The above 2 variables don't seem to change during calls to useKResponsiveWindow or widthQueries, so they could be moved further up in scope. Although I don't think it's a big deal.

lib/useKResponsiveWindow.js Outdated Show resolved Hide resolved
lib/useKResponsiveWindow.js Outdated Show resolved Hide resolved
lib/useKResponsiveWindow.js Outdated Show resolved Hide resolved
docs/pages/kresponsivewindow.vue Show resolved Hide resolved
docs/pages/kresponsivewindow.vue Outdated Show resolved Hide resolved
@jtamiace
Copy link
Member

jtamiace commented Oct 7, 2022

@akolson the layout and format of the documentation additions look good to me! Would there be any value to engineers in making a short statement about which scenarios composable is preferable over mixin and vice versa? (I'm not an engineer, so if this is N/A or not helpful, please disregard)

@akolson
Copy link
Member Author

akolson commented Oct 7, 2022

@jtamiace you raise a valid question. More generally, composables are recommended. I will add a section to capture these thoughts. Thanks

@akolson akolson requested review from bjester and rtibbles October 10, 2022 10:32
@akolson
Copy link
Member Author

akolson commented Oct 11, 2022

@bjester @rtibbles & @nucleogenesis, based on Friday feedback, some files were moved around, so incase you need to follow along based on old review, this link captures the previous code including your comments.

Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

I gave the code a look and this looks great. I haven't tested it in Kolibri yet but will do so tomorrow and will give the docs a closer look

lib/useKWindowDimensions.js Outdated Show resolved Hide resolved
@akolson akolson requested a review from nucleogenesis October 13, 2022 10:18
Copy link
Member

@bjester bjester left a comment

Choose a reason for hiding this comment

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

This looks really great! The only blocker, and requested change, is that I think there's likely an issue with useKWindowDimensions-- please see my comment on that

lib/useKWindowDimensions.js Show resolved Hide resolved
lib/useKResponsiveWindow/MediaQuery.js Show resolved Hide resolved
lib/useKResponsiveWindow/MediaQuery.js Show resolved Hide resolved
@akolson akolson requested review from bjester and rtibbles October 17, 2022 08:06
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

With QA before me, Blaine & Richard's thoughts in mind; I've looked through the latest additions in the test suits and they're excellent - this should be good to merge!

@akolson akolson merged commit 29122c4 into learningequality:develop Oct 18, 2022
LianaHarris360 added a commit to LianaHarris360/kolibri-design-system that referenced this pull request Nov 16, 2022
commit f85ddfb
Merge: 29122c4 9d29fe1
Author: akolson <[email protected]>
Date:   Thu Nov 3 22:42:28 2022 +0300

    Merge pull request learningequality#380 from akolson/standardize-kradiobutton-labels

    Wraps KRadioButton label text

commit 9d29fe1
Author: Samson Akol <[email protected]>
Date:   Wed Oct 26 23:34:47 2022 +0300

    updates changelog

commit ba2006c
Author: Samson Akol <[email protected]>
Date:   Wed Oct 26 22:23:03 2022 +0300

    updates documentation

commit f083b25
Author: Samson Akol <[email protected]>
Date:   Wed Oct 26 22:04:02 2022 +0300

    aligns kradiobutton api with kcheckbox's. Changes label from truncate to wrap. Adds truncateLabel prop to truncate text if necessary. updates documenation to reflect changes

commit 29122c4
Merge: 115a19d 84ef450
Author: akolson <[email protected]>
Date:   Tue Oct 18 20:48:16 2022 +0300

    Merge pull request learningequality#377 from akolson/implement-kResponsiveWindow-composable

    Implement k responsive window composable

commit 84ef450
Author: Samson Akol <[email protected]>
Date:   Mon Oct 17 10:51:27 2022 +0300

    Adds more review feedback

commit 94abe9e
Author: Samson Akol <[email protected]>
Date:   Fri Oct 14 19:16:35 2022 +0300

    Improves test descriptions

commit 6dc1d50
Author: Samson Akol <[email protected]>
Date:   Fri Oct 14 18:18:08 2022 +0300

    Adds tests to useKWindowDimensions and useKResponsiveWindow

commit 51d80a3
Author: Samson Akol <[email protected]>
Date:   Thu Oct 13 13:25:31 2022 +0300

    minor string refactors

commit 794ac2a
Author: Samson Akol <[email protected]>
Date:   Thu Oct 13 12:55:00 2022 +0300

    Fixes responsiveness bug on IE

commit 445c740
Author: Samson Akol <[email protected]>
Date:   Wed Oct 12 23:01:34 2022 +0300

    Adds feedback from review

commit 68266f0
Author: Samson Akol <[email protected]>
Date:   Wed Oct 12 18:53:17 2022 +0300

    Improves jsdoc, fixes IE issue

commit b16c125
Author: Samson Akol <[email protected]>
Date:   Mon Oct 10 17:34:57 2022 +0300

    Adds use composition-api to composable due to @vue/composition-api shortcomings in vue2

commit 4075c57
Author: Samson Akol <[email protected]>
Date:   Mon Oct 10 13:30:48 2022 +0300

    Updates kresponsivewindow documentation

commit 5940c76
Author: Samson Akol <[email protected]>
Date:   Mon Oct 10 12:38:45 2022 +0300

    Adds feedback from code review

commit b0fc205
Author: Samson Akol <[email protected]>
Date:   Thu Oct 6 18:27:24 2022 +0300

    Updates changelog

commit e504a70
Author: Samson Akol <[email protected]>
Date:   Thu Oct 6 15:52:29 2022 +0300

    Code refactor

commit 76c13a8
Author: Samson Akol <[email protected]>
Date:   Thu Oct 6 15:12:43 2022 +0300

    Moves composition api initialization to useKResponsiveWindow

commit 9dd5975
Author: Samson Akol <[email protected]>
Date:   Wed Oct 5 17:52:57 2022 +0300

    Updates indentation

commit 078c000
Author: Samson Akol <[email protected]>
Date:   Wed Oct 5 16:34:14 2022 +0300

    uses anonymous function in documentation due to failures in character escaping

commit ad681dd
Author: Samson Akol <[email protected]>
Date:   Wed Oct 5 15:41:46 2022 +0300

    Configures composition api, and documents the useKResponsiveWindow

commit 2d1351e
Author: Samson Akol <[email protected]>
Date:   Tue Oct 4 17:45:50 2022 +0300

    Refactors code, adds documentation

commit 8fe1519
Author: Samson Akol <[email protected]>
Date:   Mon Oct 3 18:59:22 2022 +0300

    fixes bug in breakpoint media query listener

commit f6afdf6
Author: Samson Akol <[email protected]>
Date:   Mon Oct 3 18:56:47 2022 +0300

    Renames responsive window compodable to recommended composable file names

commit c4278c2
Author: Samson Akol <[email protected]>
Date:   Fri Sep 30 23:15:15 2022 +0300

    updates composable  name

commit fca8437
Author: Samson Akol <[email protected]>
Date:   Fri Sep 30 15:57:07 2022 +0300

    Fixes bugs in composable

commit e43b5a0
Author: Samson Akol <[email protected]>
Date:   Thu Sep 29 19:45:59 2022 +0300

    Port of KResponsiveWindowMixin to KResponsiveWindow composable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

update mixins to allow composition API
5 participants