Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
5e56642
feature branch: hackathon 2024
dreamwasp Jun 23, 2025
3ef612a
a robot made this
dreamwasp Jun 23, 2025
4b4650c
created example instance
LinKCoding Jun 23, 2025
8609d2f
added landing page example
LinKCoding Jun 24, 2025
b9cc613
code connected
LinKCoding Jun 24, 2025
0e1112c
new rulez (#3120)
dreamwasp Jun 24, 2025
c656b60
merged figma files and rules
LinKCoding Jun 24, 2025
8a2a745
merge conflict leftovers
LinKCoding Jun 24, 2025
fd12641
updated figma index files
LinKCoding Jun 24, 2025
bb60dcb
moved figma files into a single folder
LinKCoding Aug 6, 2025
c93b61d
update figma config file and delete logo figma file
LinKCoding Aug 14, 2025
8259042
somewhat working anchor, still an error with icon though
LinKCoding Aug 14, 2025
99c6121
added a single icon for testing and updated anchor figma file
LinKCoding Aug 14, 2025
c6f56df
updated badge figma
LinKCoding Aug 14, 2025
38d0736
update CTAbutton
LinKCoding Aug 14, 2025
f93b72d
got leading/trailing icons to publish
LinKCoding Aug 18, 2025
a672926
cleaning up of figma files
LinKCoding Aug 19, 2025
50d38fc
fix imports
LinKCoding Aug 19, 2025
fdc6b33
working on card
LinKCoding Aug 19, 2025
c2ef55f
more card testing
LinKCoding Aug 19, 2025
b151390
updated code connect and more atoms
LinKCoding Aug 20, 2025
760bedf
more atoms
LinKCoding Aug 20, 2025
116d2d9
merged main
LinKCoding Aug 20, 2025
ff2aee5
more fixes
LinKCoding Aug 20, 2025
5196f95
more atoms and trying out template
LinKCoding Aug 21, 2025
e2dac87
removed template file
LinKCoding Aug 21, 2025
f1b7ffe
more atoms
LinKCoding Aug 21, 2025
f24f4fc
added formgroup
LinKCoding Aug 21, 2025
31873fa
more atoms
LinKCoding Aug 22, 2025
0d7be46
more atoms
LinKCoding Aug 22, 2025
88954e4
more atoms
LinKCoding Aug 22, 2025
09520b8
nest children inside tags
LinKCoding Aug 22, 2025
9234239
minor updates
LinKCoding Aug 22, 2025
beec8d2
keeping generated code
LinKCoding Aug 22, 2025
3dff694
tiny update to function type
LinKCoding Aug 22, 2025
2c79e0b
remove stories and moved code into separate folder
LinKCoding Aug 22, 2025
af1585e
moved example code to different folder
LinKCoding Aug 22, 2025
19d51b6
update figma.config.json to only include figma.tsx files
LinKCoding Aug 22, 2025
cd6f047
added instructions for copilot and cleaned up some old cold
LinKCoding Aug 22, 2025
b5b6ab1
one more example and instructions add
LinKCoding Aug 22, 2025
824b5ac
clean up from hackathon files
LinKCoding Aug 22, 2025
67516c8
adding leftover files
LinKCoding Aug 25, 2025
ea40b2c
removed extra folder + file
LinKCoding Aug 25, 2025
3b20b25
merged main
LinKCoding Aug 28, 2025
777d236
revert react-hook-form bump in yarn.lock
LinKCoding Aug 28, 2025
5ddf045
added rules and re-org'd files
LinKCoding Aug 28, 2025
bc1ae28
removed figma cli dependency
LinKCoding Aug 28, 2025
7dd8f3c
fix linting errors
LinKCoding Aug 28, 2025
0aa7790
added documentation for figma MCP and code connect
LinKCoding Aug 28, 2025
1a640d6
updated some links and text
LinKCoding Aug 28, 2025
e571332
formatted
LinKCoding Aug 28, 2025
f1360a8
add comment
LinKCoding Aug 28, 2025
e50f059
some small clean ups
LinKCoding Aug 28, 2025
50c4d95
updated card and iconbutton figma files
LinKCoding Aug 29, 2025
6873007
Merge branch 'main' into kl-gm-1194-gamut-codeconnect-atoms
LinKCoding Sep 2, 2025
69fc40e
add Molecules folder
LinKCoding Sep 2, 2025
b56036d
revert molecules addition
LinKCoding Sep 2, 2025
4c1c53b
Merge branch 'main' into kl-gm-1194-gamut-codeconnect-atoms
dreamwasp Sep 3, 2025
2e68fee
apply Cass's feedback
LinKCoding Sep 3, 2025
f214b73
updates to form elements
LinKCoding Sep 8, 2025
cb7d6e0
deleting unused figma files to avoid publishing conflicts with other …
LinKCoding Sep 10, 2025
3755c70
Merge branch 'main' into kl-gm-1194-gamut-codeconnect-atoms
LinKCoding Sep 11, 2025
397ec2d
commenting out input related props until figma design work is done
LinKCoding Sep 11, 2025
68776fb
updated input figma file
LinKCoding Sep 12, 2025
1eb7c0d
Merge branch 'main' into kl-gm-1194-gamut-codeconnect-atoms
LinKCoding Sep 15, 2025
da261a9
deleted basebutton figma file
LinKCoding Sep 15, 2025
d5bac29
deleted unused figma files to avoid publishing
LinKCoding Sep 25, 2025
f6f9346
Merge branch 'main' into kl-gm-1194-gamut-codeconnect-atoms
LinKCoding Sep 25, 2025
ed28c42
feat: Implement CodeConnect for Molecules (#3164)
LinKCoding Oct 6, 2025
04a124a
feat: Implement CodeConnect for Organisms (#3175)
LinKCoding Oct 6, 2025
9616032
fix immediate errors
LinKCoding Oct 6, 2025
c5e45dd
atoms figma redesign followups
LinKCoding Oct 10, 2025
043f431
Merge branch 'main' into kl-gm-1194-gamut-codeconnect-atoms
LinKCoding Oct 14, 2025
55ac831
ignore eslint and prettier for code-connect files
LinKCoding Oct 14, 2025
9bbcb3e
add back in react imports to avoid TS errors
LinKCoding Oct 14, 2025
8edfa2b
Merge branch 'main' into kl-gm-1194-gamut-codeconnect-atoms
LinKCoding Oct 16, 2025
e474c16
update code connect storybook page
LinKCoding Oct 16, 2025
7b04e50
fix MCP files and update code connect guidance
LinKCoding Oct 16, 2025
bf31d1d
MCP updates
LinKCoding Oct 21, 2025
c9e7d95
updated figma mcp docs
LinKCoding Oct 22, 2025
7e27b06
updated mcp to include beta text
LinKCoding Oct 22, 2025
175466f
apply meeting feedback
LinKCoding Oct 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
165 changes: 165 additions & 0 deletions .cursor/rules/figma-rules.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
---
description: Figma Dev Mode MCP rules
alwaysApply: true
---

# Figma Dev Mode MCP Rules

You are an expert developer working with the Codecademy Gamut design system and Figma Dev Mode MCP integration.

When generating code from Figma designs, follow these rules:

## MANDATORY Pre-Generation Steps

**BEFORE generating ANY code from Figma, you MUST:**

1. **Inspect the Figma layer hierarchy**:

- Call `get_metadata` WITH the nodeId to get parent component info
- Call `get_metadata` WITHOUT nodeId (empty string) to attempt to get CHILD layers
- **IMPORTANT**: Current limitation - `get_metadata` may not return nested child layer names (icons, nested components, etc.)
- **If child layer names are not available from tooling:**
- Analyze the screenshot and make your best guess about which icons/nested components are used
- Look for visual clues (user icon, gear icon, etc.) and match them to likely Gamut icon names
- Search the codebase to verify the icon exists (e.g., check for `PersonIcon`, `GearIcon`, etc. in `/packages/gamut-icons/src`)
- Generate the code using your best guess
- **AFTER generating the code**, ask the user to confirm the icons are correct
- Example: "I've generated the code using PersonIcon and GearIcon based on what I see in the screenshot. Can you confirm these are the correct icons from the Figma layers?"
- Map icon layer names to components in the codebase (e.g., "Regular/Interface/PersonIcon" → `PersonIcon`, "Mini/MiniCheckCircleIcon" → `MiniCheckCircleIcon`)

2. **Read token files** (use read_file tool on ALL of these):

- `/packages/gamut-styles/src/variables/spacing.ts`
- `/packages/gamut-styles/src/variables/colors.ts`
- `/packages/gamut-styles/src/variables/typography.ts`
- `/packages/gamut-styles/src/variables/borderRadii.ts`

3. **Search for existing components** (use codebase_search):

- Check if similar component exists in `/packages/gamut/src`
- If exists, extend it instead of creating new one

4. **Understand the design system patterns**:
- Read example components like Badge, Tag, or Button
- Follow variance, system props, and styledOptions patterns

## Asset Management

- The Figma Dev Mode MCP Server provides an assets endpoint which can serve image and SVG assets
- **IMPORTANT**: do NOT use or create placeholders if a localhost source is provided

## Component Usage

- **IMPORTANT**: Always use components from `/packages` whenever possible
- Check if the Figma component name matches a Gamut component name and use that component
- **IMPORTANT**: All patterns should come from `/packages/gamut-patterns` - use the design's metadata to match the Figma component name to the pattern component
- **IMPORTANT**: All illustrations should come from `/packages/gamut-illustrations` - use the design's metadata to match the Figma component name to the illustration component
- **IMPORTANT**: All icons should come from `/packages/gamut-icons`:
- Try to get icon layer names from Figma metadata
- If layer names are not available, make your best guess based on the screenshot and verify the icon exists in the codebase
- Generate the code with your best guess, then confirm with the user after
- Map icon layer names to Gamut components (e.g., "Regular/Interface/PersonIcon" → `PersonIcon` from `@codecademy/gamut-icons`)

## Styling Guidelines - STRICT RULES

### ❌ NEVER Do This:

```tsx
// NEVER use hardcoded pixel values
height: 24,
width: '64px',
fontSize: 14,

// NEVER use hardcoded hex colors
color: '#ffffff',
backgroundColor: '#000000',

// NEVER use CSS properties not in system props
backdropFilter: 'blur(1px)',

// NEVER use inline styles
style={{ fontSize: 14 }}
```

### ✅ ALWAYS Do This:

```tsx
// ALWAYS use spacing tokens (4, 8, 12, 16, 24, 32, 40, 48, 64, 96)
height: 24, // from spacing.ts
width: 64, // from spacing.ts

// ALWAYS use fontSize tokens (14, 16, 18, 20, 22, 26, 34, 44, 64)
fontSize: 14, // from typography.ts

// ALWAYS use borderRadii tokens (none, sm, md, lg, xl, full)
borderRadius: 'full', // from borderRadii.ts

// ALWAYS use semantic color tokens
bg: 'background',
color: 'text',
borderColor: 'border',

// ALWAYS use system props via system.css or styled components
system.css({
bg: 'black',
color: 'white',
borderRadius: 'full',
})
```

### Token Mapping Rules:

1. **Spacing/Sizing**: Map Figma values to closest token from `spacing.ts`

- 4px, 8px, 12px, 16px, 24px, 32px, 40px, 48px, 64px, 96px

2. **Colors**: Use semantic tokens OR core colors from `colors.ts`

- Semantic: `background`, `text`, `border`, `text-secondary`, etc.
- Core: `navy`, `white`, `black`, `blue`, `green`, `red`, `yellow`, etc.
- For Background component only: use color names (navy, white, etc.)

3. **Border Radius**: Use tokens from `borderRadii.ts`

- none (0px), sm (2px), md (4px), lg (8px), xl (16px), full (999px)

4. **Typography**: Use tokens from `typography.ts`

- fontFamily: `accent`, `base`, `monospace`, `system`
- fontSize: 14, 16, 18, 20, 22, 26, 34, 44, 64
- fontWeight: 400, 700 or `base`, `title`
- lineHeight: `base` (1.5), `title` (1.2), `spacedTitle` (1.3)

5. **If no exact match**: Document in code comment why custom value needed

### Emotion & CSS-in-JS Patterns:

- **IMPORTANT**: Do not use inline styles
- Use `styled` from `@emotion/styled`
- Use `system.css()` for style objects
- Use `styledOptions` for styled component options
- Compose system props with `variance.compose()`

## Accessibility & Best Practices

- **IMPORTANT**: Follow WCAG requirements for accessibility
- Always follow best practices from `/packages/styleguide/src/lib/Meta/Best Practices.mdx`

## Implementation

- Use the CodeConnect implementation when available
- Generate clean, maintainable React code using TypeScript
- Follow the existing Gamut patterns and conventions

## Post-Generation Validation

After generating code, verify:

- [ ] No hardcoded hex colors (`#` in color values)
- [ ] No hardcoded pixel strings (`'24px'` format)
- [ ] All spacing values match tokens from spacing.ts
- [ ] All colors use semantic tokens or theme colors
- [ ] All border radius uses borderRadii tokens
- [ ] Component follows Gamut patterns (variance, system props, styledOptions)
- [ ] No inline styles
- [ ] Uses emotion styled components
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ docs
**/tmp
packages/gamut-icons/src/icons
packages/gamut-patterns/src/patterns
**/code-connect/**
packages/code-connect
.nx
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = {

plugins: ['eslint-plugin-gamut'],

ignorePatterns: ['packages/code-connect/**/*'],

rules: {
'gamut/prefer-themed': 'error',
'gamut/no-css-standalone': 'error',
Expand Down
Empty file.
189 changes: 189 additions & 0 deletions .github/instructions/figma.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
---
applyTo: '**'
priority: high
---

# Figma Dev Mode MCP Rules

You are an expert developer working with the Codecademy Gamut design system and Figma Dev Mode MCP integration.

When generating code from Figma designs, follow these rules:

## WORKFLOW TRIGGER - CRITICAL

**When you see ANY of these patterns:**

- Figma URL mentioned (figma.com/design/...)
- nodeId provided
- "generate from figma" or similar requests
- MCP Figma server is being used

## MANDATORY Pre-Generation Steps - MUST BE COMPLETED IN ORDER

**Step 1: Figma Inspection (REQUIRED)**

- [ ] Call `get_metadata` WITH nodeId
- [ ] Call `get_metadata` WITHOUT nodeId
- **IMPORTANT**: Current limitation - `get_metadata` may not return nested child layer names (icons, nested components, etc.)
- **If child layer names are not available from tooling:**
- Analyze the screenshot and make your best guess about which icons/nested components are used
- Look for visual clues (user icon, gear icon, etc.) and match them to likely Gamut icon names
- Search the codebase to verify the icon exists (e.g., check for `PersonIcon`, `GearIcon`, etc. in `/packages/gamut-icons/src`)
- Generate the code using your best guess
- **AFTER generating the code**, ask the user to confirm the icons are correct
- Example: "I've generated the code using PersonIcon and GearIcon based on what I see in the screenshot. Can you confirm these are the correct icons from the Figma layers?"
- Map icon layer names to components in the codebase (e.g., "Regular/Interface/PersonIcon" → `PersonIcon`, "Mini/MiniCheckCircleIcon" → `MiniCheckCircleIcon`)
- [ ] Call `get_image` to get screenshot FOR CONFIRMATION ONLY
- [ ] **Validate that screenshot matches metadata understanding**

**Step 1.5: Metadata Analysis (NEW - REQUIRED)**

- [ ] **PRIMARY SOURCE**: Use Figma metadata to determine:
- Component name and type
- Layer structure and nested components
- Any CodeConnect implementations mentioned
- [ ] **SECONDARY SOURCE**: Use screenshot only to:
- Confirm visual styling details
- Identify icons if not available in metadata
- Validate layout and spacing
- [ ] **If metadata says "Badge" but screenshot looks different, trust the metadata**

**Step 2: Token Analysis (REQUIRED)**

- [ ] Read `/packages/gamut-styles/src/variables/spacing.ts`
- [ ] Read `/packages/gamut-styles/src/variables/colors.ts`
- [ ] Read `/packages/gamut-styles/src/variables/typography.ts`
- [ ] Read `/packages/gamut-styles/src/variables/borderRadii.ts`

**Step 3: Component Research (REQUIRED)**

- [ ] Search for existing components in `/packages/gamut/src`
- [ ] Read existing component if found
- [ ] Determine if extending existing vs creating new

**Step 4: Generate Code**

- [ ] Use existing components when possible
- [ ] Follow token mapping rules strictly
- [ ] Validate against post-generation checklist

## Asset Management

- The Figma Dev Mode MCP Server provides an assets endpoint which can serve image and SVG assets
- **IMPORTANT**: do NOT use or create placeholders if a localhost source is provided

## Component Usage

- **IMPORTANT**: Always use components from `/packages` whenever possible
- Check if the Figma component name matches a Gamut component name and use that component
- **IMPORTANT**: All patterns should come from `/packages/gamut-patterns` - use the design's metadata to match the Figma component name to the pattern component
- **IMPORTANT**: All illustrations should come from `/packages/gamut-illustrations` - use the design's metadata to match the Figma component name to the illustration component
- **IMPORTANT**: All icons should come from `/packages/gamut-icons`:
- Try to get icon layer names from Figma metadata
- If layer names are not available, make your best guess based on the screenshot and verify the icon exists in the codebase
- Generate the code with your best guess, then confirm with the user after
- Map icon layer names to Gamut components (e.g., "Regular/Interface/PersonIcon" → `PersonIcon` from `@codecademy/gamut-icons`)

## Styling Guidelines - STRICT RULES

### ❌ NEVER Do This:

```tsx
// NEVER use hardcoded pixel values
height: 24,
width: '64px',
fontSize: 14,

// NEVER use hardcoded hex colors
color: '#ffffff',
backgroundColor: '#000000',

// NEVER use CSS properties not in system props
backdropFilter: 'blur(1px)',

// NEVER use inline styles
style={{ fontSize: 14 }}
```

### ✅ ALWAYS Do This:

```tsx
// ALWAYS use spacing tokens (4, 8, 12, 16, 24, 32, 40, 48, 64, 96)
height: 24, // from spacing.ts
width: 64, // from spacing.ts

// ALWAYS use fontSize tokens (14, 16, 18, 20, 22, 26, 34, 44, 64)
fontSize: 14, // from typography.ts

// ALWAYS use borderRadii tokens (none, sm, md, lg, xl, full)
borderRadius: 'full', // from borderRadii.ts

// ALWAYS use semantic color tokens
bg: 'background',
color: 'text',
borderColor: 'border',

// ALWAYS use system props via system.css or styled components
system.css({
bg: 'black',
color: 'white',
borderRadius: 'full',
})
```

### Token Mapping Rules:

1. **Spacing/Sizing**: Map Figma values to closest token from `spacing.ts`

- 4px, 8px, 12px, 16px, 24px, 32px, 40px, 48px, 64px, 96px

2. **Colors**: Use semantic tokens OR core colors from `colors.ts`

- Semantic: `background`, `text`, `border`, `text-secondary`, etc.
- Core: `navy`, `white`, `black`, `blue`, `green`, `red`, `yellow`, etc.
- For Background component only: use color names (navy, white, etc.)

3. **Border Radius**: Use tokens from `borderRadii.ts`

- none (0px), sm (2px), md (4px), lg (8px), xl (16px), full (999px)

4. **Typography**: Use tokens from `typography.ts`

- fontFamily: `accent`, `base`, `monospace`, `system`
- fontSize: 14, 16, 18, 20, 22, 26, 34, 44, 64
- fontWeight: 400, 700 or `base`, `title`
- lineHeight: `base` (1.5), `title` (1.2), `spacedTitle` (1.3)

5. **If no exact match**: Document in code comment why custom value needed

### Emotion & CSS-in-JS Patterns:

- **IMPORTANT**: Do not use inline styles
- Use `styled` from `@emotion/styled`
- Use `system.css()` for style objects
- Use `styledOptions` for styled component options
- Compose system props with `variance.compose()`

## Accessibility & Best Practices

- **IMPORTANT**: Follow WCAG requirements for accessibility
- Always follow best practices from `/packages/styleguide/src/lib/Meta/Best Practices.mdx`

## Implementation

- Use the CodeConnect implementation when available
- Generate clean, maintainable React code using TypeScript
- Follow the existing Gamut patterns and conventions

## Post-Generation Validation

After generating code, verify:

- [ ] No hardcoded hex colors (`#` in color values)
- [ ] No hardcoded pixel strings (`'24px'` format)
- [ ] All spacing values match tokens from spacing.ts
- [ ] All colors use semantic tokens or theme colors
- [ ] All border radius uses borderRadii tokens
- [ ] Component follows Gamut patterns (variance, system props, styledOptions)
- [ ] No inline styles
- [ ] Uses emotion styled components
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
packages/gamut-icons/src/icons
packages/gamut-styles/**/*.d.ts
packages/styleguide/stories/Core/Atoms/Markdown/*.md
packages/code-connect/**/*

/.nx/cache
/.nx/workspace-data
7 changes: 7 additions & 0 deletions figma.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"codeConnect": {
"include": ["packages/code-connect/**/*.figma.{tsx,jsx}"],
"label": "React",
"interactiveSetupFigmaFileUrl": "https://www.figma.com/design/ReGfRNillGABAj5SlITalN/%F0%9F%93%90-Gamut?node-id=23-5&p=f&m=dev"
}
}
Loading
Loading