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

fix(snaps): Ensure that adjacent form elements take up to 50% width #29436

Merged
merged 3 commits into from
Jan 8, 2025

Conversation

david0xd
Copy link
Contributor

@david0xd david0xd commented Jan 6, 2025

Description

Add some SCSS changes to ensure that adjacent form elements take up to 50% width in Snaps custom UI.

Open in GitHub Codespaces

Related issues

Fixes: MetaMask/snaps#2948

Manual testing steps

  1. Install a Snap with custom UI with adjacent form elements like in the example code provided.
  2. Make sure that adjacent form elements take up to 50% of the space available.

Snaps JSX used for testing:

            <Container>
              <Form name="form">
                <Box direction="horizontal">
                  <Field label="baz">
                    <Input name="baz" placeholder="Enter something..." />
                  </Field>
                  <Field label="foo">
                    <Selector title="bar" name="test">
                      <SelectorOption value="one">
                        <Card title="test" value="test" />
                      </SelectorOption>
                    </Selector>
                  </Field>
                </Box>
                <Field label="something_else">
                  <Selector title="bar" name="test2">
                    <SelectorOption value="one">
                      <Card title="test" value="test" />
                    </SelectorOption>
                  </Selector>
                </Field>
                <Box direction="horizontal">
                  <Field label="baz2">
                    <Input name="baz2" placeholder="Enter something..." />
                  </Field>
                  <Field label="foo3">
                    <Input name="foo3" placeholder="Enter something..." />
                  </Field>
                </Box>
                <Box direction="horizontal">
                  <Field label="Example Dropdown">
                    <Dropdown name="example-dropdown">
                      <Option value="option1">Option 1</Option>
                      <Option value="option2">Option 2</Option>
                      <Option value="option3">Option 3</Option>
                    </Dropdown>
                  </Field>
                  <Field label="Example RadioGroup">
                    <RadioGroup name="example-radiogroup">
                      <Radio value="option1">Option 1</Radio>
                      <Radio value="option2">Option 2</Radio>
                      <Radio value="option3">Option 3</Radio>
                    </RadioGroup>
                  </Field>
                </Box>
                <Field label="Example Dropdown full width">
                  <Dropdown name="example-dropdown-full">
                    <Option value="option1">Option 1</Option>
                    <Option value="option2">Option 2</Option>
                    <Option value="option3">Option 3</Option>
                  </Dropdown>
                </Field>
                <Field label="Example RadioGroup full width">
                  <RadioGroup name="example-radiogroup-full">
                    <Radio value="option11">Option 11</Radio>
                    <Radio value="option22">Option 22</Radio>
                    <Radio value="option33">Option 33</Radio>
                  </RadioGroup>
                </Field>
                <Field label="foo4">
                  <Input name="foo4" placeholder="Enter something..." />
                </Field>
                <Box direction="horizontal">
                  <Field label="baz3">
                    <Input name="baz3" placeholder="Enter something..." />
                  </Field>
                </Box>
                <Box direction="horizontal">
                  <Field label="Example Checkbox">
                    <Checkbox name="example-checkbox" label="Checkbox" />
                  </Field>
                  <Field label="Example Selector">
                    <Selector
                      name="example-selector"
                      title="Choose an option"
                      value="option1"
                    >
                      <SelectorOption value="option1">
                        <Card title="Option 1" value="option1" />
                      </SelectorOption>
                      <SelectorOption value="option2">
                        <Card title="Option 2" value="option2" />
                      </SelectorOption>
                      <SelectorOption value="option3">
                        <Card title="Option 3" value="option3" />
                      </SelectorOption>
                    </Selector>
                  </Field>
                </Box>
                <Field label="Example Checkbox Full field">
                  <Checkbox name="example-checkbox-full" label="Checkbox" />
                </Field>
                <Box direction="horizontal">
                  <Field label="baz4">
                    <Input name="baz4" placeholder="Enter something..." />
                  </Field>
                  <Field label="Example FileInput">
                    <FileInput name="file-input-1" />
                  </Field>
                </Box>
                <Field label="Example FileInput 2">
                  <FileInput name="file-input-2" />
                </Field>
                <Box direction="horizontal">
                  <Field label="baz5">
                    <Input name="baz5" placeholder="Enter something..." />
                  </Field>
                  <Field label="FileInput Compact">
                    <FileInput name="file-input-3" compact={true} />
                  </Field>
                </Box>
                <Field label="FileInput Compact 2 full">
                  <FileInput name="file-input-4" compact={true} />
                </Field>
              </Form>
            </Container>

