Skip to content
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

feat(react diagrams): add support for applying a custom class to the outer node #1222

Merged

Conversation

AlanGreene
Copy link
Contributor

@AlanGreene AlanGreene commented Nov 20, 2021

Updates

The CardNode component has a color prop which can be used to specify the
colour of the border applied on the outer node. However, this requires the
code to be aware of the active theme, handle dark mode, etc. to select an
appropriate colour in some cases.

For component libraries this can be problematic as now both the components
and their consumers need to be aware of theme rather than relying on this
being handled entirely in (S)CSS.

Add support for applying a custom class to the CardNode component which will
be applied to the outer node and can be used to apply styles to the card and
its children, including specifying the border colour for the card.

resolves #1221

Add similar className prop to all diagram components for consistency.

Demo screenshot or recording

Review checklist (for reviewers only)

  • Demos all features
  • Documented/annotated
  • Matches UI/UX specs
  • Meets the code style guide
  • Accessible
  • Mobile first (responsive)
  • RTL support (bidirectional text)
  • Performant (limited bloat)

Copy link
Member

@theiliad theiliad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @AlanGreene looks good, however I think in 1 of the instances you've added the prop but just not applying it.

packages/react/src/diagrams/CardNode/CardNodeColumn.tsx Outdated Show resolved Hide resolved
…outer node

The CardNode component has a `color` prop which can be used to specify the
colour of the border applied on the outer node. However, this requires the
code to be aware of the active theme, handle dark mode, etc. to select an
appropriate colour in some cases.

For component libraries this can be problematic as now both the components
and their consumers need to be aware of theme rather than relying on this
being handled entirely in (S)CSS.

Add support for applying a custom class to the CardNode component which will
be applied to the outer node and can be used to apply styles to the card and
its children, including specifying the border colour for the card.

resolves carbon-design-system#1221

Add similar `className` prop to all diagram components for consistency.
Copy link
Member

@theiliad theiliad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM 💯

@theiliad theiliad changed the title feat(react cardnode): add support for applying a custom class to the outer node feat(react diagrams): add support for applying a custom class to the outer node Dec 1, 2021
@theiliad theiliad merged commit c7e8606 into carbon-design-system:master Dec 1, 2021
@AlanGreene AlanGreene deleted the cardnode_custom_class branch December 1, 2021 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement]: Add support for specifying a custom class name on CardNode
3 participants