Skip to content

Commit

Permalink
Refactor(exporter-variables-scss): Remove adding hardcoded 90deg in g…
Browse files Browse the repository at this point in the history
…radients

- fixed by Supernova
  • Loading branch information
pavelklibani committed Oct 14, 2024
1 parent df292c3 commit 881189c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ describe('tokenHelper', () => {

describe('addAngleVarToGradient', () => {
it('should add angle variable to gradient', () => {
const inputString = 'linear-gradient(0deg, #000 0%, #fff 100%)';
const inputString = 'linear-gradient(90deg, #000 0%, #fff 100%)';
const expectedOutput = 'linear-gradient(var(--gradient-angle, 90deg), #000 0%, #fff 100%)';

const result = addAngleVarToGradient(inputString);
Expand Down
2 changes: 1 addition & 1 deletion exporters/variables-scss/src/helpers/tokenHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const addAngleVarToGradient = (inputString: string): string => {

if (match) {
const angle = match[1].trim(); // Extract the angle
const angleValue = Number(angle.match(/\d+/)) + 90; // Normalize angle and add 90 degrees
const angleValue = Number(angle.match(/\d+/));
const angleUnit = angle.match(/deg/);
const colorStops = match[2].trim(); // Extract the rest (color stops)
const cssAngleVar = '--gradient-angle';
Expand Down

0 comments on commit 881189c

Please sign in to comment.