Skip to content

Instantly share code, notes, and snippets.

@baktun14
baktun14 / masonry.ts
Created October 7, 2020 21:46
I found that all the masonry libraries were slow so I made my own one.
/**
* The code won't work by it self but most of the logic is here
* I was using immutablejs
* Also, I'm aware this is not react, but it's code that I'm most proud of 😅
*/
export function getLooksMasonry(masonry: List<List<Map<string, any>>>, lookIds: List<any>, colWidth: number, gutterPadding: number = 5, footerHeight: number = 55) {
return (dispatch, getState: () => IGlobalState) => {
const { looks } = getState();
return masonry.withMutations(mLayout => {