1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-10-13 11:17:26 +02:00
unleash.unleash/frontend/src/component/common/FeatureArchiveDialog/FeatureArchiveNotAllowedDialog.tsx
2023-10-04 09:27:53 +02:00

45 lines
1.4 KiB
TypeScript

import { FC } from 'react';
import { Dialogue } from '../Dialogue/Dialogue';
import { styled } from '@mui/material';
import { Link } from 'react-router-dom';
interface IFeatureArchiveNotAllowedDialogProps {
isOpen: boolean;
onClose: () => void;
features: string[];
project: string;
}
const StyledLink = styled(Link)(({ theme }) => ({
textDecoration: 'none',
color: theme.palette.primary.main,
fontWeight: theme.fontWeight.bold,
}));
export const FeatureArchiveNotAllowedDialog: FC<
IFeatureArchiveNotAllowedDialogProps
> = ({ isOpen, onClose, features, project }) => {
return (
<Dialogue
title="You can't archive a feature that other features depend on"
open={isOpen}
primaryButtonText='OK'
onClick={onClose}
>
<p>The following features depend on your feature:</p>
<ul>
{features.map((feature) => (
<li key={feature}>
<StyledLink
to={`/projects/${project}/features/${feature}`}
target='_blank'
rel='noopener noreferrer'
>
{feature}
</StyledLink>
</li>
))}
</ul>
</Dialogue>
);
};