1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-08-27 13:49:10 +02:00

chore(1-3420): wrap strategy list in an ordered list (#9377)

Improves the semantic correctness of the strategy list by wrapping it
in an `ol` tag.

Strategy order matters (due to variant resolution etc), so the order
is important (hence the `ol` instead of a `ul`).

Dragging still works and it's visually the same.
This commit is contained in:
Thomas Heartman 2025-02-27 09:15:08 +01:00 committed by GitHub
parent be3fa73244
commit 0c6ef912d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -60,6 +60,12 @@ const AdditionalStrategiesDiv = styled('div')(({ theme }) => ({
marginBottom: theme.spacing(2), marginBottom: theme.spacing(2),
})); }));
const StyledStrategyList = styled('ol')({
listStyle: 'none',
padding: 0,
margin: 0,
});
export const EnvironmentAccordionBody = ({ export const EnvironmentAccordionBody = ({
featureEnvironment, featureEnvironment,
isDisabled, isDisabled,
@ -257,10 +263,10 @@ export const EnvironmentAccordionBody = ({
!manyStrategiesPagination !manyStrategiesPagination
} }
show={ show={
<> <StyledStrategyList>
{strategies.map((strategy, index) => ( {strategies.map((strategy, index) => (
<li key={strategy.id}>
<NewStrategyDraggableItem <NewStrategyDraggableItem
key={strategy.id}
strategy={strategy} strategy={strategy}
index={index} index={index}
environmentName={ environmentName={
@ -270,16 +276,20 @@ export const EnvironmentAccordionBody = ({
otherEnvironments otherEnvironments
} }
isDragging={ isDragging={
dragItem?.id === strategy.id dragItem?.id ===
strategy.id
}
onDragStartRef={
onDragStartRef
} }
onDragStartRef={onDragStartRef}
onDragOver={onDragOver( onDragOver={onDragOver(
strategy.id, strategy.id,
)} )}
onDragEnd={onDragEnd} onDragEnd={onDragEnd}
/> />
</li>
))} ))}
</> </StyledStrategyList>
} }
elseShow={ elseShow={
<> <>
@ -291,12 +301,14 @@ export const EnvironmentAccordionBody = ({
segments. segments.
</Alert> </Alert>
<br /> <br />
<StyledStrategyList>
{page.map((strategy, index) => ( {page.map((strategy, index) => (
<li key={strategy.id}>
<StrategyDraggableItem <StrategyDraggableItem
key={strategy.id}
strategy={strategy} strategy={strategy}
index={ index={
index + pageIndex * pageSize index +
pageIndex * pageSize
} }
environmentName={ environmentName={
featureEnvironment.name featureEnvironment.name
@ -308,10 +320,16 @@ export const EnvironmentAccordionBody = ({
onDragStartRef={ onDragStartRef={
(() => {}) as any (() => {}) as any
} }
onDragOver={(() => {}) as any} onDragOver={
onDragEnd={(() => {}) as any} (() => {}) as any
}
onDragEnd={
(() => {}) as any
}
/> />
</li>
))} ))}
</StyledStrategyList>
<br /> <br />
<Pagination <Pagination
count={pages.length} count={pages.length}