Skip to content

Commit

Permalink
Use css instead of array conditional
Browse files Browse the repository at this point in the history
  • Loading branch information
mnigh committed Jan 10, 2025
1 parent 4db1ac6 commit c87cf97
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 48 deletions.
33 changes: 9 additions & 24 deletions apps/web/src/pages/AdminDashboardPage/AdminDashboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,9 @@ export const DashboardPage = ({ currentUser }: DashboardPageProps) => {
})}
</Heading>
<CardBasic data-h2-min-width="base(x14.5)">
<ul>
{recruitmentCollectionSorted.map((item, i, { length }) => (
<li
key={item.label}
data-h2-margin-bottom={
i === length - 1 ? "base(initial)" : "base(x.5)"
}
>
<ul data-h2-margin-bottom="base:children[li:not(:last-child)](x.5)">
{recruitmentCollectionSorted.map((item) => (
<li key={item.label}>
<Link color="primary" mode="inline" href={item.href}>
{item.label}
</Link>
Expand All @@ -291,14 +286,9 @@ export const DashboardPage = ({ currentUser }: DashboardPageProps) => {
})}
</Heading>
<CardBasic data-h2-min-width="base(x14.5)">
<ul>
{resourcesCollectionSorted.map((item, i, { length }) => (
<li
key={item.label}
data-h2-margin-bottom={
i === length - 1 ? "base(initial)" : "base(x.5)"
}
>
<ul data-h2-margin-bottom="base:children[li:not(:last-child)](x.5)">
{resourcesCollectionSorted.map((item) => (
<li key={item.label}>
<Link color="secondary" mode="inline" href={item.href}>
{item.label}
</Link>
Expand All @@ -322,14 +312,9 @@ export const DashboardPage = ({ currentUser }: DashboardPageProps) => {
})}
</Heading>
<CardBasic data-h2-min-width="base(x14.5)">
<ul>
{administrationCollectionSorted.map((item, i, { length }) => (
<li
key={item.label}
data-h2-margin-bottom={
i === length - 1 ? "base(initial)" : "base(x.5)"
}
>
<ul data-h2-margin-bottom="base:children[li:not(:last-child)](x.5)">
{administrationCollectionSorted.map((item) => (
<li key={item.label}>
<Link color="error" mode="inline" href={item.href}>
{item.label}
</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,9 @@ export const DashboardPage = ({ currentUser }: DashboardPageProps) => {
})}
</Heading>
<CardBasic data-h2-min-width="base(x14.5)">
<ul>
{recruitmentCollectionSorted.map((item, i, { length }) => (
<li
key={item.label}
data-h2-margin-bottom={
i === length - 1 ? "base(initial)" : "base(x.5)"
}
>
<ul data-h2-margin-bottom="base:children[li:not(:last-child)](x.5)">
{recruitmentCollectionSorted.map((item) => (
<li key={item.label}>
<Link color="primary" mode="inline" href={item.href}>
{item.label}
</Link>
Expand All @@ -291,14 +286,9 @@ export const DashboardPage = ({ currentUser }: DashboardPageProps) => {
})}
</Heading>
<CardBasic data-h2-min-width="base(x14.5)">
<ul>
{resourcesCollectionSorted.map((item, i, { length }) => (
<li
key={item.label}
data-h2-margin-bottom={
i === length - 1 ? "base(initial)" : "base(x.5)"
}
>
<ul data-h2-margin-bottom="base:children[li:not(:last-child)](x.5)">
{resourcesCollectionSorted.map((item) => (
<li key={item.label}>
<Link color="secondary" mode="inline" href={item.href}>
{item.label}
</Link>
Expand All @@ -322,14 +312,9 @@ export const DashboardPage = ({ currentUser }: DashboardPageProps) => {
})}
</Heading>
<CardBasic data-h2-min-width="base(x14.5)">
<ul>
{administrationCollectionSorted.map((item, i, { length }) => (
<li
key={item.label}
data-h2-margin-bottom={
i === length - 1 ? "base(initial)" : "base(x.5)"
}
>
<ul data-h2-margin-bottom="base:children[li:not(:last-child)](x.5)">
{administrationCollectionSorted.map((item) => (
<li key={item.label}>
<Link color="error" mode="inline" href={item.href}>
{item.label}
</Link>
Expand Down

0 comments on commit c87cf97

Please sign in to comment.