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

🤩fy card & info-tile #3311

Merged
merged 3 commits into from
Nov 28, 2024
Merged

🤩fy card & info-tile #3311

merged 3 commits into from
Nov 28, 2024

Conversation

Kiarokh
Copy link
Contributor

@Kiarokh Kiarokh commented Nov 21, 2024

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)

Windows:

  • Chrome
  • Edge
  • Firefox

Linux:

  • Chrome
  • Firefox

macOS:

  • Chrome
  • Firefox
  • Safari

Mobile:

  • Chrome on Android
  • iOS

@Kiarokh Kiarokh force-pushed the card-3d branch 2 times, most recently from d0af3b5 to 46cfc90 Compare November 21, 2024 15:10
@Kiarokh Kiarokh self-assigned this Nov 21, 2024
@Kiarokh Kiarokh added visual design Visual styling that may or may not affect usability 🦄✨ yolo labels Nov 21, 2024
@Kiarokh Kiarokh changed the title docs(card): UI adjustments in an example 🤩fy card & info-tile Nov 21, 2024
Copy link

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3311/

Copy link
Contributor

@adrianschmidt adrianschmidt left a comment

Choose a reason for hiding this comment

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

Must respect prefers-reduced-motion.

*
* Call `getMouseEventHandlers()` in your component to retrieve the `handleMouseEnter`
* and `handleMouseLeave` functions, and attach them to the target element.
* For example, if your interactive element is the host itself:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if your interactive element is the host itself:

The interactive element can be the host, but its parent must have these styles:

@mixin parent-of-the-3d-element {
    isolation: isolate;
    transform-style: preserve-3d;

    perspective: 1000px;
    @media (prefers-reduced-motion) {
        perspective: 2000px;
    }
}

For the 3D effect to appear properly. For components like Card or Info tile, the only way is to use a nested element, and use it as the interactive element. Not sure if it's enough that we mention which mixins they should use, or if we should document this further.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah! OK. That's maybe related to why it didn't work to move the glow-element either then…?

If the consumer needs to do stuff, we should absolutely document it. (But it's even better if we can do the stuff automatically 😊)

@adrianschmidt
Copy link
Contributor

I realised I've been wanting to gold plate this way too much, and haven't managed to pull it off in a reasonable time. So I've pushed the not-yet-finished gold plated version on the branch card-3d-gold-plate, and reverted this to the state I had saved on card-3d-bak, and then squashed the chore(util): complete the tiltFollowingTheCursor utility function commit into the chore(util): add a utility function to create an interactive 3D effect commit.

Let's get this merged! 😊

This enables consumer components to display a nice
3D effect, when being hovered; enabling them to
follow the cursor's position and tilt towards it.

public componentWillLoad() {
const { handleMouseEnter, handleMouseLeave } = getMouseEventHandlers(
this.host,
Copy link
Contributor

Choose a reason for hiding this comment

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

I realised that to make this quite right, this shouldn't actually be getting event handlers for this.host, but for the interactive element. But then it can't be called from componentWillLoad. This works for now, and I've dragged this PR out for too long already, so I say we merge like this, and then maybe I'll come back and gold plate during a hackday or something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🙏

@adrianschmidt adrianschmidt merged commit 05604fb into main Nov 28, 2024
11 checks passed
@adrianschmidt adrianschmidt deleted the card-3d branch November 28, 2024 08:38
@lime-opensource
Copy link
Collaborator

🎉 This PR is included in version 37.72.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Kiarokh
Copy link
Contributor Author

Kiarokh commented Nov 28, 2024

I realised I've been wanting to gold plate this way too much, and haven't managed to pull it off in a reasonable time. So I've pushed the not-yet-finished gold plated version on the branch card-3d-gold-plate, and reverted this to the state I had saved on card-3d-bak, and then squashed the chore(util): complete the tiltFollowingTheCursor utility function commit into the chore(util): add a utility function to create an interactive 3D effect commit.

Let's get this merged! 😊

Fair enough! 🙏

I made a new PR #3330 from a part of that card-3d-gold-plate to simplify this process even more, and make that other PR a bit smaller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released visual design Visual styling that may or may not affect usability 🦄✨ yolo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants