chore: Removes direct theme imports (#19368)

This commit is contained in:
Michael S. Molina
2022-03-29 10:15:07 -03:00
committed by GitHub
parent d304849b46
commit 816a2c3e1e
11 changed files with 42 additions and 36 deletions

View File

@@ -17,8 +17,8 @@
* under the License.
*/
import React from 'react';
import { shallow } from 'enzyme';
import { mount } from 'enzyme';
import { supersetTheme, ThemeProvider } from '@superset-ui/core';
import RunQueryActionButton from 'src/SqlLab/components/RunQueryActionButton';
import Button from 'src/components/Button';
@@ -35,7 +35,10 @@ describe('RunQueryActionButton', () => {
};
beforeEach(() => {
wrapper = shallow(<RunQueryActionButton {...defaultProps} />);
wrapper = mount(<RunQueryActionButton {...defaultProps} />, {
wrappingComponent: ThemeProvider,
wrappingComponentProps: { theme: supersetTheme },
});
});
it('is a valid react element', () => {

View File

@@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { t, styled, supersetTheme } from '@superset-ui/core';
import { t, styled, useTheme } from '@superset-ui/core';
import { Menu } from 'src/components/Menu';
import Button, { ButtonProps } from 'src/components/Button';
@@ -93,6 +93,8 @@ const RunQueryActionButton = ({
runQuery,
stopQuery,
}: Props) => {
const theme = useTheme();
const shouldShowStopBtn =
!!queryState && ['running', 'pending'].indexOf(queryState) > -1;
@@ -123,8 +125,8 @@ const RunQueryActionButton = ({
<Icons.CaretDown
iconColor={
isDisabled
? supersetTheme.colors.grayscale.base
: supersetTheme.colors.grayscale.light5
? theme.colors.grayscale.base
: theme.colors.grayscale.light5
}
name="caret-down"
/>