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

style: Database Modal UI Polish #15234

Merged
Merged
1 change: 1 addition & 0 deletions superset-frontend/src/components/IconButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ const IconButton = styled(
background-color: ${({ theme }) => theme.colors.grayscale.light5};
color: ${({ theme }) => theme.colors.grayscale.dark2};
border: 1px solid ${({ theme }) => theme.colors.grayscale.light2};
box-shadow: 4px 4px 20px ${({ theme }) => theme.colors.grayscale.light2};
}
`;

Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/components/InfoTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default function InfoTooltip({
trigger = 'hover',
overlayStyle = defaultOverlayStyle,
bgColor = defaultColor,
viewBox,
viewBox = '0 -2 24 24',
}: InfoTooltipProps) {
return (
<StyledTooltip
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,8 @@ const ExtraOptions = ({
</div>
<div className="helper">
{t(
'JSON string containing additional connection configuration. ' +
'This is used to provide connection information for systems ' +
'like Hive, Presto and BigQuery whih do not conform to the ' +
'username:password syntax normally used by SQLAlchemy.',
'Optional CA_BUNDLE contents to validate HTTPS requests. Only ' +
'available on certain database engines.',
)}
</div>
</StyledInputContainer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
CreateHeaderTitle,
CreateHeaderSubtitle,
StyledFormHeader,
StyledStickyHeader,
} from './styles';
import { DatabaseForm, DatabaseObject } from '../types';

Expand Down Expand Up @@ -62,14 +63,14 @@ const ModalHeader = ({
editNewDb?: boolean;
}) => {
const isEditHeader = (
<>
<StyledFormHeader>
<EditHeaderTitle>{db?.backend}</EditHeaderTitle>
<EditHeaderSubtitle>{dbName}</EditHeaderSubtitle>
</>
</StyledFormHeader>
);
const useSqlAlchemyFormHeader = (
<>
<p className="helper"> Step 2 of 2 </p>
<StyledFormHeader>
<p className="helper"> STEP 2 OF 2 </p>
<CreateHeaderTitle>Enter Primary Credentials</CreateHeaderTitle>
<CreateHeaderSubtitle>
Need help? Learn how to connect your database{' '}
Expand All @@ -78,11 +79,11 @@ const ModalHeader = ({
</a>
.
</CreateHeaderSubtitle>
</>
</StyledFormHeader>
);
const hasConnectedDbHeader = (
<StyledFormHeader>
<p className="helper"> Step 3 of 3 </p>
<p className="helper"> STEP 3 OF 3 </p>
<h4>
Your database was successfully connected! Here are some optional
settings for your database
Expand All @@ -100,25 +101,27 @@ const ModalHeader = ({
</StyledFormHeader>
);
const hasDbHeader = (
<StyledFormHeader>
<p className="helper"> Step 2 of 3 </p>
<h4>Enter the required {dbModel.name} credentials</h4>
<p className="helper">
Need help? Learn more about{' '}
<a
href={documentationLink(db?.engine)}
target="_blank"
rel="noopener noreferrer"
>
connecting to {dbModel.name}.
</a>
</p>
</StyledFormHeader>
<StyledStickyHeader>
<StyledFormHeader>
<p className="helper"> Step 2 of 3 </p>
<h4>Enter the required {dbModel.name} credentials</h4>
<p className="helper">
Need help? Learn more about{' '}
<a
href={documentationLink(db?.engine)}
target="_blank"
rel="noopener noreferrer"
>
connecting to {dbModel.name}.
</a>
</p>
</StyledFormHeader>
</StyledStickyHeader>
);
const noDbHeader = (
<StyledFormHeader>
<div className="select-db">
<p className="helper"> Step 1 of 3 </p>
<p className="helper"> STEP 1 OF 3 </p>
<h4>Select a database to connect</h4>
</div>
</StyledFormHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import React, {
Reducer,
} from 'react';
import Tabs from 'src/components/Tabs';
import { Alert, Select } from 'src/common/components';
import { Select } from 'src/common/components';
import Alert from 'src/components/Alert';
import Modal from 'src/components/Modal';
import Button from 'src/components/Button';
import IconButton from 'src/components/IconButton';
Expand Down Expand Up @@ -510,6 +511,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
</Select>
<Alert
showIcon
closable={false}
css={(theme: SupersetTheme) => antDAlertStyles(theme)}
type="info"
message={t('Want to add a new database?')}
Expand All @@ -522,8 +524,9 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
target="_blank"
rel="noopener noreferrer"
>
here.
here
</a>
.
</>
}
/>
Expand Down Expand Up @@ -740,7 +743,6 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
/>
</TabHeader>
</StyledStickyHeader>
<hr />
<Tabs
defaultActiveKey={DEFAULT_TAB_KEY}
activeKey={tabKey}
Expand Down Expand Up @@ -818,6 +820,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
)}
{!isEditMode && (
<Alert
closable={false}
css={(theme: SupersetTheme) => antDAlertStyles(theme)}
message="Additional fields may be required"
showIcon
Expand All @@ -830,6 +833,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
href={DOCUMENTATION_LINK}
target="_blank"
rel="noopener noreferrer"
className="additional-fields-alert-description"
>
here
</a>
Expand Down Expand Up @@ -938,6 +942,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
/>
{connectionAlert && (
<Alert
closable={false}
css={(theme: SupersetTheme) => antDAlertStyles(theme)}
type="info"
showIcon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,30 @@ export const marginBottom = (theme: SupersetTheme) => css`
export const StyledFormHeader = styled.header`
border-bottom: ${({ theme }) => `${theme.gridUnit * 0.25}px solid
${theme.colors.grayscale.light2};`}
padding-left: ${({ theme }) => theme.gridUnit * 4}px;
padding-right: ${({ theme }) => theme.gridUnit * 4}px;
margin-bottom: ${({ theme }) => theme.gridUnit * 4}px;
padding: ${({ theme }) => theme.gridUnit * 2}px
${({ theme }) => theme.gridUnit * 4}px
${({ theme }) => theme.gridUnit * 4}px
${({ theme }) => theme.gridUnit * 4}px;
line-height: ${({ theme }) => theme.gridUnit * 6}px;
.helper {
color: ${({ theme }) => theme.colors.grayscale.base};
font-size: ${({ theme }) => theme.typography.sizes.s - 1}px;
margin: 0;
}
h4 {
color: ${({ theme }) => theme.colors.grayscale.dark2};
font-weight: bold;
font-size: ${({ theme }) => theme.typography.sizes.l}px;
margin: 0;
padding: 0;
}

.select-db {
.helper {
margin-top: 0;
margin: 0;
}
h4 {
margin: 0 0 29px;
margin: 0 0 ${({ theme }) => theme.gridUnit * 6}px;
}
}
`;
Expand Down Expand Up @@ -87,6 +92,9 @@ export const antdCollapseStyles = (theme: SupersetTheme) => css`
`;

