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
When cascading components, it is even more convenient since we have "type safety for selectors":
exportconstgalleryParts=defineParts({header: {},card: classSelector(cardRecipe.className)// '& .card'})exportconstgalleryRecipe=defineRecipe({className: 'gallery',base: galleryParts({header: {},card: cardParts({// we can modify card's header i.e. without duplicating selectorsheader: {}})})})
However, this doesn't work when writing styles with css, which is important for rapid prototyping:
functionGallery(){return<divclassName={css({[`& .${cardRecipe.className}`]: cardParts({header: {}// has no effect, no generated CSS})})}><Card/></div>}
Problem Statement/Justification
Not being able to prototype with parts breaks the mental flow (DX?) which is used when building recipes.
Proposed Solution or API
Even though there is some kind of dynamic styling, I think this is achievable, since defineParts output is not much different from its input.
Also, I see the following "pattern":
functionGallery(){return<divclassName={css({
...cardStyling({// replaces the code above, both css and recipesheader: {}})})}><Card/></div>}
Alternatives
Without parts, the equivalent that we have to deal with is:
This discussion was converted from issue #2693 on June 24, 2024 23:19.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
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
-
Description
Parts feature is really cool when dealing with recipes:
When cascading components, it is even more convenient since we have "type safety for selectors":
However, this doesn't work when writing styles with
css
, which is important for rapid prototyping:Problem Statement/Justification
Not being able to prototype with parts breaks the mental flow (DX?) which is used when building recipes.
Proposed Solution or API
Even though there is some kind of dynamic styling, I think this is achievable, since
defineParts
output is not much different from its input.Also, I see the following "pattern":
Alternatives
Without parts, the equivalent that we have to deal with is:
The bad part is that one should know the internals of a card.
Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions