forked from anuraghazra/github-readme-stats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(layout): improve flexLayout & fixed layout overlaps (anuraghazra…
…#1314) * feat(layout): improve flexLayout & fixed layout overlaps * chore: fix vercel build
- Loading branch information
1 parent
fefe0f1
commit f7c8a03
Showing
6 changed files
with
148 additions
and
111 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
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
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const { flexLayout } = require("../src/common/utils"); | ||
|
||
describe("flexLayout", () => { | ||
it("should work with row & col layouts", () => { | ||
const layout = flexLayout({ | ||
items: ["<text>1</text>", "<text>2</text>"], | ||
gap: 60, | ||
}); | ||
|
||
expect(layout).toStrictEqual([ | ||
`<g transform="translate(0, 0)"><text>1</text></g>`, | ||
`<g transform="translate(60, 0)"><text>2</text></g>`, | ||
]); | ||
|
||
const columns = flexLayout({ | ||
items: ["<text>1</text>", "<text>2</text>"], | ||
gap: 60, | ||
direction: "column", | ||
}); | ||
|
||
expect(columns).toStrictEqual([ | ||
`<g transform="translate(0, 0)"><text>1</text></g>`, | ||
`<g transform="translate(0, 60)"><text>2</text></g>`, | ||
]); | ||
}); | ||
|
||
it("should work with sizes", () => { | ||
const layout = flexLayout({ | ||
items: [ | ||
"<text>1</text>", | ||
"<text>2</text>", | ||
"<text>3</text>", | ||
"<text>4</text>", | ||
], | ||
gap: 20, | ||
sizes: [200, 100, 55, 25], | ||
}); | ||
|
||
expect(layout).toStrictEqual([ | ||
`<g transform="translate(0, 0)"><text>1</text></g>`, | ||
`<g transform="translate(220, 0)"><text>2</text></g>`, | ||
`<g transform="translate(340, 0)"><text>3</text></g>`, | ||
`<g transform="translate(415, 0)"><text>4</text></g>`, | ||
]); | ||
}); | ||
}); |
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
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