You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Really scratching my head trying to get the layout working for some Recipe Ingredients. I have it generally working pretty well however when a recipe has an ingredient with long text string it causes these space gaps (see photo)
I understand that this why this is happening. Since the entire row gets rendered together both columns take up the same amount of height so the next row renders under that row. I don't know of a work around I can use the accomplish this layout and was hoping someone else might have some ideas.
I do think that #375 would fix my issue, but am hoping for some work around in the mean time. Here's the code that renders that part
Note: rowAdder is a tiny interface wrapper so I can use pages and the doc as the same type
// addTwoColumnIngredientsShared creates a two-column layout for ingredients with each ingredient on its own linefuncaddTwoColumnIngredientsShared(adderrowAdder, ingredients []string) {
iflen(ingredients) ==0 {
return
}
// Calculate how to split ingredients between columnsmid:= (len(ingredients) +1) /2firstColumn:=ingredients[:mid]
secondColumn:=ingredients[mid:]
rows:=make([]core.Row, 0, 1)
idx:=0for {
next1, next2:="", ""ifidx<len(firstColumn) {
next1=firstColumn[idx]
}
ifidx<len(secondColumn) {
next2=secondColumn[idx]
}
ifnext1==""&&next2=="" {
break
}
secondBullet:="•"ifnext2=="" {
secondBullet=""
}
rows=append(rows, row.New().Add(
col.New(1).Add(Para("•")),
col.New((MaxGridSize/2)-2).Add(Para(next1)),
col.New(1).Add(), // Gapcol.New(1).Add(Para(secondBullet)),
col.New((MaxGridSize/2)-2).Add(Para(next2)),
))
rows=append(rows, row.New(LineHeight))
idx++
}
adder.AddRows(rows...)
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Really scratching my head trying to get the layout working for some Recipe Ingredients. I have it generally working pretty well however when a recipe has an ingredient with long text string it causes these space gaps (see photo)
I understand that this why this is happening. Since the entire row gets rendered together both columns take up the same amount of height so the next row renders under that row. I don't know of a work around I can use the accomplish this layout and was hoping someone else might have some ideas.
I do think that #375 would fix my issue, but am hoping for some work around in the mean time. Here's the code that renders that part
Note: rowAdder is a tiny interface wrapper so I can use pages and the doc as the same type
Beta Was this translation helpful? Give feedback.
All reactions