[Adjustment][Sheen] removed additional prompt when deleting secret

This commit is contained in:
Sheen
2023-04-15 11:21:35 +08:00
parent 56c35293eb
commit 12e16b4a03
@@ -1,10 +1,9 @@
import React, { useState } from 'react' import React from 'react'
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { faXmark } from '@fortawesome/free-solid-svg-icons'; import { faXmark } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import Button from '../basic/buttons/Button'; import Button from '../basic/buttons/Button';
import { DeleteEnvVar } from '../basic/dialog/DeleteEnvVar';
type Props = { type Props = {
onSubmit: () => void; onSubmit: () => void;
@@ -13,7 +12,6 @@ type Props = {
export const DeleteActionButton = ({ onSubmit, isPlain }: Props) => { export const DeleteActionButton = ({ onSubmit, isPlain }: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const [open, setOpen] = useState(false)
return ( return (
<div className={`${ <div className={`${
@@ -25,25 +23,17 @@ export const DeleteActionButton = ({ onSubmit, isPlain }: Props) => {
onKeyDown={() => null} onKeyDown={() => null}
role="button" role="button"
tabIndex={0} tabIndex={0}
onClick={() => setOpen(true)} onClick={onSubmit}
className="invisible group-hover:visible" className="invisible group-hover:visible"
> >
<FontAwesomeIcon className="text-bunker-300 hover:text-red pl-2 pr-6 text-lg mt-0.5" icon={faXmark} /> <FontAwesomeIcon className="text-bunker-300 hover:text-red pl-2 pr-6 text-lg mt-0.5" icon={faXmark} />
</div> </div>
: <Button : <Button
text={String(t("Delete"))} text={String(t("Delete"))}
// onButtonPressed={onSubmit}
color="red" color="red"
size="md" size="md"
onButtonPressed={() => setOpen(true)} onButtonPressed={onSubmit}
/>} />}
<DeleteEnvVar
isOpen={open}
onClose={() => {
setOpen(false)
}}
onSubmit={onSubmit}
/>
</div> </div>
) )
} }