-
Notifications
You must be signed in to change notification settings - Fork 69
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
initial draft of actionIcon prop for Card component #1479
initial draft of actionIcon prop for Card component #1479
Conversation
Thanks for the pull request, @TheEarlyNerd! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. This is currently a draft pull request. When it is ready for our review and all tests are green, click "Ready for Review", or remove "WIP" from the title, as appropriate. |
✅ Deploy Preview for paragon-openedx ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Ugh, our bot tagged this as an OSPR due to the ongoing issue with CLA list. Once you hear from me about the CLA, this will be ok to merge. Removing the OSPR tag for now. |
ea54faa
to
48d2baf
Compare
Codecov Report
@@ Coverage Diff @@
## master #1479 +/- ##
==========================================
- Coverage 91.44% 91.32% -0.13%
==========================================
Files 205 206 +1
Lines 3483 3492 +9
Branches 816 818 +2
==========================================
+ Hits 3185 3189 +4
- Misses 283 288 +5
Partials 15 15
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
b981523
to
3027215
Compare
0f2b635
to
0b67220
Compare
0b67220
to
304143b
Compare
@@ -86,6 +86,13 @@ | |||
} | |||
} | |||
|
|||
.pgn__card-close-container { |
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.
It may make sense to make the class name more generic here, e.g. .pgn__card__action-icon-container
, since this could represent more than just a close icon button.
<div | ||
className={classNames( | ||
className, | ||
'd-flex flex-wrap pgn__card-close-container', |
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.
Inside of Paragon components, we should avoid using CSS utility classes from Bootstrap as they usually include !important
which hinders theming of the component; should a consumer want to override the component styles, having !important
here could make that difficult. See this ADR for more details.
<IconButton | ||
src={MoreVert} | ||
iconAs={Icon} | ||
alt="See 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.
Paragon support i118n now, so we should avoid hardcoding any English strings. Let's use react-intl
here to render a translated message instead (docs).
variant={variant} | ||
invertColors={variant === 'dark'} | ||
isActive={isActive} | ||
className="mr-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.
Avoid CSS utility class
<div | ||
className={classNames( | ||
className, | ||
'd-flex flex-wrap pgn__card-close-container', |
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.
Avoid CSS utility class
variant={variant} | ||
invertColors={variant === 'dark'} | ||
isActive={isActive} | ||
className="mr-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.
Avoid CSS utility class
@@ -28,7 +31,10 @@ const Card = React.forwardRef(({ | |||
})} | |||
ref={ref} | |||
tabIndex={isClickable ? '0' : '-1'} | |||
/> | |||
> | |||
{actionIcon ? <CardActionIcon actionIcon={actionIcon} variant="dark" /> : undefined} |
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.
[curious] I'm wondering if it would make sense to have the consumer render a Card.ActionIcon
sub-component in the children
of Card
to render this component, rather than relying on an actionIcon
prop at the top-level Card
component to be more in line with the other sub-components part of Card
, e.g.
<Card>
<Card.ActionIcon />
</Card>
isActive, | ||
variant, | ||
}, ref) => { | ||
if (actionIcon === 'overflow') { |
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, I feel CardActionIcon
could probably be implemented in a bit more flexible way, that would allow consumers to customize it for any IconButton
icon for the intended use case.
I'm thinking we could treat CardActionIcon
essentially as a pass-thru component to IconButton
, but with the extra styles to correctly position it in the Card
, where Card.ActionIcon
would take pass (?) of its props down to the underlying IconButton
, perhaps with restrictions on which variants are valid for Card.ActionIcon
.
With Card.ActionIcon
as a sub-component, in theory, it could then be wrapped / composed by OverlayTrigger
to optionally add a tooltip/popover to it., if needed.
<Card>
<Card.ActionIcon
src={Close}
alt="Close"
variant="dark"
/>
</Card>
Just a thought. Curious to hear your thoughts on how to make this a bit more flexible to support more use cases (e.g., using different icons, changing the IconButton
variant, opting in to using a ModalPopup
or Tooltip
alongside the Card.ActionIcon
, etc.).
Description
This is an initial draft of
actionIcon
property on the<Card />
component. The commit tests are not passing because I have not finished setting up .prettierrc.Deploy Preview
Include a direct link to your changes in this PR's deploy preview here (e.g., a specific component page).
Merge Checklist
example
app?wittjeff
andadamstankiewicz
as reviewers on this PR.Post-merge Checklist