Screenshots/Recordings

Before

Screenshot 2025-01-06 at 13 16 47

After

Screenshot 2025-01-08 at 13 45 12
Screenshot 2025-01-08 at 13 45 31
Screenshot 2025-01-08 at 13 46 51
Screenshot 2025-01-08 at 13 47 05

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.

@david0xd david0xd added the team-snaps-platform Snaps Platform team label Jan 6, 2025
@david0xd david0xd self-assigned this Jan 6, 2025
Copy link
Contributor

github-actions bot commented Jan 6, 2025

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.

@david0xd david0xd force-pushed the dd/snaps-ui-form-proportions branch from 30a38d3 to be54210 Compare January 6, 2025 12:28
@metamaskbot
Copy link
Collaborator

Builds ready [be54210]
Page Load Metrics (1513 ± 49 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint25717561469299143
domContentLoaded1379170414919947
load13871716151310349
domInteractive20173393316
backgroundConnect86123189
firstReactRender15103332713
getState484232311
initialActions01000
loadScripts998126711118239
setupStore67517199
uiStartup154124241767232111

@david0xd david0xd marked this pull request as ready for review January 6, 2025 13:29
@david0xd david0xd requested a review from a team as a code owner January 6, 2025 13:29
@GuillaumeRx GuillaumeRx force-pushed the dd/snaps-ui-form-proportions branch from be54210 to 58cb939 Compare January 7, 2025 14:12
@metamaskbot
Copy link
Collaborator

Builds ready [58cb939]
Page Load Metrics (1646 ± 76 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint51621601596294141
domContentLoaded13222112162215575
load13312161164615976
domInteractive1495412010
backgroundConnect95727178
firstReactRender1674312211
getState55214157
initialActions01000
loadScripts9531695121214569
setupStore686162110
uiStartup15982371188919091

@david0xd david0xd force-pushed the dd/snaps-ui-form-proportions branch from d09322d to 16abe03 Compare January 8, 2025 12:41
@metamaskbot
Copy link
Collaborator

Builds ready [16abe03]
Page Load Metrics (1653 ± 69 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint30320181600329158
domContentLoaded13791993162214067
load14342007165314369
domInteractive25155483015
backgroundConnect7118322813
firstReactRender1577352311
getState4461094
initialActions01000
loadScripts9971618123113465
setupStore67115189
uiStartup16042299187417584

@david0xd david0xd force-pushed the dd/snaps-ui-form-proportions branch from 4f48b71 to 3838321 Compare January 8, 2025 14:48
@metamaskbot
Copy link
Collaborator

Builds ready [3838321]
Page Load Metrics (1904 ± 146 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint24824371549617296
domContentLoaded154327011888301145
load157527231904305146
domInteractive2698502211
backgroundConnect96022157
firstReactRender1673362110
getState45414147
initialActions00000
loadScripts110421361404258124
setupStore769292311
uiStartup181931682190353169

@FrederikBolding FrederikBolding added this pull request to the merge queue Jan 8, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 8, 2025
@david0xd david0xd added this pull request to the merge queue Jan 8, 2025
Merged via the queue into main with commit ed0362c Jan 8, 2025
77 checks passed
@david0xd david0xd deleted the dd/snaps-ui-form-proportions branch January 8, 2025 20:32
@github-actions github-actions bot locked and limited conversation to collaborators Jan 8, 2025
@metamaskbot metamaskbot added the release-12.11.0 Issue or pull request that will be included in release 12.11.0 label Jan 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.11.0 Issue or pull request that will be included in release 12.11.0 team-snaps-platform Snaps Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review proportions when two fields are next to each other
5 participants