-
Notifications
You must be signed in to change notification settings - Fork 78
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
LF-4481: Add Location to animal inventory UI #3527
base: integration
Are you sure you want to change the base?
LF-4481: Add Location to animal inventory UI #3527
Conversation
9e1037f
to
ff9c721
Compare
* add icon * show 'Unknown' for animals without location
* adjust stories
ff9c721
to
1da9b44
Compare
Looks/works great, it's all coming together!! 🙌 |
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.
Everything works great!
I might have preferred to keep the PLAIN
cell kind very text specific, and adapt ICON_TEXT
instead, or not use standardized Cell at all. <Cell />
is not necessary if making something single use and custom. But I will leave it up to you!
const Plain = ({ text }: PlainCellProps) => { | ||
return <div className={clsx(styles.text, styles.overflowText)}>{text}</div>; | ||
const Plain = ({ content }: PlainCellProps) => { | ||
return <div className={clsx(styles.text, styles.overflowText)}>{content}</div>; |
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 are also these styles which were meant to only specified for text.
label: t('ANIMAL.ANIMAL_LOCATIONS').toLocaleUpperCase(), | ||
format: (d: AnimalInventory) => ( | ||
<Cell | ||
kind={CellKind.PLAIN} |
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 is a cell kind of "ICON_TEXT" did it not work?
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 just tried it out. We would need to work around the text (the component requires ICON_NAME
, and the location needs to be the text Unknown
for undefined locations) and pass custom styles. I think it's better not to use the Cell
.
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.
Yup up to you!
I think
d.location ? <Cell kind={ICONTEXT} text iconName ../> : <Cell kind={PLAIN} text />
Would also work to keep text styles same across cells but I am good with anything.
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.
The location text style is unique 😅
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.
Hmm 🤔 . Yeah, it is unique.... Is it designed to be different than all other cells? It seems strange to me to have one cell have different size, color, and weight of text.
The whole point of <Cell />
was to enforce the same text and other styles -- its almost useless otherwise haha.
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 believe the difference is intentional. I don’t have a strong sense of design, but it doesn’t seem strange to me :)
Thank you for your input Duncan! I've reverted the changes to the Plain cell component and updated the location column to avoid using |
Description
Inventory table
location_id
to Animal and AnimalBatch types and adjust mockDatauseAnimalInventory
to include locationuseFilteredInventory
to handle locations filterlocation
string to animal inventory searchable stringPlain
cell component to takecontent
(ReactNode) for greater flexibilityHeader
AnimalSingleViewHeader
's props (separatedlocationText
fromanimalOrBatch
) and adjust storiesAnimalSingleViewHeader
Jira link: https://lite-farm.atlassian.net/browse/LF-4481
Type of change
How Has This Been Tested?
Checklist: