rusackas commented on a change in pull request #13409:
URL: https://github.com/apache/superset/pull/13409#discussion_r586882076
##########
File path: superset-frontend/src/components/RefreshLabel/index.tsx
##########
@@ -16,32 +16,38 @@
* specific language governing permissions and limitations
* under the License.
*/
-import React from 'react';
-import PropTypes from 'prop-types';
+import React, { MouseEventHandler } from 'react';
+import { useTheme } from '@superset-ui/core';
import { Tooltip } from 'src/common/components/Tooltip';
+import Icon, { IconProps } from 'src/components/Icon';
-import './RefreshLabel.less';
+export interface RefreshLabelProps {
+ onClick: MouseEventHandler<SVGSVGElement>;
+ tooltipContent: string;
+}
-const propTypes = {
- onClick: PropTypes.func,
- tooltipContent: PropTypes.string.isRequired,
-};
+const RefreshLabel = ({ onClick, tooltipContent }: RefreshLabelProps) => {
+ const theme = useTheme();
-class RefreshLabel extends React.PureComponent {
- render() {
- return (
- <Tooltip title={this.props.tooltipContent} id="cache-desc-tooltip">
- <i
- aria-label="Icon"
- role="button"
- tabIndex={0}
- className="RefreshLabel fa fa-refresh pointer"
- onClick={this.props.onClick}
- />
- </Tooltip>
- );
- }
-}
-RefreshLabel.propTypes = propTypes;
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ const IconWithoutRef = React.forwardRef((props: IconProps, ref: any) => (
+ <Icon {...props} />
+ ));
+
+ return (
+ <Tooltip title={tooltipContent}>
+ <IconWithoutRef
+ role="button"
+ onClick={onClick}
+ name="refresh"
+ css={{
Review comment:
Wait... we're not importing `css` from `@superset-ui/core` here... is
this css prop going unheard or something?
Also, if we're going to use the `css` prop, I kind of like the pattern of:
```
css={theme => css`
cursor: pointer;
color: ${theme.colors.grayscale.base};
&:hover {
color: ${theme.colors.grayscale.base};
}
`}
```
this just seems a little more readable to me, and uses real css (e.g.
`border-color`) rather than the JS flavor (e.g. `borderColor`) and is
copy/pastable to and from `styled` implementations.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]