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

feat: adding skeleton component #13780

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

georgewrmarshall
Copy link
Contributor

@georgewrmarshall georgewrmarshall commented Feb 28, 2025

Description

This PR introduces a new Skeleton component to MetaMask Mobile, mirroring the functionality of the Skeleton component in MetaMask Extension. The Skeleton component serves as a placeholder UI element displayed while content is loading.

The reason for this change is to provide a consistent loading UI experience across the application, and to support snaps and the multichain efforts by matching what's available in the extension codebase. The solution includes an animated placeholder component that can adapt to different content layouts, providing visual feedback during loading states.

Key features include:

  • Animated background with pulsing effect
  • Configurable dimensions (height and width)
  • Support for nested children components
  • Option to hide children while maintaining dimensions
  • Automatic sizing to match children when no explicit dimensions are provided

Related issues

Fixes: #3324

Manual testing steps

  1. Go to the Storybook view in the app
  2. Navigate to "Component Library / Skeleton"
  3. Test the basic Skeleton with various width/height values
  4. Test the WithChildren example to see nested Skeletons
  5. Test the HideChildren example by toggling the "Toggle Loading" button
  6. Test the BorderRadius examples to verify different border radius values

Screenshots/Recordings

Before

N/A - This is a new component

After

  • Basic Skeleton with animation and controls
  • Skeleton with nested children components
  • Skeleton with hidden children (loading state)
  • Skeleton with various border radius styles
after720.mov

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@georgewrmarshall georgewrmarshall added the team-design-system All issues relating to design system in Mobile label Feb 28, 2025
@georgewrmarshall georgewrmarshall self-assigned this Feb 28, 2025
@georgewrmarshall georgewrmarshall requested review from a team as code owners February 28, 2025 20:26
Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@georgewrmarshall georgewrmarshall added the No QA Needed Apply this label when your PR does not need any QA effort. label Feb 28, 2025
@georgewrmarshall georgewrmarshall force-pushed the feat/3324/skeleton branch 3 times, most recently from 4230250 to fce3ee1 Compare February 28, 2025 21:05
@georgewrmarshall georgewrmarshall marked this pull request as draft February 28, 2025 21:19
@georgewrmarshall georgewrmarshall removed their assignment Feb 28, 2025
@@ -0,0 +1,105 @@
# Skeleton

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't have an image to put here because there is no Skeleton in Figma

Comment on lines +65 to +84
<View style={styles.base} {...props}>
{/* Animated background always present */}
<Animated.View
style={[styles.background, { opacity: opacityAnim }]}
pointerEvents="none"
{...animatedViewProps}
/>

{children && (
<View
style={[
styles.childrenContainer,
hideChildren ? styles.hideChildren : undefined,
]}
{...childrenWrapperProps}
>
{children}
</View>
)}
</View>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a few nuances here that I'll touch on.

We want children to be both viewable and hideable within the skeleton so we can pass in skeleton loaders to create more complex loading states. See the WithChildren story:

Screenshot 2025-02-28 at 1 42 20 PM

We also want children to be hideable so we can pass in the same content as what is being loaded, allowing the skeleton to resize to fit the children within it. Additional styles might be needed for this—see the HideChildren story:

Screenshot 2025-02-28 at 1 43 59 PM Screenshot 2025-02-28 at 1 44 01 PM

@georgewrmarshall georgewrmarshall added the No E2E Smoke Needed If the PR does not need E2E smoke test run label Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No E2E Smoke Needed If the PR does not need E2E smoke test run No QA Needed Apply this label when your PR does not need any QA effort. team-design-system All issues relating to design system in Mobile
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create component: Skeleton
1 participant