Skip to content

chore: Add Code Connect for HeaderStandard - #1359

Open
amandaye0h wants to merge 1 commit into
mainfrom
code-connect/header-standard
Open

chore: Add Code Connect for HeaderStandard#1359
amandaye0h wants to merge 1 commit into
mainfrom
code-connect/header-standard

Conversation

@amandaye0h

@amandaye0h amandaye0h commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

Adds Figma Code Connect mappings for React Native HeaderStandard, targeting the updated component on the Figma branch (slot-based startAccessory / endAccessory).

HeaderStandard.figma.tsx

New HeaderStandard.figma.tsx for React Native

Matched props

  • titletitle
  • subtitlesubtitle
  • startAccessorystartAccessory (via figma.slot())
  • endAccessoryendAccessory (via figma.slot())

Intentionally omits Figma-only properties: withSubtitle (Figma Only)

Figma link: HeaderStandard

Related issues

Manual testing steps

  • Open HeaderStandard in Figma Dev Mode and confirm the React Native snippet appears
  • Toggle withSubtitle (Figma Only) and verify the subtitle in the snippet updates
  • Confirm startAccessory and endAccessory slots render correctly in the example snippet
  • After Figma branch merges, run yarn figma:connect:publish:react-native and re-verify in Dev Mode on main

Screenshots/Recordings

Before

NA

After

Screen.Recording.2026-07-06.at.11.35.34.PM.mov

Pre-merge author checklist

  • I've followed MetaMask Contributor Docs
  • 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 format if applicable

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.

Made with Cursor

Co-authored-by: Cursor <cursoragent@cursor.com>
@amandaye0h
amandaye0h requested a review from a team as a code owner July 6, 2026 14:51
@amandaye0h
amandaye0h marked this pull request as draft July 6, 2026 14:52
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

📖 Storybook Links

Compare the preview for this pull request with the latest Storybooks from the main branch.

🔀 Pull Request Preview

🌳 Main Branch (Latest)

@amandaye0h
amandaye0h marked this pull request as ready for review July 21, 2026 09:05

@georgewrmarshall georgewrmarshall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One functional issue with the subtitle mapping — the manual testing step that verifies toggling withSubtitle (Figma Only) updates the snippet won't pass with the current implementation. Everything else looks correct: startAccessory/endAccessory map to real HeaderBaseProps props, figma.slot() is the right choice, and the omission of onBack/onClose is appropriate for a Code Connect example.

{
props: {
title: figma.string('title'),
subtitle: figma.string('subtitle'),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

figma.string('subtitle') always injects a subtitle into the snippet regardless of whether withSubtitle (Figma Only) is toggled in Figma. The manual testing step expects toggling that property to update the snippet — that requires a boolean wrapper:

subtitle: figma.boolean('withSubtitle (Figma Only)', {
  true: figma.string('subtitle'),
  false: undefined,
}),

*/

figma.connect(
HeaderStandard,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocking: The URL points to the Figma branch (branch/w2n6gtbyemD7VTNoACgrqm). Once the Figma branch merges, this will need updating to the main file URL before republishing — the PR description already notes this, but worth making sure it's tracked as a follow-up so the file doesn't sit published with a stale branch URL.

@georgewrmarshall georgewrmarshall left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two additional issues spotted from the Figma component panel and the generated snippet in Dev Mode.

Screenshot 2026-07-21 at 2 20 03 PM Screenshot 2026-07-21 at 2 20 26 PM

title: figma.string('title'),
subtitle: figma.string('subtitle'),
startAccessory: figma.slot('startAccessory'),
endAccessory: figma.slot('endAccessory'),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

figma.slot() is for Figma SLOT properties — the component playground panel shows startAccessory and endAccessory are instance/nested-component properties, not slots. Using figma.slot() here will either fail to resolve or produce the wrong mapping. These should be mapped with figma.instance() or figma.nestedProps() depending on how the Figma component exposes them.

endAccessory: figma.slot('endAccessory'),
},
example: ({ title, subtitle, startAccessory, endAccessory }) => (
<HeaderStandard

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The generated snippet (visible in Dev Mode) passes raw <ButtonIcon> to startAccessory/endAccessory, which is exactly what HeaderStandard's higher-level props are designed to prevent. For a back button use onBack (standardises IconName.ArrowLeft and size automatically), for a close button use onClose (standardises IconName.Close), and for additional end-side buttons use endButtonIconProps (accepts an array of ButtonIconProps). The example should demonstrate these props rather than reaching past them to startAccessory — otherwise every consumer who copies the snippet will wire up raw ButtonIcon and bypass the size/icon standardisation entirely.

georgewrmarshall pushed a commit that referenced this pull request Jul 22, 2026
## **Description**

Bump `@figma/code-connect` from `1.4.8` to `1.4.9` in the root workspace
and both `@metamask/design-system-react` and
`@metamask/design-system-react-native`.


1.4.9 improves how slot contents are rendered by adopting the augmented
getSlot API from [Code Connect
v1.4.9](https://github.com/figma/code-connect/releases/tag/v1.4.9).

getSlot('SlotName') still renders as before, and the return value now
also exposes connectedInstances — the connected instances directly in
the slot. That lets us render a slot’s connected children inline.

This may resolve the review comment on [PR
#1359](#1359 (comment))
about mapping `startAccessory` / `endAccessory` via slots vs connected
instances.

## **Related issues**

Fixes: N/A

## **Manual testing steps**

1. Confirm `@figma/code-connect` resolves to `1.4.9` (`yarn why
@figma/code-connect`).
2. Run a Code Connect parse/publish dry-run for React and React Native
packages to confirm the CLI still works.
3. Spot-check that existing `.figma.tsx` mappings still load as
expected.

## **Screenshots/Recordings**

N/A — dependency bump only.

### **Before**

N/A

### **After**

N/A

## **Pre-merge author checklist**

- [x] I've followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs)
- [x] 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

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

Made with [Cursor](https://cursor.com)

Co-authored-by: Cursor <cursoragent@cursor.com>
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