Skip to content

Commit

Permalink
refactor: icon to icons for sqllab (apache#15593)
Browse files Browse the repository at this point in the history
* initial commit

* rid of theme

* Update superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>

* Update superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx

Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>

* Update superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>

Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>
Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com>
  • Loading branch information
3 people authored and cccs-RyanS committed Dec 17, 2021
1 parent a96ecdc commit 308cdbc
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
10 changes: 7 additions & 3 deletions superset-frontend/src/SqlLab/components/RunQueryActionButton.tsx
Expand Up @@ -21,7 +21,7 @@ import { t, styled, supersetTheme } from '@superset-ui/core';

import { Menu } from 'src/common/components';
import Button, { ButtonProps } from 'src/components/Button';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';
import {
DropdownButton,
DropdownButtonProps,
Expand Down Expand Up @@ -77,6 +77,10 @@ const StyledButton = styled.span`
&:last-of-type {
margin-right: ${({ theme }) => theme.gridUnit * 2}px;
}
span[name='caret-down'] {
display: flex;
margin-right: ${({ theme }) => theme.gridUnit * -2}px;
}
}
`;

Expand Down Expand Up @@ -116,8 +120,8 @@ const RunQueryActionButton = ({
? {
overlay: overlayCreateAsMenu,
icon: (
<Icon
color={
<Icons.CaretDown
iconColor={
isDisabled
? supersetTheme.colors.grayscale.base
: supersetTheme.colors.grayscale.light5
Expand Down
21 changes: 11 additions & 10 deletions superset-frontend/src/SqlLab/components/SaveQuery.tsx
Expand Up @@ -18,15 +18,21 @@
*/
import React, { useState } from 'react';
import { Row, Col, Input, TextArea } from 'src/common/components';
import { t, supersetTheme, styled } from '@superset-ui/core';
import { t, styled } from '@superset-ui/core';
import Button from 'src/components/Button';
import { Form, FormItem } from 'src/components/Form';
import Modal from 'src/components/Modal';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';

const Styles = styled.span`
svg {
vertical-align: -${supersetTheme.gridUnit * 1.25}px;
span[role='img'] {
display: flex;
margin: 0;
color: ${({ theme }) => theme.colors.grayscale.base};
svg {
vertical-align: -${({ theme }) => theme.gridUnit * 1.25}px;
margin: 0;
}
}
`;

Expand Down Expand Up @@ -150,12 +156,7 @@ export default function SaveQuery({
return (
<Styles className="SaveQuery">
<Button buttonSize="small" onClick={toggleSave}>
<Icon
name="save"
color={supersetTheme.colors.primary.base}
width={20}
height={20}
/>{' '}
<Icons.Save iconSize="xl" />
{isSaved ? t('Save') : t('Save as')}
</Button>
<Modal
Expand Down
24 changes: 16 additions & 8 deletions superset-frontend/src/SqlLab/components/ShareSqlLabQuery.tsx
Expand Up @@ -17,11 +17,11 @@
* under the License.
*/
import React from 'react';
import { t, useTheme } from '@superset-ui/core';
import { t, useTheme, styled } from '@superset-ui/core';

import Button from 'src/components/Button';
import withToasts from 'src/messageToasts/enhancers/withToasts';
import Icon from 'src/components/Icon';
import Icons from 'src/components/Icons';
import CopyToClipboard from 'src/components/CopyToClipboard';
import { storeQuery } from 'src/utils/common';
import { getClientErrorObject } from 'src/utils/getClientErrorObject';
Expand All @@ -39,6 +39,16 @@ interface ShareSqlLabQueryPropTypes {
addDangerToast: (msg: string) => void;
}

const StyledIcon = styled(Icons.Link)`
&:first-of-type {
margin: 0;
display: flex;
svg {
margin: 0;
}
}
`;

function ShareSqlLabQuery({
queryEditor,
addDangerToast,
Expand Down Expand Up @@ -86,14 +96,12 @@ function ShareSqlLabQuery({
: t('Save the query to enable this feature');
return (
<Button buttonSize="small" tooltip={tooltip} disabled={!canShare}>
<Icon
name="link"
color={
<StyledIcon
iconColor={
canShare ? theme.colors.primary.base : theme.colors.grayscale.base
}
width={20}
height={20}
/>{' '}
iconSize="xl"
/>
{t('Copy link')}
</Button>
);
Expand Down

0 comments on commit 308cdbc

Please sign in to comment.