export const antDTabsStyles = css`
.ant-tabs-top {
margin-top: 0;
}
.ant-tabs-top > .ant-tabs-nav {
margin-bottom: 0;
}
Expand All @@ -104,6 +112,7 @@ export const antDModalNoPaddingStyles = css`
`;

export const infoTooltip = (theme: SupersetTheme) => css`
margin-bottom: ${theme.gridUnit * 5}px;
svg {
vertical-align: bottom;
margin-bottom: ${theme.gridUnit * 0.25}px;
Expand All @@ -115,11 +124,14 @@ export const toggleStyle = (theme: SupersetTheme) => css`
`;

export const formScrollableStyles = (theme: SupersetTheme) => css`
padding-left: ${theme.gridUnit * 4}px;
padding-right: ${theme.gridUnit * 4}px;
padding: ${theme.gridUnit * 4}px ${theme.gridUnit * 4}px 0;
`;

export const antDModalStyles = (theme: SupersetTheme) => css`
.ant-select-dropdown {
height: ${theme.gridUnit * 40}px;
}

.ant-modal-header {
padding: ${theme.gridUnit * 4.5}px ${theme.gridUnit * 4}px
${theme.gridUnit * 4}px;
Expand All @@ -142,16 +154,23 @@ export const antDModalStyles = (theme: SupersetTheme) => css`
export const antDAlertStyles = (theme: SupersetTheme) => css`
border: 1px solid ${theme.colors.info.base};
padding: ${theme.gridUnit * 4}px;
margin: ${theme.gridUnit * 8}px 0 ${theme.gridUnit * 4}px;
margin: ${theme.gridUnit * 4}px 0;

.ant-alert-message {
color: ${theme.colors.info.dark2};
font-size: ${theme.typography.sizes.s + 1}px;
font-weight: bold;
}

.ant-alert-description {
color: ${theme.colors.info.dark2};
font-size: ${theme.typography.sizes.s + 1}px;
line-height: ${theme.gridUnit * 4}px;

a {
text-decoration: underline;
}

.ant-alert-icon {
margin-right: ${theme.gridUnit * 2.5}px;
font-size: ${theme.typography.sizes.l + 1}px;
Expand Down Expand Up @@ -195,6 +214,7 @@ export const formStyles = (theme: SupersetTheme) => css`
width: ${`calc(50% - ${theme.gridUnit * 4}px)`};
& + .form-group-w-50 {
margin-left: ${theme.gridUnit * 8}px;
margin-bottom: ${theme.gridUnit * 10}px;
}
}
}
Expand Down Expand Up @@ -330,8 +350,7 @@ export const StyledExpandableForm = styled.div`
`;

export const StyledBasicTab = styled(Tabs.TabPane)`
padding-left: ${({ theme }) => theme.gridUnit * 4}px;
padding-right: ${({ theme }) => theme.gridUnit * 4}px;
padding: 0 ${({ theme }) => theme.gridUnit * 4}px;
margin-top: ${({ theme }) => theme.gridUnit * 6}px;
`;

Expand All @@ -352,8 +371,6 @@ export const TabHeader = styled.div`
flex-direction: column;
justify-content: center;
padding: 0px;
margin: 0 ${({ theme }) => theme.gridUnit * 4}px
${({ theme }) => theme.gridUnit * 8}px;

.helper {
color: ${({ theme }) => theme.colors.grayscale.base};
Expand All @@ -366,7 +383,6 @@ export const CreateHeaderTitle = styled.div`
color: ${({ theme }) => theme.colors.grayscale.dark2};
font-weight: bold;
font-size: ${({ theme }) => theme.typography.sizes.m}px;
padding: ${({ theme }) => theme.gridUnit * 1}px 0;
`;

export const CreateHeaderSubtitle = styled.div`
Expand Down Expand Up @@ -473,8 +489,6 @@ export const StyledFooterButton = styled(Button)`
export const StyledStickyHeader = styled.div`
position: sticky;
top: 0;
z-index: 1;
z-index: ${({ theme }) => theme.zIndex.max};
background: ${({ theme }) => theme.colors.grayscale.light5};
padding: ${({ theme }) => theme.gridUnit * 4}px 0;
border-bottom: 1px solid ${({ theme }) => theme.colors.grayscale.light2};
`;