Skip to content

Commit 48d6219

Browse files
committed
frontend: tsdocs: Add TSDoc comments to LocaleSelect.tsx
1 parent 452f7c4 commit 48d6219

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

frontend/src/i18n/LocaleSelect/LocaleSelect.tsx

+26-1
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,39 @@ import React from 'react';
77
import { useTranslation } from 'react-i18next';
88
import { supportedLanguages } from '../config';
99

10+
11+
/**
12+
* Interface for the props used by the `LocaleSelect` component, which is responsible for rendering a locale selection UI.
13+
*
14+
* @param {boolean} [showTitle] - Optional flag to control whether the title of the locale selector is displayed. Defaults to `false`.
15+
* @param {boolean} [showFullNames] - Optional flag to control whether to display full language names instead of language codes. Defaults to `false`.
16+
* @param {FormControlProps} [formControlProps] - Optional properties to customize the `FormControl` component used for the locale selection.
17+
*/
1018
export interface LocaleSelectProps {
1119
showTitle?: boolean;
1220
showFullNames?: boolean;
1321
formControlProps?: FormControlProps;
1422
}
1523

1624
/**
17-
* A UI for selecting the locale with i18next
25+
* A component that provides a UI for selecting the locale with `i18next`, allowing users to switch languages in the application.
26+
* It uses Material UI components such as `FormControl`, `Select`, and `MenuItem` to render a dropdown for selecting a language.
27+
*
28+
* @remarks
29+
* This component displays a locale selector with support for showing either the language code or the full language name,
30+
* depending on the `showFullNames` prop. It also listens for language changes via the `i18next` library and updates the UI accordingly.
31+
*
32+
* @param {LocaleSelectProps} props - The properties for the `LocaleSelect` component.
33+
* @param {boolean} [props.showTitle] - Optional flag to show the title of the locale selection. Defaults to `false`.
34+
* @param {boolean} [props.showFullNames] - Optional flag to show the full names of the languages instead of their abbreviations. Defaults to `false`.
35+
* @param {FormControlProps} [props.formControlProps] - Optional props for customizing the `FormControl` component used within the selector.
36+
*
37+
* @returns {ReactNode} A `FormControl` component containing a `Select` dropdown for changing the app's language.
38+
*
39+
* @example
40+
* ```tsx
41+
* <LocaleSelect showTitle={true} showFullNames={true} />
42+
* ```
1843
*/
1944
export default function LocaleSelect(props: LocaleSelectProps) {
2045
const { formControlProps, showFullNames } = props;

0 commit comments

Comments
 (0)