Browse Source

ref(js): Avoid imported `theme` in icons (#42608)

Evan Purkhiser 2 years ago
parent
commit
aa8b85b5b8

+ 3 - 3
static/app/icons/iconArrow.tsx

@@ -1,7 +1,5 @@
 import {forwardRef} from 'react';
-import {css} from '@emotion/react';
-
-import theme from 'sentry/utils/theme';
+import {css, useTheme} from '@emotion/react';
 
 import {SvgIcon, SVGIconProps} from './svgIcon';
 
@@ -11,6 +9,8 @@ interface Props extends SVGIconProps {
 
 const IconArrow = forwardRef<SVGSVGElement, Props>(
   ({direction = 'up', ...props}, ref) => {
+    const theme = useTheme();
+
     return (
       <SvgIcon
         {...props}

+ 3 - 3
static/app/icons/iconChevron.tsx

@@ -1,7 +1,5 @@
 import {forwardRef, Fragment} from 'react';
-import {css} from '@emotion/react';
-
-import theme from 'sentry/utils/theme';
+import {css, useTheme} from '@emotion/react';
 
 import {SvgIcon, SVGIconProps} from './svgIcon';
 
@@ -12,6 +10,8 @@ interface Props extends SVGIconProps {
 
 const IconChevron = forwardRef<SVGSVGElement, Props>(
   ({isCircled = false, direction = 'up', ...props}, ref) => {
+    const theme = useTheme();
+
     return (
       <SvgIcon
         {...props}

+ 3 - 2
static/app/icons/iconPanel.tsx

@@ -1,6 +1,5 @@
 import {forwardRef} from 'react';
-
-import theme from 'sentry/utils/theme';
+import {useTheme} from '@emotion/react';
 
 import {SvgIcon, SVGIconProps} from './svgIcon';
 
@@ -10,6 +9,8 @@ interface Props extends SVGIconProps {
 
 const IconPanel = forwardRef<SVGSVGElement, Props>(
   ({direction = 'up', ...props}, ref) => {
+    const theme = useTheme();
+
     return (
       <SvgIcon
         {...props}

+ 3 - 3
static/app/icons/iconSliders.tsx

@@ -1,7 +1,5 @@
 import {forwardRef} from 'react';
-import {css} from '@emotion/react';
-
-import theme from 'sentry/utils/theme';
+import {css, useTheme} from '@emotion/react';
 
 import {SvgIcon, SVGIconProps} from './svgIcon';
 
@@ -11,6 +9,8 @@ interface Props extends SVGIconProps {
 
 const IconSliders = forwardRef<SVGSVGElement, Props>(
   ({direction = 'up', ...props}, ref) => {
+    const theme = useTheme();
+
     return (
       <SvgIcon
         {...props}