-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Put card list grid items in rows #122
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 nitpicks, 1 change (just minor related to React key
attributes), otherwise lookin' good!
🙌
src/CardList/index.js
Outdated
let columnCount = this.getColumnCount() | ||
let count = Math.ceil(items.length / columnCount) | ||
let rows = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: it should be possible to declare each of these as const
, including rows
.
src/CardList/index.js
Outdated
{rows.map((row, i) => ( | ||
<View key={i} style={styles.row}> | ||
{row.map((itm) => ( | ||
<View style={columnWidth}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this <View>
also have a key
attribute as it's directly within the .map()
? Looking at the previous code, I see renderCell()
includes a key
attribute that probably isn't effective anymore.
src/CardList/index.js
Outdated
let { fullWidth } = this.state | ||
let width = fullWidth / columnCount - 8 | ||
const rows = this.getRows(items) | ||
const columnWidth = { width: `${100 / columnCount}%` } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: would it be worth calling this something like cellContainerStyles
, or something similar, since the object could potentially contain any number of styles?
Alternatively, setting it directly on the <View>
would also be fine.
@@ -420,8 +445,6 @@ class Cell extends Component { | |||
editor, | |||
} = this.props | |||
|
|||
let mediaPosition = media && media.position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ LGTM!
Problem
Card lists set to grid layout in responsive apps would have their height automatically collapse when they were selected in the editor.
https://trello.com/1/cards/645d32b21deee39c9c1d0441/attachments/645d35fac46e4d60cda83fb2/download/screencast_2023-05-11_22-35-32.mp4
Solution
Give the grid layout some structure, like we do with the masonry layout. Instead of just having a list of items, create rows for those items.
Additional Notes
There's still a problem where when you change the screen size or resize the component, the height of the items changes, but the bounding box for the card list component doesn't update until you de-select and re-select the component. This is a pre-existing issue with the card list in masonry layout, as well as the image list.
There's also a pre-existing issue with the card list in multi-column grid layout where it will flicker between showing 1 and 2 columns. We have a card for this already in the backlog.