rusackas commented on a change in pull request #13996:
URL: https://github.com/apache/superset/pull/13996#discussion_r612195969
##########
File path: superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx
##########
@@ -94,58 +78,43 @@ function ShareSqlLabQuery({
return getCopyUrlForSavedQuery(callback);
};
- const buildButton = () => {
- const canShare =
- queryEditor.remoteId ||
- isFeatureEnabled(FeatureFlag.SHARE_QUERIES_VIA_KV_STORE);
+ const buildButton = (canShare: boolean) => {
+ const tooltip = canShare
+ ? t('Copy query link to your clipboard')
+ : t('Save the query to enable this feature');
return (
- <Styles>
- <Button buttonSize="small" className={cx(!canShare && 'btn-disabled')}>
- <Icon
- name="link"
- color={
- canShare
- ? supersetTheme.colors.primary.base
- : supersetTheme.colors.grayscale.base
- }
- width={20}
- height={20}
- />{' '}
- {t('Copy link')}
- </Button>
- </Styles>
+ <Button buttonSize="small" tooltip={tooltip} disabled={!canShare}>
+ <Icon
+ name="link"
+ color={
+ canShare
+ ? supersetTheme.colors.primary.base
Review comment:
I see this is a port of the code, and not intended as a rewrite, but we
should use `useTheme` or `withTheme` to grab these values from the provider
rather than the supersetTheme directly.
We might even want to restrict the direct import of the theme with eslint to
help prevent this from happening elsewhere.
--
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]