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

Add Skeleton component #3024

Merged
merged 8 commits into from
Jan 20, 2025
Merged

Add Skeleton component #3024

merged 8 commits into from
Jan 20, 2025

Conversation

david0xd
Copy link
Contributor

@david0xd david0xd commented Jan 16, 2025

Add Skeleton component.

Related PR in extension: MetaMask/metamask-extension#29764

Code example

JSX code used for testing:

            <Container>
              <Box>
                <Text>Skeleton inside text component:</Text>
                <Text>
                  <Skeleton />
                </Text>
                <Text>Classic Skeleton inside a box:</Text>
                <Skeleton />
                <Text>Top level Skeleton: </Text>
                <Skeleton height={32} width="100%" />
                <Skeleton height={16} width="50%" borderRadius="none" />
                <Skeleton height={16} width="25%" borderRadius="medium" />
                <Skeleton height={32} width={32} borderRadius="full" />
                <Text>Skeleton inside Section: </Text>
                <Section>
                  <Skeleton height={32} width="100%" />
                  <Skeleton height={16} width="50%" borderRadius="none" />
                  <Skeleton height={16} width="25%" borderRadius="medium" />
                  <Skeleton height={32} width={32} borderRadius="full" />
                </Section>
                <Text>Skeleton inside Row: </Text>
                <Row label="Row">
                  <Skeleton height={22} width="30%" />
                </Row>
                <Row label="Row">
                  <Text>
                    <Skeleton height={22} width={40} />
                  </Text>
                </Row>
              </Box>
            </Container>

Screenshots

Screenshot 2025-01-17 at 13 09 22

@david0xd david0xd self-assigned this Jan 16, 2025
@david0xd david0xd force-pushed the dd/add-skeleton-component branch from 09ffc44 to f584d23 Compare January 16, 2025 20:40
@david0xd david0xd marked this pull request as ready for review January 16, 2025 20:44
@david0xd david0xd requested a review from a team as a code owner January 16, 2025 20:44
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.76%. Comparing base (657cf53) to head (fd05758).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3024   +/-   ##
=======================================
  Coverage   94.76%   94.76%           
=======================================
  Files         499      500    +1     
  Lines       10906    10911    +5     
  Branches     1672     1672           
=======================================
+ Hits        10335    10340    +5     
  Misses        571      571           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/snaps-sdk/src/jsx/components/Skeleton.ts Outdated Show resolved Hide resolved
packages/snaps-sdk/src/jsx/components/Skeleton.ts Outdated Show resolved Hide resolved
packages/snaps-sdk/src/jsx/validation.ts Outdated Show resolved Hide resolved
@david0xd david0xd force-pushed the dd/add-skeleton-component branch from b824b3c to 9b0d9a7 Compare January 20, 2025 14:08
@david0xd david0xd force-pushed the dd/add-skeleton-component branch from 9b0d9a7 to fd05758 Compare January 20, 2025 14:32
@david0xd david0xd merged commit d71d6d8 into main Jan 20, 2025
164 checks passed
@david0xd david0xd deleted the dd/add-skeleton-component branch January 20, 2025 14:46
FrederikBolding pushed a commit to MetaMask/metamask-extension that referenced this pull request Jan 27, 2025
## **Description**
Add Skeleton to Snaps UI components.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/29764?quickstart=1)

## **Related issues**
Fixes: MetaMask/snaps#2940

## **Related Pull Requests**
Snaps PR: MetaMask/snaps#3024

## **Manual testing steps**
1. Make and install test Snap with source code that uses Skeleton
component.
2. Check if it matches expectations.

Snap UI JSX code used for testing:
```typescript
            <Container>
              <Box>
                <Text>Skeleton inside text component:</Text>
                <Text>
                  <Skeleton />
                </Text>
                <Text>Classic Skeleton inside a box:</Text>
                <Skeleton />
                <Text>Top level Skeleton: </Text>
                <Skeleton height={32} width="100%" />
                <Skeleton height={16} width="50%" borderRadius="none" />
                <Skeleton height={16} width="25%" borderRadius="medium" />
                <Skeleton height={32} width={32} borderRadius="full" />
                <Text>Skeleton inside Section: </Text>
                <Section>
                  <Skeleton height={32} width="100%" />
                  <Skeleton height={16} width="50%" borderRadius="none" />
                  <Skeleton height={16} width="25%" borderRadius="medium" />
                  <Skeleton height={32} width={32} borderRadius="full" />
                </Section>
                <Text>Skeleton inside Row: </Text>
                <Row label="Row">
                  <Skeleton height={22} width="30%" />
                </Row>
                <Row label="Row">
                  <Text>
                    <Skeleton height={22} width={40} />
                  </Text>
                </Row>
              </Box>
            </Container>
```

## **Screenshots/Recordings**
### **Before**
Skeleton was not available before. Nothing to show here.

### **After**
![Screenshot 2025-01-17 at 13 09
22](https://github.com/user-attachments/assets/fb1be740-f06d-4da0-80ec-7fb3c5cbf1d3)

## **Pre-merge author checklist**
- [ ] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask
Extension Coding
Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.
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.

2 participants