mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-27 01:19:00 +02:00
* fix: add fixed height to summary * fix: change wording to negated * fix: change header margin * fix: label click length for negated property * fix: cut values that exceed allow length while leaving others alone * fix: set edit bg color * fix: add enter to add values * fix: expand if constraint changes * fix: add string truncator to param names * fix: add validation tests * fix: string truncator * fix: accordion margins on expanded * fix: accordion expansion * fix: update e2e * fix: update parseISO * fix: review comments * fix: update spec * fix: add negated visual indicator
52 lines
1.5 KiB
TypeScript
52 lines
1.5 KiB
TypeScript
import { IStrategy } from 'interfaces/strategy';
|
|
import { Link } from 'react-router-dom';
|
|
import { useStyles } from './FeatureStrategyMenuCard.styles';
|
|
import {
|
|
getFeatureStrategyIcon,
|
|
formatStrategyName,
|
|
} from 'utils/strategy-names';
|
|
import { formatCreateStrategyPath } from '../../FeatureStrategyCreate/FeatureStrategyCreate';
|
|
import StringTruncator from 'component/common/StringTruncator/StringTruncator';
|
|
|
|
interface IFeatureStrategyMenuCardProps {
|
|
projectId: string;
|
|
featureId: string;
|
|
environmentId: string;
|
|
strategy: IStrategy;
|
|
}
|
|
|
|
export const FeatureStrategyMenuCard = ({
|
|
projectId,
|
|
featureId,
|
|
environmentId,
|
|
strategy,
|
|
}: IFeatureStrategyMenuCardProps) => {
|
|
const styles = useStyles();
|
|
const StrategyIcon = getFeatureStrategyIcon(strategy.name);
|
|
const strategyName = formatStrategyName(strategy.name);
|
|
|
|
const createStrategyPath = formatCreateStrategyPath(
|
|
projectId,
|
|
featureId,
|
|
environmentId,
|
|
strategy.name
|
|
);
|
|
|
|
return (
|
|
<Link to={createStrategyPath} className={styles.card}>
|
|
<div className={styles.icon}>
|
|
<StrategyIcon aria-hidden />
|
|
</div>
|
|
<div>
|
|
<StringTruncator
|
|
text={strategy.displayName || strategyName}
|
|
className={styles.name}
|
|
maxWidth="200"
|
|
maxLength={25}
|
|
/>
|
|
<div className={styles.description}>{strategy.description}</div>
|
|
</div>
|
|
</Link>
|
|
);
|
|
};
|