-
Notifications
You must be signed in to change notification settings - Fork 24
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
Fix select grid #875
Fix select grid #875
Conversation
Demo: Screen.Recording.2024-08-21.at.14.38.19.movNote: Component updates weren't trickling down, thus the picked icon was always one step behind. I've chosen to use |
label={this.props.label || "Icon"} | ||
filterPlaceholder={this.props.filterPlaceholder || "Search..."} | ||
label={this.props.label ?? "Icon"} | ||
filterPlaceholder={this.props.filterPlaceholder ?? "Search..."} |
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.
we will need those translated I guess, maybe we should rather make those props mandatory
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.
what if we treat those as the default fallback that's not translated, and if we need translations we pass them from the respective usage? im thinking here for all other components as well
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.
we will need a mechanism to translate it within the framework probably, it wouldn't make much sense to redo it everywhere we use it. for now the fallback is ok
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.
exactly, that's why I'd leave it
const VERTICAL_OFFSET = 3; | ||
const HORIZONTAL_OFFSET = 1; | ||
const PAGE_OFFSET = 15; | ||
const FIRST_ROW_INDEXES = [0, 1, 2]; |
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.
I wonder if it would be more readable to work with something like:
const GRID_COLS = 3;
const GRID_ROWS = 5;
or
const GRID_WIDTH = 3;
const GRID_HEIGHT = 5;
it's not clear why there would be any offsets
} | ||
|
||
const GRID_COLS = 3; | ||
const GRID_ROWS = 1; |
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.
imo there is not just 1 row, is there? in theory I would expect PAGE_ITEMS = GRID_COLS * GRID_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.
Yep, but I renamed the offsets to GRID_COLS
& GRID_ROWS
. Actually they're meant to be ROW_OFFSET
& COL_OFFSET
. do you think those names are better?
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.
confusion comes because this isn't a 2d array, it's 1d, so in theory there's no rows and cols
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.
question is how many rows are actually there, so I would probably set proper value to GRID_ROWS
so that the PAGE_SIZE = GRID_COLS * GRID_ROWS
and where you use that GRID_ROWS
to add/subtract 1
I would just use 1
there, that's not a magic number imo
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.
and it's fine to be stored as an array, this should rather describe how it's rendered
const GRID_COLS = 3; | ||
const GRID_ROWS = 1; | ||
const PAGE_ITEMS = 15; | ||
const FIRST_ROW_ITEMS_INDEXES = [0, 1, 2]; |
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.
not sure if we need this one, you can check it via index < GRID_COLS
SDUF-111
TODO: