-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
refactor: update generateResponsive to use an array of variants inste…
…ad of a string
Showing
2 changed files
with
10 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
export const generateResponsive = (str: string, screens: string[]) => { | ||
const strArray: string[] = str.split(" ") | ||
export const generateResponsive = (variants: string[], breakpoints: string[]) => { | ||
let classNames: string[] = []; | ||
|
||
let str_final: string[] = [] | ||
variants.forEach((variant) => { | ||
breakpoints.forEach((breakpoint) => { | ||
classNames.push(`${breakpoint}:${variant}`); | ||
}); | ||
}); | ||
|
||
strArray.forEach((str, index) => { | ||
screens.forEach(screen => { | ||
str_final.push(`${screen}:${str}`) | ||
}) | ||
}) | ||
|
||
return str_final | ||
} | ||
return classNames; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters