Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: icon to icons for sqllab #15593

Merged
merged 5 commits into from Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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