Skip to content

Commit

Permalink
feat: traductions et améliore le rendu du formulaire
Browse files Browse the repository at this point in the history
  • Loading branch information
ggrossetie committed Nov 29, 2024
1 parent a428e4e commit a51aab4
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 84 deletions.
24 changes: 12 additions & 12 deletions front/src/components/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ function ArrayFieldTemplate (properties) {

const inlineRemoveButton = properties.schema?.items?.type === 'string' || !removeItemTitle
return (
<div className={styles.arrayField}>
<fieldset className={styles.fieldset} key={properties.key}>
<fieldset className={clsx(styles.fieldset, styles.array)} key={properties.key}>
{title && <Translation>{(t) =>
<legend id={properties.id}>{t(title)}</legend>}
</Translation>}
Expand All @@ -120,7 +119,6 @@ function ArrayFieldTemplate (properties) {
)}
{properties.items &&
properties.items.map((element) => {
console.log({ element })
return (
<div
id={element.key}
Expand All @@ -147,7 +145,6 @@ function ArrayFieldTemplate (properties) {
)
})}
</fieldset>
</div>
)
}

Expand All @@ -156,6 +153,7 @@ function FieldTemplate (properties) {
const label = properties.schema.$id
? properties.label[properties.schema.$id]
: properties.label
console.log('FieldTemplate', {id, properties, children})
return (
<div className={classNames} style={style}>
{displayLabel && <label htmlFor={id}>
Expand Down Expand Up @@ -204,14 +202,16 @@ function ObjectFieldTemplate (properties) {
}
</Translation>
</legend>}
{elements.map(([field, element]) => (
element
? <Fragment key={field}>{element.content}</Fragment>
: <p key={field} className={styles.fieldHasNoElementError}>
Field <code>{field}</code> defined in <code>ui:groups</code> is not an
entry of <code>data-schema.json[properties]</code> object.
</p>
))}
{elements.map(([field, element]) => {
return (
element
? <Fragment key={field}>{element.content}</Fragment>
: <p key={field} className={styles.fieldHasNoElementError}>
Field <code>{field}</code> defined in <code>ui:groups</code> is not an
entry of <code>data-schema.json[properties]</code> object.
</p>
)
})}
</fieldset>
)
}
Expand Down
17 changes: 14 additions & 3 deletions front/src/components/form.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,23 @@
gap: 0.5rem;
padding: 0 0 1.5rem;
margin: 0;
font-size: 1em;

legend {
@include legend;
padding: 0 0 0.5rem;
font-size: 1.25rem;
font-size: 1.15em;
}

fieldset {
font-size: 0.8em;
}
}

.array {
gap: 1.5rem;
}

.comboboxReadonlyField {
margin-right: .5em;
}
Expand All @@ -234,11 +243,13 @@

.addButton,
.removeButton {
font-size: .7em;
font-size: 1em;
margin-top: .25rem;
}

.inlineRemoveButton {
font-size: 1em;
font-size: 1rem;
margin-top: 0;
}

.output {
Expand Down
11 changes: 11 additions & 0 deletions front/src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,19 @@
"article.metadata.type.dossierSummary": "Issue summary",
"article.metadata.type.interview": "Interview",
"article.metadata.type.editorialColumn": "Editorial column",
"article.metadata.production": "Production",
"article.metadata.issue": "Issue",
"article.metadata.headerTitle": "Article",
"article.metadata.titleAndAbstract": "Title and abstract",
"article.metadata.localizedContent": "Localized content",
"article.metadata.funder": "Funder",
"article.metadata.journalDirectors": "Journal directors",
"article.metadata.production.entities": "Production entities",
"article.metadata.production.entities.addItem": "Add a production entity",
"form.addItem.title": "Add",
"form.addPerson.title": "Add a person",
"form.removeItem.title": "Remove",
"form.removePerson.title": "Remove this person",
"corpus.metadata.form.name": "Name",
"corpus.metadata.form.issue": "Issue",
"corpus.metadata.form.issue.title": "Title",
Expand Down
19 changes: 18 additions & 1 deletion front/src/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@
"article.metadata.translationOf.lang": "Langue",
"article.metadata.publisher": "Éditeur·ice",
"article.metadata.journal": "Revue",
"article.metadata.journalEmail": "Courriel de la revue",
"article.metadata.journal.name": "Nom de la revue",
"article.metadata.journal.email": "Courriel de la revue",
"article.metadata.journal.publisher": "Diffuseur",
"article.metadata.journal.url": "URL",
"article.metadata.abstract": "Résumé",
"article.metadata.abstract.addItem": "Ajouter un résumé dans une autre langue",
"article.metadata.abstract.text": "Résumé",
Expand Down Expand Up @@ -263,9 +266,23 @@
"article.metadata.type.dossierSummary": "Sommaire dossier",
"article.metadata.type.interview": "Entretien",
"article.metadata.type.editorialColumn": "Chronique",
"article.metadata.production": "Production",
"article.metadata.headerTitle": "Article",
"article.metadata.titleAndAbstract": "Titre et résumé",
"article.metadata.localizedContent": "Contenu traduit",
"article.metadata.funder": "Financeur",
"article.metadata.journalDirectors": "Directeur·ices de la revue",
"article.metadata.production.entities": "Responsable de la production",
"article.metadata.production.entities.addItem": "Ajouter un·e responsable",
"form.addItem.title": "Ajouter",
"form.addPerson.title": "Ajouter une personne",
"form.removeItem.title": "Supprimer",
"form.removePerson.title": "Supprimer cette personne",
"corpus.metadata.form.name": "Nom",
"article.metadata.issue": "Numéro de revue",
"article.metadata.issue.title": "Titre",
"article.metadata.issue.number": "",
"article.metadata.issue.identifier": "Identifiant",
"corpus.metadata.form.issue": "Numéro de revue",
"corpus.metadata.form.issue.title": "Titre",
"corpus.metadata.form.issue.number": "",
Expand Down
Loading

0 comments on commit a51aab4

Please sign in to comment.