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

Adding new variable scopes #964

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/spicy-rats-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/primitives': patch
---

Updates the figma build process to add and use new typographic scopes
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/transformers/figmaAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ type FigmaVariableScope =
| 'SHAPE_FILL'
| 'TEXT_FILL'
| 'STROKE_COLOR'
| 'OPACITY'
| 'FONT_FAMILY'
| 'FONT_STYLE'
| 'FONT_WEIGHT'
| 'FONT_SIZE'
| 'LINE_HEIGHT'
| 'LETTER_SPACING'
| 'PARAGRAPH_SPACING'
| 'PARAGRAPH_INDENT'

const figmaScopes: Record<string, FigmaVariableScope[]> = {
all: ['ALL_SCOPES'],
Expand All @@ -20,6 +29,14 @@ const figmaScopes: Record<string, FigmaVariableScope[]> = {
bgColor: ['FRAME_FILL', 'SHAPE_FILL'],
fgColor: ['TEXT_FILL', 'SHAPE_FILL'],
borderColor: ['STROKE_COLOR'],
fontFamily: ['FONT_FAMILY'],
fontStyle: ['FONT_STYLE'],
fontWeight: ['FONT_WEIGHT'],
fontSize: ['FONT_SIZE'],
lineHeight: ['LINE_HEIGHT'],
letterSpacing: ['LETTER_SPACING'],
paragraphSpacing: ['PARAGRAPH_SPACING'],
paragraphIndent: ['PARAGRAPH_INDENT'],
}

const getScopes = (scopes: string[] | string | undefined): FigmaVariableScope[] => {
Expand Down