-
-
Notifications
You must be signed in to change notification settings - Fork 222
fix: radial gradient export alignment and positioning #3837
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
Changes from all commits
885b3e1
3b085e3
a3d8506
2574ab2
995feee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,19 @@ import { isPaintEqual } from '@/utils/isPaintEqual'; | |
| import { convertStringToFigmaGradient } from '../../figmaTransforms/gradients'; | ||
| import { convertToFigmaColor } from '../../figmaTransforms/colors'; | ||
|
|
||
| // Helper function to check if a value is any type of gradient | ||
| const isGradient = (value: string): boolean => value?.startsWith?.('linear-gradient') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we support repeating-linear-gradient etc? you added that further above, but its missing from here
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. supported in the token, not in the export yet, removed it in remove repeating gradient check
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will raise a separate PR to include support for exporting repeating gradients |
||
| || value?.startsWith?.('radial-gradient') | ||
| || value?.startsWith?.('conic-gradient'); | ||
|
|
||
| export function paintStyleMatchesColorToken(paintStyle: PaintStyle | undefined, colorToken: string) { | ||
| const stylePaint = paintStyle?.paints[0] ?? null; | ||
| if (stylePaint?.type === 'SOLID') { | ||
| const { color, opacity } = convertToFigmaColor(colorToken); | ||
| const tokenPaint: SolidPaint = { color, opacity, type: 'SOLID' }; | ||
| return isPaintEqual(stylePaint, tokenPaint); | ||
| } | ||
| if (stylePaint?.type === 'GRADIENT_LINEAR') { | ||
| if (stylePaint?.type === 'GRADIENT_LINEAR' && isGradient(colorToken)) { | ||
| const { gradientStops, gradientTransform } = convertStringToFigmaGradient(colorToken); | ||
| const tokenPaint: GradientPaint = { | ||
| type: 'GRADIENT_LINEAR', | ||
|
|
@@ -18,5 +23,14 @@ export function paintStyleMatchesColorToken(paintStyle: PaintStyle | undefined, | |
| }; | ||
| return isPaintEqual(stylePaint, tokenPaint); | ||
| } | ||
| if (stylePaint?.type === 'GRADIENT_RADIAL' && isGradient(colorToken)) { | ||
| const { gradientStops, gradientTransform } = convertStringToFigmaGradient(colorToken); | ||
| const tokenPaint: GradientPaint = { | ||
| type: 'GRADIENT_RADIAL', | ||
| gradientTransform, | ||
| gradientStops, | ||
| }; | ||
| return isPaintEqual(stylePaint, tokenPaint); | ||
| } | ||
| return false; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.