Skip to content

Commit

Permalink
[feat] Minor updates to the edit db connection page (twentyhq#5250)
Browse files Browse the repository at this point in the history
- Add placeholders in db connection edit page
- Fix icon alignement and size (should not change) in Info banner
  • Loading branch information
ijreilly committed May 2, 2024
1 parent 05a90d6 commit 1da64c7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,37 @@ const StyledInputsContainer = styled.div`

type SettingsIntegrationPostgreSQLConnectionFormProps = {
disabled?: boolean;
passwordPlaceholder?: string;
};

export const SettingsIntegrationPostgreSQLConnectionForm = ({
disabled,
passwordPlaceholder,
}: SettingsIntegrationPostgreSQLConnectionFormProps) => {
const { control } =
useFormContext<SettingsIntegrationPostgreSQLConnectionFormValues>();

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}
Expand All @@ -67,11 +78,7 @@ export const SettingsIntegrationPostgreSQLConnectionForm = ({
fullWidth
type={type}
disabled={disabled}
placeholder={
passwordPlaceholder && name === 'password'
? passwordPlaceholder
: ''
}
placeholder={placeholder}
/>
);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export const SettingsIntegrationEditDatabaseConnectionContent = ({

<SettingsIntegrationPostgreSQLConnectionForm
disabled={hasSyncedTables}
passwordPlaceholder="••••••"
/>
</Section>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 && (
Expand Down

0 comments on commit 1da64c7

Please sign in to comment.