mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-04-12 02:02:31 +02:00
(ui) add tooltip to FormInput
+ add tooltip for auth_provider/mappings/API field input
This commit is contained in:
parent
370a443502
commit
073b0c8eae
@ -10,6 +10,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { FabButton } from '../base/fab-button';
|
import { FabButton } from '../base/fab-button';
|
||||||
import { TypeMappingModal } from './type-mapping-modal';
|
import { TypeMappingModal } from './type-mapping-modal';
|
||||||
import { useImmer } from 'use-immer';
|
import { useImmer } from 'use-immer';
|
||||||
|
import { HtmlTranslate } from '../base/html-translate';
|
||||||
|
|
||||||
export interface DataMappingFormProps<TFieldValues, TContext extends object> {
|
export interface DataMappingFormProps<TFieldValues, TContext extends object> {
|
||||||
register: UseFormRegister<TFieldValues>,
|
register: UseFormRegister<TFieldValues>,
|
||||||
@ -136,6 +137,7 @@ export const DataMappingForm = <TFieldValues extends FieldValues, TContext exten
|
|||||||
register={register}
|
register={register}
|
||||||
rules={{ required: true }}
|
rules={{ required: true }}
|
||||||
placeholder="field_name..."
|
placeholder="field_name..."
|
||||||
|
tooltip={<HtmlTranslate trKey="app.shared.oauth2.api_field_help_html" />}
|
||||||
label={t('app.shared.oauth2.api_fields')} />
|
label={t('app.shared.oauth2.api_fields')} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,7 @@ import { FormComponent } from '../../models/form-component';
|
|||||||
interface FormInputProps<TFieldValues> extends InputHTMLAttributes<HTMLInputElement>, FormComponent<TFieldValues>{
|
interface FormInputProps<TFieldValues> extends InputHTMLAttributes<HTMLInputElement>, FormComponent<TFieldValues>{
|
||||||
id: string,
|
id: string,
|
||||||
label?: string,
|
label?: string,
|
||||||
tooltip?: string,
|
tooltip?: ReactNode,
|
||||||
icon?: ReactNode,
|
icon?: ReactNode,
|
||||||
addOn?: ReactNode,
|
addOn?: ReactNode,
|
||||||
addOnClassName?: string,
|
addOnClassName?: string,
|
||||||
@ -30,8 +30,10 @@ export const FormInput = <TFieldValues extends FieldValues>({ id, register, labe
|
|||||||
<label className={classNames}>
|
<label className={classNames}>
|
||||||
{label && <div className='form-item-header'>
|
{label && <div className='form-item-header'>
|
||||||
<p>{label}</p>
|
<p>{label}</p>
|
||||||
{/* TODO: Create tooltip component */}
|
{tooltip && <div className="item-tooltip">
|
||||||
{tooltip && <span>{tooltip}</span>}
|
<span className="trigger"><i className="fa fa-question-circle" /></span>
|
||||||
|
<div className="content">{tooltip}</div>
|
||||||
|
</div>}
|
||||||
</div>}
|
</div>}
|
||||||
<div className='form-item-field'>
|
<div className='form-item-field'>
|
||||||
{icon && <span className="icon">{icon}</span>}
|
{icon && <span className="icon">{icon}</span>}
|
||||||
|
@ -8,10 +8,39 @@
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
margin-bottom: 0.8rem;
|
margin-bottom: 0.8rem;
|
||||||
|
position: relative;
|
||||||
p {
|
p {
|
||||||
@include text-sm;
|
@include text-sm;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.item-tooltip {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
.trigger {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
&:hover + .content {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
background-color: black;
|
||||||
|
color: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 1rem;
|
||||||
|
font-size: 12px;
|
||||||
|
width: auto;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&.is-hidden {
|
&.is-hidden {
|
||||||
display: none;
|
display: none;
|
||||||
|
@ -297,7 +297,7 @@ en:
|
|||||||
api_endpoint_url: "API endpoint URL"
|
api_endpoint_url: "API endpoint URL"
|
||||||
api_type: "API type"
|
api_type: "API type"
|
||||||
api_fields: "API fields"
|
api_fields: "API fields"
|
||||||
api_field_help: "JsonPath syntax is supported.\n If many fields are selected, the first one will be used.\n Example: $.data[*].name"
|
api_field_help_html: '<a href="https://jsonpath.com/" target="_blank">JsonPath</a> syntax is supported.<br> If many fields are selected, the first one will be used.<br> Example: $.data[*].name"'
|
||||||
#machine/training slot modification modal
|
#machine/training slot modification modal
|
||||||
confirm_modify_slot_modal:
|
confirm_modify_slot_modal:
|
||||||
change_the_slot: "Change the slot"
|
change_the_slot: "Change the slot"
|
||||||
|
@ -275,7 +275,7 @@ fr:
|
|||||||
api_endpoint_url: "Point d'accès/URL de l'API"
|
api_endpoint_url: "Point d'accès/URL de l'API"
|
||||||
api_type: "Type d'API"
|
api_type: "Type d'API"
|
||||||
api_fields: "Champ de l'API"
|
api_fields: "Champ de l'API"
|
||||||
api_field_help: "La syntaxe JsonPath est prise en charge.\n Si plusieurs champs sont sélectionnés, le premier sera utilisé.\n Exemple : $.data[*].name"
|
api_field_help_html: '<p>La syntaxe <a href="https://jsonpath.com/" target="_blank">JsonPath</a> est prise en charge.\n Si plusieurs champs sont sélectionnés, le premier sera utilisé.\n Exemple : $.data[*].name</p>'
|
||||||
#machine/training slot modification modal
|
#machine/training slot modification modal
|
||||||
confirm_modify_slot_modal:
|
confirm_modify_slot_modal:
|
||||||
change_the_slot: "Modifier le créneau"
|
change_the_slot: "Modifier le créneau"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user