[feat] Minor updates to the edit db connection page (#5250)

- Add placeholders in db connection edit page
- Fix icon alignement and size (should not change) in Info banner
This commit is contained in:
Marie 2024-05-02 15:25:54 +02:00 committed by GitHub
parent 05a90d6153
commit 1da64c7715
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 16 deletions

View File

@ -33,12 +33,10 @@ const StyledInputsContainer = styled.div`
type SettingsIntegrationPostgreSQLConnectionFormProps = {
disabled?: boolean;
passwordPlaceholder?: string;
};
export const SettingsIntegrationPostgreSQLConnectionForm = ({
disabled,
passwordPlaceholder,
}: SettingsIntegrationPostgreSQLConnectionFormProps) => {
const { control } =
useFormContext<SettingsIntegrationPostgreSQLConnectionFormValues>();
@ -46,13 +44,26 @@ export const SettingsIntegrationPostgreSQLConnectionForm = ({
return (
<StyledInputsContainer>
{[
{ name: 'dbname' as const, label: 'Database Name' },
{ name: 'host' as const, label: 'Host' },
{ name: 'port' as const, label: 'Port' },
{ name: 'username' as const, label: 'Username' },
{ name: 'password' as const, label: 'Password', type: 'password' },
{ name: 'schema' as const, label: 'Schema' },
].map(({ name, label, type }) => (
{
name: 'dbname' as const,
label: 'Database Name',
placeholder: 'default',
},
{ name: 'host' as const, label: 'Host', placeholder: 'host' },
{ name: 'port' as const, label: 'Port', placeholder: '5432' },
{
name: 'username' as const,
label: 'Username',
placeholder: 'username',
},
{
name: 'password' as const,
label: 'Password',
type: 'password',
placeholder: '••••••',
},
{ name: 'schema' as const, label: 'Schema', placeholder: 'public' },
].map(({ name, label, type, placeholder }) => (
<Controller
key={name}
name={name}
@ -67,11 +78,7 @@ export const SettingsIntegrationPostgreSQLConnectionForm = ({
fullWidth
type={type}
disabled={disabled}
placeholder={
passwordPlaceholder && name === 'password'
? passwordPlaceholder
: ''
}
placeholder={placeholder}
/>
);
}}

View File

@ -141,7 +141,6 @@ export const SettingsIntegrationEditDatabaseConnectionContent = ({
<SettingsIntegrationPostgreSQLConnectionForm
disabled={hasSyncedTables}
passwordPlaceholder="••••••"
/>
</Section>
) : null}

View File

@ -14,10 +14,15 @@ export type InfoProps = {
};
const StyledTextContainer = styled.div`
align-items: center;
display: flex;
gap: ${({ theme }) => theme.spacing(2)};
`;
const StyledIconInfoCircle = styled(IconInfoCircle)`
flex-shrink: 0;
`;
const StyledInfo = styled.div<Pick<InfoProps, 'accent'>>`
align-items: center;
border-radius: ${({ theme }) => theme.border.radius.md};
@ -51,7 +56,7 @@ export const Info = ({
return (
<StyledInfo accent={accent}>
<StyledTextContainer>
<IconInfoCircle size={theme.icon.size.md} />
<StyledIconInfoCircle size={theme.icon.size.md} />
{text}
</StyledTextContainer>
{buttonTitle && onClick && (