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

fix: add react_app prefix into the available env variables #1062

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/docs/examples/styling.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -385,10 +385,12 @@ We strongly recommend using this way because it's cleaner and better for perform

:::

| name | type | required | default | values | description |
| ----------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.<br /><br /> We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. |
| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.<br /><br /> Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. |
| name | type | required | default | values | description |
| --------------------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.<br /><br /> We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. |
| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.<br /><br /> Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. |
| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. |
| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. |

#### Using removeStyle function

Expand Down
10 changes: 6 additions & 4 deletions docs/docs/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ We have some environment variables that can be used to enable or disable some be

#### Available environment variables:

| name | type | required | default | values | description |
| ----------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.<br /><br /> We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. |
| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.<br /><br /> Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. |
| name | type | required | default | values | description |
| --------------------------------------------- | --------- | -------- | ------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **core** styles from being injected into the page by ReactTooltip.<br /><br /> We strongly recommend to keep the core styles being injected into the project unless you know what you are doing. |
| `REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Environment variable to disable **base** styles from being injected into the page by ReactTooltip.<br /><br /> Those styles are just visual styles like colors, padding, etc... And can be disabled if you want to write your tooltip styles. |
| `REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_CORE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. |
| `REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES` | `boolean` | no | `false` | `true` `false` | Same as `REACT_TOOLTIP_DISABLE_BASE_STYLES` but with `REACT_APP_` prefix. Set this instead if your project uses `react-scripts`. |
6 changes: 4 additions & 2 deletions src/utils/handle-style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ function injectStyle({
if (
type === 'core' &&
typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`
process?.env?.REACT_TOOLTIP_DISABLE_CORE_STYLES
(process?.env?.REACT_TOOLTIP_DISABLE_CORE_STYLES ||
process?.env?.REACT_APP_REACT_TOOLTIP_DISABLE_CORE_STYLES)
) {
return
}

if (
type !== 'core' &&
typeof process !== 'undefined' && // this validation prevents docs from breaking even with `process?`
process?.env?.REACT_TOOLTIP_DISABLE_BASE_STYLES
(process?.env?.REACT_TOOLTIP_DISABLE_BASE_STYLES ||
process?.env?.REACT_APP_REACT_TOOLTIP_DISABLE_BASE_STYLES)
) {
return
}
Expand Down