Skip to content

Commit

Permalink
splitting up more
Browse files Browse the repository at this point in the history
  • Loading branch information
wrt95 committed Nov 27, 2024
1 parent 1895ba3 commit 8fc81de
Showing 1 changed file with 25 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,18 @@ export const DeployDropdown = ({

return (
<div className={classes.deployDropDown}>
<div>
<StudioCombobox
size='small'
value={selectedImageTag && imageOptions?.length > 0 ? [selectedImageTag] : undefined}
label={t('app_deployment.choose_version')}
onValueChange={(selectedImageOptions: string[]) =>
setSelectedImageTag(selectedImageOptions[0])
}
disabled={disabled}
>
{imageOptions.map((imageOption) => {
return (
<StudioCombobox.Option key={imageOption.value} value={imageOption.value}>
{imageOption.label}
</StudioCombobox.Option>
);
})}
<StudioCombobox.Empty>{t('app_deployment.no_versions')}</StudioCombobox.Empty>
</StudioCombobox>
</div>
<StudioCombobox
size='small'
value={selectedImageTag && imageOptions?.length > 0 ? [selectedImageTag] : undefined}
label={t('app_deployment.choose_version')}
onValueChange={(selectedImageOptions: string[]) =>
setSelectedImageTag(selectedImageOptions[0])
}
disabled={disabled}
>
<DeployComboboxOptions imageOptions={imageOptions} />
<StudioCombobox.Empty>{t('app_deployment.no_versions')}</StudioCombobox.Empty>
</StudioCombobox>
<div className={classes.deployButton}>
<DeployPopover
appDeployedVersion={appDeployedVersion}
Expand All @@ -86,3 +78,16 @@ export const DeployDropdown = ({
</div>
);
};

type DeployComboboxOptionsProps = {
imageOptions: ImageOption[];
};
const DeployComboboxOptions = ({ imageOptions }: DeployComboboxOptionsProps): ReactElement[] => {
return imageOptions.map((imageOption: ImageOption) => {
return (
<StudioCombobox.Option key={imageOption.value} value={imageOption.value}>
{imageOption.label}
</StudioCombobox.Option>
);
});
};

0 comments on commit 8fc81de

Please sign in to comment.