Skip to content

Commit

Permalink
#273 custom links on parahraph
Browse files Browse the repository at this point in the history
  • Loading branch information
guillermau committed Feb 7, 2025
1 parent c29627d commit 613bdb3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 49 deletions.
6 changes: 6 additions & 0 deletions web/src/ui/config-ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
"softwareSelection": {
"enabled": true
},
"theSillInAFewWordsParagraphLinks": [
"https://fr.wikipedia.org/wiki/Logiciel_libre",
"https://www.legifrance.gouv.fr/jorf/article_jo/JORFARTI000033203039",
"https://code.gouv.fr/sill/readme",
"https://code.gouv.fr/fr/doc/licences-libres-dinum"
],
"statistics": {
"catgegories": [
"softwareCount",
Expand Down
73 changes: 24 additions & 49 deletions web/src/ui/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ export default function Home(props: Props) {
string,
JSX.Element
> = {};

obj[key] = (
/* eslint-disable-next-line jsx-a11y/anchor-has-content */
<a
href={link}
style={{
Expand All @@ -248,7 +250,7 @@ export default function Home(props: Props) {
.blueFrance
.default
}}
></a>
/>
);
return Object.assign(map, obj);
},
Expand Down Expand Up @@ -351,15 +353,6 @@ const useStyles = tss.withName({ Home }).create({
},
"helpUsBackground": {
"backgroundColor": fr.colors.decisions.background.default.grey.hover
},
"helpUsCards": {
"display": "grid",
"gridTemplateColumns": "repeat(3, 1fr)",
"columnGap": fr.spacing("6v"),
[fr.breakpoints.down("md")]: {
"gridTemplateColumns": `repeat(1, 1fr)`,
"rowGap": fr.spacing("4v")
}
}
});

Expand Down Expand Up @@ -458,45 +451,27 @@ const { WhatIsTheSillSection } = (() => {
components={
{
space: <span> </span>,
a1: (
<a
href="https://fr.wikipedia.org/wiki/Logiciel_libre"
style={{
"color":
fr.colors.decisions.text.title.blueFrance
.default
}}
/>
),
a2: (
<a
href="https://www.legifrance.gouv.fr/jorf/article_jo/JORFARTI000033203039"
style={{
"color":
fr.colors.decisions.text.title.blueFrance
.default
}}
/>
),
a3: (
<a
href="https://code.gouv.fr/sill/readme"
style={{
"color":
fr.colors.decisions.text.title.blueFrance
.default
}}
/>
),
a4: (
<a
href="https://code.gouv.fr/fr/doc/licences-libres-dinum"
style={{
"color":
fr.colors.decisions.text.title.blueFrance
.default
}}
/>
...config.home.theSillInAFewWordsParagraphLinks.reduce(
(
map: Record<string, JSX.Element>,
link: string,
index: number
) => {
const key = `a${index + 1}`;
const obj: Record<string, JSX.Element> = {};
obj[key] = (
<a
href={link}
style={{
"color":
fr.colors.decisions.text.title
.blueFrance.default
}}
/>
);
return Object.assign(map, obj);
},
{}
)
}
/* eslint-enable jsx-a11y/anchor-has-content */
Expand Down

0 comments on commit 613bdb3

Please sign in to comment.