1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00
unleash.unleash/frontend/src/component/strategies/TogglesLinkList/TogglesLinkList.tsx
Christopher Kolstad 53354224fc
chore: Bump biome and configure husky (#6589)
Upgrades biome to 1.6.1, and updates husky pre-commit hook.

Most changes here are making type imports explicit.
2024-03-18 13:58:05 +01:00

53 lines
1.9 KiB
TypeScript

import {
List,
ListItem,
ListItemAvatar,
ListItemText,
Tooltip,
} from '@mui/material';
import Pause from '@mui/icons-material/Pause';
import PlayArrow from '@mui/icons-material/PlayArrow';
import styles from 'component/common/common.module.scss';
import { Link } from 'react-router-dom';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import type { FeatureSchema } from 'openapi';
interface ITogglesLinkListProps {
toggles: FeatureSchema[];
}
export const TogglesLinkList = ({ toggles }: ITogglesLinkListProps) => (
<List style={{ textAlign: 'left' }} className={styles.truncate}>
<ConditionallyRender
condition={toggles.length > 0}
show={toggles.map(({ name, description = '-', enabled }) => (
<ListItem key={name}>
<ListItemAvatar>
<ConditionallyRender
condition={Boolean(enabled)}
show={
<Tooltip title='Enabled' arrow>
<PlayArrow aria-hidden={false} />
</Tooltip>
}
elseShow={
<Tooltip title='Disabled' arrow>
<Pause aria-hidden={false} />
</Tooltip>
}
/>
</ListItemAvatar>
<ListItemText
primary={
<Link key={name} to={`/features/view/${name}`}>
{name}
</Link>
}
secondary={description}
/>
</ListItem>
))}
/>
</List>
);