mirror of
https://github.com/langgenius/dify.git
synced 2026-04-25 09:36:40 +08:00
refactor(web): replace Button destructive boolean with tone semantic axis (#35176)
This commit is contained in:
parent
648dde5e96
commit
ebf741114d
@ -159,7 +159,7 @@ const AvatarWithEdit = ({ onSave, ...props }: AvatarWithEditProps) => {
|
|||||||
{t('operation.cancel', { ns: 'common' })}
|
{t('operation.cancel', { ns: 'common' })}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button variant="primary" destructive className="w-full" onClick={handleDeleteAvatar}>
|
<Button variant="primary" tone="destructive" className="w-full" onClick={handleDeleteAvatar}>
|
||||||
{t('operation.delete', { ns: 'common' })}
|
{t('operation.delete', { ns: 'common' })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -53,7 +53,7 @@ export default function VerifyEmail(props: DeleteAccountProps) {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<div className="mt-3 flex w-full flex-col gap-2">
|
<div className="mt-3 flex w-full flex-col gap-2">
|
||||||
<Button className="w-full" disabled={shouldButtonDisabled} loading={isDeleting} variant="primary" destructive onClick={handleConfirm}>{t('account.permanentlyDeleteButton', { ns: 'common' })}</Button>
|
<Button className="w-full" disabled={shouldButtonDisabled} loading={isDeleting} variant="primary" tone="destructive" onClick={handleConfirm}>{t('account.permanentlyDeleteButton', { ns: 'common' })}</Button>
|
||||||
<Button className="w-full" onClick={props.onCancel}>{t('operation.cancel', { ns: 'common' })}</Button>
|
<Button className="w-full" onClick={props.onCancel}>{t('operation.cancel', { ns: 'common' })}</Button>
|
||||||
<Countdown onResend={sendEmail} />
|
<Countdown onResend={sendEmail} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -165,10 +165,10 @@ const ConfigurationView: FC<ConfigurationViewModel> = ({
|
|||||||
</AlertDialogDescription>
|
</AlertDialogDescription>
|
||||||
</div>
|
</div>
|
||||||
<AlertDialogActions>
|
<AlertDialogActions>
|
||||||
<AlertDialogCancelButton destructive={false}>
|
<AlertDialogCancelButton tone="default">
|
||||||
{t('operation.cancel', { ns: 'common' })}
|
{t('operation.cancel', { ns: 'common' })}
|
||||||
</AlertDialogCancelButton>
|
</AlertDialogCancelButton>
|
||||||
<AlertDialogConfirmButton variant="primary" destructive={false} onClick={onConfirmUseGPT4}>
|
<AlertDialogConfirmButton variant="primary" tone="default" onClick={onConfirmUseGPT4}>
|
||||||
{t('operation.confirm', { ns: 'common' })}
|
{t('operation.confirm', { ns: 'common' })}
|
||||||
</AlertDialogConfirmButton>
|
</AlertDialogConfirmButton>
|
||||||
</AlertDialogActions>
|
</AlertDialogActions>
|
||||||
|
|||||||
@ -43,7 +43,7 @@ const DSLConfirmModal = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
||||||
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||||
<Button variant="primary" destructive onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -322,7 +322,7 @@ const CreateFromDSLModal = ({ show, onSuccess, onClose, activeTab = CreateFromDS
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
||||||
<Button variant="secondary" onClick={() => setShowErrorModal(false)}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
<Button variant="secondary" onClick={() => setShowErrorModal(false)}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||||
<Button variant="primary" destructive onClick={onDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -152,7 +152,7 @@ const SwitchAppModal = ({ show, appDetail, inAppDetail = false, onSuccess, onClo
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Button className="mr-2" onClick={onClose}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
<Button className="mr-2" onClick={onClose}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||||
<Button className="border-red-700" disabled={isAppsFull || !name} variant="primary" destructive onClick={goStart}>{t('switchStart', { ns: 'app' })}</Button>
|
<Button className="border-red-700" disabled={isAppsFull || !name} variant="primary" tone="destructive" onClick={goStart}>{t('switchStart', { ns: 'app' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@ -152,7 +152,7 @@ function Confirm({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-start justify-end gap-2 self-stretch p-6">
|
<div className="flex items-start justify-end gap-2 self-stretch p-6">
|
||||||
{showCancel && <Button onClick={onCancel}>{cancelTxt}</Button>}
|
{showCancel && <Button onClick={onCancel}>{cancelTxt}</Button>}
|
||||||
{showConfirm && <Button variant="primary" destructive={type !== 'info'} loading={isLoading} disabled={isConfirmDisabled} onClick={onConfirm}>{confirmTxt}</Button>}
|
{showConfirm && <Button variant="primary" tone={type !== 'info' ? 'destructive' : 'default'} loading={isLoading} disabled={isConfirmDisabled} onClick={onConfirm}>{confirmTxt}</Button>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -93,7 +93,7 @@ describe('InlineDeleteConfirm', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const confirmButton = getByText('Yes').closest('button')
|
const confirmButton = getByText('Yes').closest('button')
|
||||||
expect(confirmButton?.className).toContain('btn-destructive')
|
expect(confirmButton?.className).toContain('btn-destructive-primary')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should render without destructive class for warning variant', () => {
|
it('should render without destructive class for warning variant', () => {
|
||||||
@ -108,7 +108,7 @@ describe('InlineDeleteConfirm', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const confirmButton = getByText('Yes').closest('button')
|
const confirmButton = getByText('Yes').closest('button')
|
||||||
expect(confirmButton?.className).not.toContain('btn-destructive')
|
expect(confirmButton?.className).not.toContain('btn-destructive-primary')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should render without destructive class for info variant', () => {
|
it('should render without destructive class for info variant', () => {
|
||||||
@ -123,7 +123,7 @@ describe('InlineDeleteConfirm', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const confirmButton = getByText('Yes').closest('button')
|
const confirmButton = getByText('Yes').closest('button')
|
||||||
expect(confirmButton?.className).not.toContain('btn-destructive')
|
expect(confirmButton?.className).not.toContain('btn-destructive-primary')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,7 @@ const InlineDeleteConfirm: FC<InlineDeleteConfirmProps> = ({
|
|||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
variant="primary"
|
variant="primary"
|
||||||
destructive={variant === 'delete'}
|
tone={variant === 'delete' ? 'destructive' : 'default'}
|
||||||
onClick={onConfirm}
|
onClick={onConfirm}
|
||||||
aria-label={confirmTxt}
|
aria-label={confirmTxt}
|
||||||
className="flex-1"
|
className="flex-1"
|
||||||
|
|||||||
@ -39,7 +39,7 @@ const TagRemoveModal = ({ show, tag, onConfirm, onClose }: TagRemoveModalProps)
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-center justify-end pt-6">
|
<div className="flex items-center justify-end pt-6">
|
||||||
<Button className="mr-2" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
|
<Button className="mr-2" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
|
||||||
<Button className="border-red-700" variant="primary" destructive onClick={onConfirm}>{t('operation.delete', { ns: 'common' })}</Button>
|
<Button className="border-red-700" variant="primary" tone="destructive" onClick={onConfirm}>{t('operation.delete', { ns: 'common' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -110,7 +110,7 @@ describe('AlertDialog wrapper', () => {
|
|||||||
expect(screen.getByTestId('actions')).toHaveClass('flex', 'items-start', 'justify-end', 'gap-2', 'self-stretch', 'p-6', 'custom-actions')
|
expect(screen.getByTestId('actions')).toHaveClass('flex', 'items-start', 'justify-end', 'gap-2', 'self-stretch', 'p-6', 'custom-actions')
|
||||||
const confirmButton = screen.getByRole('button', { name: 'Confirm' })
|
const confirmButton = screen.getByRole('button', { name: 'Confirm' })
|
||||||
expect(confirmButton).toHaveClass('btn-primary')
|
expect(confirmButton).toHaveClass('btn-primary')
|
||||||
expect(confirmButton).toHaveClass('btn-destructive')
|
expect(confirmButton).toHaveClass('btn-destructive-primary')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should keep dialog open after confirm click and close via cancel helper', async () => {
|
it('should keep dialog open after confirm click and close via cancel helper', async () => {
|
||||||
|
|||||||
@ -86,13 +86,13 @@ type AlertDialogConfirmButtonProps = ButtonProps
|
|||||||
|
|
||||||
export function AlertDialogConfirmButton({
|
export function AlertDialogConfirmButton({
|
||||||
variant = 'primary',
|
variant = 'primary',
|
||||||
destructive = true,
|
tone = 'destructive',
|
||||||
...props
|
...props
|
||||||
}: AlertDialogConfirmButtonProps) {
|
}: AlertDialogConfirmButtonProps) {
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
variant={variant}
|
variant={variant}
|
||||||
destructive={destructive}
|
tone={tone}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -51,9 +51,14 @@ describe('Button', () => {
|
|||||||
expect(screen.getByRole('button').className).toContain(`btn-${variant}`)
|
expect(screen.getByRole('button').className).toContain(`btn-${variant}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('applies destructive modifier', () => {
|
it('applies destructive tone with default variant', () => {
|
||||||
render(<Button destructive>Click me</Button>)
|
render(<Button tone="destructive">Click me</Button>)
|
||||||
expect(screen.getByRole('button').className).toContain('btn-destructive')
|
expect(screen.getByRole('button').className).toContain('btn-destructive-secondary')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('applies destructive tone with primary variant', () => {
|
||||||
|
render(<Button variant="primary" tone="destructive">Click me</Button>)
|
||||||
|
expect(screen.getByRole('button').className).toContain('btn-destructive-primary')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -98,53 +98,51 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@utility btn-destructive {
|
@utility btn-destructive-primary {
|
||||||
&.btn-primary {
|
@apply bg-components-button-destructive-primary-bg
|
||||||
@apply bg-components-button-destructive-primary-bg
|
|
||||||
border-components-button-destructive-primary-border
|
border-components-button-destructive-primary-border
|
||||||
hover:bg-components-button-destructive-primary-bg-hover
|
hover:bg-components-button-destructive-primary-bg-hover
|
||||||
hover:border-components-button-destructive-primary-border-hover
|
hover:border-components-button-destructive-primary-border-hover
|
||||||
text-components-button-destructive-primary-text;
|
text-components-button-destructive-primary-text;
|
||||||
}
|
|
||||||
|
|
||||||
&.btn-primary:is(:disabled, [data-disabled]) {
|
&:is(:disabled, [data-disabled]) {
|
||||||
@apply shadow-none
|
@apply shadow-none
|
||||||
bg-components-button-destructive-primary-bg-disabled
|
bg-components-button-destructive-primary-bg-disabled
|
||||||
border-components-button-destructive-primary-border-disabled
|
border-components-button-destructive-primary-border-disabled
|
||||||
text-components-button-destructive-primary-text-disabled;
|
text-components-button-destructive-primary-text-disabled;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.btn-secondary {
|
@utility btn-destructive-secondary {
|
||||||
@apply bg-components-button-destructive-secondary-bg
|
@apply bg-components-button-destructive-secondary-bg
|
||||||
border-components-button-destructive-secondary-border
|
border-components-button-destructive-secondary-border
|
||||||
hover:bg-components-button-destructive-secondary-bg-hover
|
hover:bg-components-button-destructive-secondary-bg-hover
|
||||||
hover:border-components-button-destructive-secondary-border-hover
|
hover:border-components-button-destructive-secondary-border-hover
|
||||||
text-components-button-destructive-secondary-text;
|
text-components-button-destructive-secondary-text;
|
||||||
}
|
|
||||||
|
|
||||||
&.btn-secondary:is(:disabled, [data-disabled]) {
|
&:is(:disabled, [data-disabled]) {
|
||||||
@apply bg-components-button-destructive-secondary-bg-disabled
|
@apply bg-components-button-destructive-secondary-bg-disabled
|
||||||
border-components-button-destructive-secondary-border-disabled
|
border-components-button-destructive-secondary-border-disabled
|
||||||
text-components-button-destructive-secondary-text-disabled;
|
text-components-button-destructive-secondary-text-disabled;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.btn-tertiary {
|
@utility btn-destructive-tertiary {
|
||||||
@apply bg-components-button-destructive-tertiary-bg
|
@apply bg-components-button-destructive-tertiary-bg
|
||||||
hover:bg-components-button-destructive-tertiary-bg-hover
|
hover:bg-components-button-destructive-tertiary-bg-hover
|
||||||
text-components-button-destructive-tertiary-text;
|
text-components-button-destructive-tertiary-text;
|
||||||
}
|
|
||||||
|
|
||||||
&.btn-tertiary:is(:disabled, [data-disabled]) {
|
&:is(:disabled, [data-disabled]) {
|
||||||
@apply bg-components-button-destructive-tertiary-bg-disabled
|
@apply bg-components-button-destructive-tertiary-bg-disabled
|
||||||
text-components-button-destructive-tertiary-text-disabled;
|
text-components-button-destructive-tertiary-text-disabled;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&.btn-ghost {
|
@utility btn-destructive-ghost {
|
||||||
@apply hover:bg-components-button-destructive-ghost-bg-hover
|
@apply hover:bg-components-button-destructive-ghost-bg-hover
|
||||||
text-components-button-destructive-ghost-text;
|
text-components-button-destructive-ghost-text;
|
||||||
}
|
|
||||||
|
|
||||||
&.btn-ghost:is(:disabled, [data-disabled]) {
|
&:is(:disabled, [data-disabled]) {
|
||||||
@apply text-components-button-destructive-ghost-text-disabled;
|
@apply text-components-button-destructive-ghost-text-disabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,10 @@ const meta = {
|
|||||||
tags: ['autodocs'],
|
tags: ['autodocs'],
|
||||||
argTypes: {
|
argTypes: {
|
||||||
loading: { control: 'boolean' },
|
loading: { control: 'boolean' },
|
||||||
destructive: { control: 'boolean' },
|
tone: {
|
||||||
|
control: 'select',
|
||||||
|
options: ['default', 'destructive'],
|
||||||
|
},
|
||||||
disabled: { control: 'boolean' },
|
disabled: { control: 'boolean' },
|
||||||
variant: {
|
variant: {
|
||||||
control: 'select',
|
control: 'select',
|
||||||
@ -92,7 +95,7 @@ export const Loading: Story = {
|
|||||||
export const Destructive: Story = {
|
export const Destructive: Story = {
|
||||||
args: {
|
args: {
|
||||||
variant: 'primary',
|
variant: 'primary',
|
||||||
destructive: true,
|
tone: 'destructive',
|
||||||
children: 'Delete',
|
children: 'Delete',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,13 +21,21 @@ const buttonVariants = cva(
|
|||||||
medium: 'btn-medium',
|
medium: 'btn-medium',
|
||||||
large: 'btn-large',
|
large: 'btn-large',
|
||||||
},
|
},
|
||||||
destructive: {
|
tone: {
|
||||||
true: 'btn-destructive',
|
default: '',
|
||||||
|
destructive: '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
compoundVariants: [
|
||||||
|
{ variant: 'primary', tone: 'destructive', class: 'btn-destructive-primary' },
|
||||||
|
{ variant: 'secondary', tone: 'destructive', class: 'btn-destructive-secondary' },
|
||||||
|
{ variant: 'tertiary', tone: 'destructive', class: 'btn-destructive-tertiary' },
|
||||||
|
{ variant: 'ghost', tone: 'destructive', class: 'btn-destructive-ghost' },
|
||||||
|
],
|
||||||
defaultVariants: {
|
defaultVariants: {
|
||||||
variant: 'secondary',
|
variant: 'secondary',
|
||||||
size: 'medium',
|
size: 'medium',
|
||||||
|
tone: 'default',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -43,7 +51,7 @@ export function Button({
|
|||||||
className,
|
className,
|
||||||
variant,
|
variant,
|
||||||
size,
|
size,
|
||||||
destructive,
|
tone,
|
||||||
loading,
|
loading,
|
||||||
disabled,
|
disabled,
|
||||||
type = 'button',
|
type = 'button',
|
||||||
@ -53,7 +61,7 @@ export function Button({
|
|||||||
return (
|
return (
|
||||||
<BaseButton
|
<BaseButton
|
||||||
type={type}
|
type={type}
|
||||||
className={cn(buttonVariants({ variant, size, destructive, className }))}
|
className={cn(buttonVariants({ variant, size, tone, className }))}
|
||||||
disabled={disabled || loading}
|
disabled={disabled || loading}
|
||||||
aria-busy={loading || undefined}
|
aria-busy={loading || undefined}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ const DSLConfirmModal = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
||||||
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||||
<Button variant="primary" destructive onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onConfirm} disabled={confirmDisabled}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -130,7 +130,7 @@ const BatchAction: FC<IBatchActionProps> = ({
|
|||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
variant="ghost"
|
variant="ghost"
|
||||||
destructive
|
tone="destructive"
|
||||||
className="gap-x-0.5 px-3"
|
className="gap-x-0.5 px-3"
|
||||||
onClick={showDeleteConfirm}
|
onClick={showDeleteConfirm}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -30,7 +30,7 @@ const DefaultContent: FC<IDefaultContentProps> = React.memo(({
|
|||||||
<Button onClick={onCancel}>
|
<Button onClick={onCancel}>
|
||||||
{t('operation.cancel', { ns: 'common' })}
|
{t('operation.cancel', { ns: 'common' })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="primary" destructive onClick={onConfirm}>
|
<Button variant="primary" tone="destructive" onClick={onConfirm}>
|
||||||
{t('operation.regenerate', { ns: 'common' })}
|
{t('operation.regenerate', { ns: 'common' })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@ -50,7 +50,7 @@ const RegeneratingContent: FC = React.memo(() => {
|
|||||||
<p className="system-md-regular text-text-secondary">{t('segment.regeneratingMessage', { ns: 'datasetDocuments' })}</p>
|
<p className="system-md-regular text-text-secondary">{t('segment.regeneratingMessage', { ns: 'datasetDocuments' })}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-end pt-6">
|
<div className="flex justify-end pt-6">
|
||||||
<Button variant="primary" destructive disabled className="inline-flex items-center gap-x-0.5">
|
<Button variant="primary" tone="destructive" disabled className="inline-flex items-center gap-x-0.5">
|
||||||
<RiLoader2Line className="h-4 w-4 animate-spin text-components-button-destructive-primary-text-disabled" />
|
<RiLoader2Line className="h-4 w-4 animate-spin text-components-button-destructive-primary-text-disabled" />
|
||||||
<span>{t('operation.regenerate', { ns: 'common' })}</span>
|
<span>{t('operation.regenerate', { ns: 'common' })}</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@ -173,7 +173,7 @@ const TransferOwnershipModal = ({ onClose, show }: Props) => {
|
|||||||
<MemberSelector exclude={[userProfile.id]} value={newOwner} onSelect={setNewOwner} />
|
<MemberSelector exclude={[userProfile.id]} value={newOwner} onSelect={setNewOwner} />
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-4 space-y-2">
|
<div className="mt-4 space-y-2">
|
||||||
<Button data-testid="transfer-modal-submit" disabled={!newOwner || isTransfer} className="w-full!" variant="primary" destructive onClick={handleTransfer}>
|
<Button data-testid="transfer-modal-submit" disabled={!newOwner || isTransfer} className="w-full!" variant="primary" tone="destructive" onClick={handleTransfer}>
|
||||||
{t('members.transferModal.transfer', { ns: 'common' })}
|
{t('members.transferModal.transfer', { ns: 'common' })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button data-testid="transfer-modal-cancel" className="w-full!" onClick={onClose}>
|
<Button data-testid="transfer-modal-cancel" className="w-full!" onClick={onClose}>
|
||||||
|
|||||||
@ -387,7 +387,7 @@ const ModelModal: FC<ModelModalProps> = ({
|
|||||||
isEditMode && (
|
isEditMode && (
|
||||||
<Button
|
<Button
|
||||||
variant="primary"
|
variant="primary"
|
||||||
destructive
|
tone="destructive"
|
||||||
onClick={() => openConfirmDelete(credential, model)}
|
onClick={() => openConfirmDelete(credential, model)}
|
||||||
>
|
>
|
||||||
{t('operation.remove', { ns: 'common' })}
|
{t('operation.remove', { ns: 'common' })}
|
||||||
|
|||||||
@ -25,7 +25,7 @@ const DowngradeWarningModal = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="mt-9 flex items-start justify-end space-x-2 self-stretch">
|
<div className="mt-9 flex items-start justify-end space-x-2 self-stretch">
|
||||||
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
<Button variant="secondary" onClick={() => onCancel()}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||||
<Button variant="secondary" destructive onClick={onJustDowngrade}>{t(`${i18nPrefix}.downgrade`, { ns: 'plugin' })}</Button>
|
<Button variant="secondary" tone="destructive" onClick={onJustDowngrade}>{t(`${i18nPrefix}.downgrade`, { ns: 'plugin' })}</Button>
|
||||||
<Button variant="primary" onClick={onExcludeAndDowngrade}>{t(`${i18nPrefix}.exclude`, { ns: 'plugin' })}</Button>
|
<Button variant="primary" onClick={onExcludeAndDowngrade}>{t(`${i18nPrefix}.exclude`, { ns: 'plugin' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@ -101,7 +101,7 @@ describe('VersionMismatchModal', () => {
|
|||||||
|
|
||||||
const confirmBtn = screen.getByRole('button', { name: /app\.newApp\.Confirm/ })
|
const confirmBtn = screen.getByRole('button', { name: /app\.newApp\.Confirm/ })
|
||||||
expect(confirmBtn).toHaveClass('btn-primary')
|
expect(confirmBtn).toHaveClass('btn-primary')
|
||||||
expect(confirmBtn).toHaveClass('btn-destructive')
|
expect(confirmBtn).toHaveClass('btn-destructive-primary')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ const UpdateDSLModal = ({
|
|||||||
<Button
|
<Button
|
||||||
disabled={!currentFile || loading}
|
disabled={!currentFile || loading}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
destructive
|
tone="destructive"
|
||||||
onClick={handleImport}
|
onClick={handleImport}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -45,7 +45,7 @@ const VersionMismatchModal = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
||||||
<Button variant="secondary" onClick={onClose}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
<Button variant="secondary" onClick={onClose}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||||
<Button variant="primary" destructive onClick={onConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
|
|||||||
@ -344,7 +344,7 @@ const EditCustomCollectionModal: FC<Props> = ({
|
|||||||
<div className={cn(isEdit ? 'justify-between' : 'justify-end', 'mt-2 flex shrink-0 rounded-b-[10px] border-t border-divider-regular bg-background-section-burn px-6 py-4')}>
|
<div className={cn(isEdit ? 'justify-between' : 'justify-end', 'mt-2 flex shrink-0 rounded-b-[10px] border-t border-divider-regular bg-background-section-burn px-6 py-4')}>
|
||||||
{
|
{
|
||||||
isEdit && (
|
isEdit && (
|
||||||
<Button variant="primary" destructive onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<div className="flex space-x-2">
|
<div className="flex space-x-2">
|
||||||
|
|||||||
@ -165,7 +165,7 @@ describe('ConfirmModal', () => {
|
|||||||
// Assert
|
// Assert
|
||||||
const confirmButton = screen.getByText('common.operation.confirm')
|
const confirmButton = screen.getByText('common.operation.confirm')
|
||||||
expect(confirmButton).toHaveClass('btn-primary')
|
expect(confirmButton).toHaveClass('btn-primary')
|
||||||
expect(confirmButton).toHaveClass('btn-destructive')
|
expect(confirmButton).toHaveClass('btn-destructive-primary')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -36,7 +36,7 @@ const ConfirmModal = ({ show, onConfirm, onClose }: ConfirmModalProps) => {
|
|||||||
<div className="flex items-center justify-end pt-6">
|
<div className="flex items-center justify-end pt-6">
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<Button className="mr-2" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
|
<Button className="mr-2" onClick={onClose}>{t('operation.cancel', { ns: 'common' })}</Button>
|
||||||
<Button variant="primary" destructive onClick={onConfirm}>{t('operation.confirm', { ns: 'common' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onConfirm}>{t('operation.confirm', { ns: 'common' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@ -318,7 +318,7 @@ const WorkflowToolAsModal: FC<Props> = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className={cn((!isAdd && onRemove) ? 'justify-between' : 'justify-end', 'mt-2 flex shrink-0 rounded-b-[10px] border-t border-divider-regular bg-background-section-burn px-6 py-4')}>
|
<div className={cn((!isAdd && onRemove) ? 'justify-between' : 'justify-end', 'mt-2 flex shrink-0 rounded-b-[10px] border-t border-divider-regular bg-background-section-burn px-6 py-4')}>
|
||||||
{!isAdd && onRemove && (
|
{!isAdd && onRemove && (
|
||||||
<Button variant="primary" destructive onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onRemove}>{t('operation.delete', { ns: 'common' })}</Button>
|
||||||
)}
|
)}
|
||||||
<div className="flex space-x-2">
|
<div className="flex space-x-2">
|
||||||
<Button onClick={onHide}>{t('operation.cancel', { ns: 'common' })}</Button>
|
<Button onClick={onHide}>{t('operation.cancel', { ns: 'common' })}</Button>
|
||||||
|
|||||||
@ -34,7 +34,7 @@ const DeleteConfirmModal: FC<DeleteConfirmModalProps> = ({
|
|||||||
<Button onClick={onClose}>
|
<Button onClick={onClose}>
|
||||||
{t('operation.cancel', { ns: 'common' })}
|
{t('operation.cancel', { ns: 'common' })}
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="primary" destructive onClick={onDelete.bind(null, versionInfo.id)}>
|
<Button variant="primary" tone="destructive" onClick={onDelete.bind(null, versionInfo.id)}>
|
||||||
{t('operation.delete', { ns: 'common' })}
|
{t('operation.delete', { ns: 'common' })}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -247,7 +247,7 @@ const UpdateDSLModal = ({
|
|||||||
<Button
|
<Button
|
||||||
disabled={!currentFile || loading}
|
disabled={!currentFile || loading}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
destructive
|
tone="destructive"
|
||||||
onClick={handleImport}
|
onClick={handleImport}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
>
|
>
|
||||||
@ -278,7 +278,7 @@ const UpdateDSLModal = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
<div className="flex items-start justify-end gap-2 self-stretch pt-6">
|
||||||
<Button variant="secondary" onClick={() => setShowErrorModal(false)}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
<Button variant="secondary" onClick={() => setShowErrorModal(false)}>{t('newApp.Cancel', { ns: 'app' })}</Button>
|
||||||
<Button variant="primary" destructive onClick={onUpdateDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
<Button variant="primary" tone="destructive" onClick={onUpdateDSLConfirm}>{t('newApp.Confirm', { ns: 'app' })}</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user