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

[@billboard.js/react] Possible enhancements to facilitate CSS-in-JS styling for a chart in React #3162

Closed
BillionaireDY opened this issue Mar 31, 2023 · 0 comments
Labels

Comments

@BillionaireDY
Copy link
Contributor

BillionaireDY commented Mar 31, 2023

Description

I want to style the <div class="bb" /> that is created when initializing a chart. However, when using CSS-in-JS libraries like styled-components or emotion, there are cases where .css files are not used. In such cases, I need to either inline style the div using the style attribute or style it using the following approach:

<BillboardJS style={...some styles} />
// or
const StyledBillboardJS = styled(BillboardJS)`
  ...some styles
`;

However, since the IProp interface does not have style or className properties for the div element, it can be challenging to style it using CSS-in-JS. Therefore, it would be beneficial to add the className and style properties to the IProp interface. One way to achieve this is by extending the interface with the Pick keyword, picking className and style from the HTMLProps<HTMLDivElement> interface as shown below:

export interface IProp extends Pick<HTMLProps<HTMLDivElement>, 'className' | 'style'> {
  bb: typeof bb;
  options: ChartOptions;
}

With this modification, it seems that styling will be easier and more straightforward when using CSS-in-JS. Thank you for using our great library.👍 Appreciate your feedback and review.🥰

Steps to check or reproduce

describe all above

@netil netil added the packages label Mar 31, 2023
@netil netil closed this as completed in 0a1fe08 Apr 7, 2023
github-actions bot pushed a commit that referenced this issue Apr 10, 2023
# [3.8.0-next.2](3.8.0-next.1...3.8.0-next.2) (2023-04-10)

### Bug Fixes

* **grid:** fix redundant <rect> appends ([1039363](1039363)), closes [#3147](#3147)
* **sparkline:** Fix to work point.focus.only option ([65b3c1c](65b3c1c)), closes [#3171](#3171)

### Features

* **package:** extends root div interface for styling ([0a1fe08](0a1fe08)), closes [#3162](#3162) [#3163](#3163)
github-actions bot pushed a commit that referenced this issue Apr 13, 2023
# [3.8.0](3.7.5...3.8.0) (2023-04-13)

### Bug Fixes

* **data:** fix break when whole dataseries are null ([#3134](#3134)) ([5d12c45](5d12c45)), closes [#3124](#3124)
* **grid:** fix redundant <rect> appends ([1039363](1039363)), closes [#3147](#3147)
* **options:** Fix handling for falsy data.types ([5eb731a](5eb731a)), closes [#3125](#3125)
* **sparkline:** Fix to work point.focus.only option ([65b3c1c](65b3c1c)), closes [#3171](#3171)

### Features

* **api:** Enhance resizeAfter for .load/unload APIs ([33bbca4](33bbca4)), closes [#3157](#3157)
* **axis:** Intent to ship axis.x.inverted ([e193c0f](e193c0f)), closes [#3137](#3137)
* **package:** extends root div interface for styling ([0a1fe08](0a1fe08)), closes [#3162](#3162) [#3163](#3163)
* **padding:** Intent to ship padding='fit' ([d760a63](d760a63)), closes [#3118](#3118)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants