Language selector
Installation
- yarn
- pnpm
- npm
yarn add @mercell/language-selector-react
pnpm add @mercell/language-selector-react
npm install --save @mercell/language-selector-react
The LanguageSelector has necessary peerDependencies, please make sure that you have them in your project
"@carbon/icons-react": "^10.49.0",
"@mercell/tailwind": "^6.0.1",
"classnames": "^2.3.1",
"react": "^17.0.2"
Usage
Using the Language Selector component is as simple as importing it like this.
import { LanguageSelector, Country } from '@mercell/language-selector-react';
The Language Selector Component is intended to be used as a child of the GlobalMenu component.
Types, definitions, etc.
- Types
- Changelog
- Figma
LanguageSelectorProps
interface LanguageSelectorProps {
localeLng: string;
countries: Country[];
label: string;
id: string;
onClick: (locale: string) => void;
trackingAction?: TrackingActionType;
additionalTrackingParams?: Record<string, string | string[]>;
} & Omit<JSX.IntrinsicElements['nav'], 'onClick>'
Name | Type | Default | Required | Description |
---|---|---|---|---|
localeLng | string | - | yes | locale (e.g., en-GB) |
countries | Country[] | - | yes | Country is defined below |
label | string | - | yes | aria-label |
id | string | - | yes | necessary for aria-controls |
onClick | function | - | yes | function for onClick |
trackingAction | TrackingActionType | (_trackingEventType: string, _trackingProperties: Record<string, string | string[]>, defaultAction?: any ) => (e: any) => defaultAction(e), | no | Method passed from context tracking hook to establish event tracking |
additionalTrackingParams | Record<string, string|string[]> | {} | no | Any additional tracking properties which will be passed to all events |
Country
interface Country {
name: string;
language: string;
domain: string;
locale: string;
phonePrefix: string;
}
Name | Type | Default | Required | Description |
---|---|---|---|---|
name | string | - | yes | country name (e.g.,Great Britain) |
language | string | - | yes | language name (e.g., English) |
domain | string | - | yes | language code ISO 639-1 (e.g., gb) |
locale | string | - | yes | locale (e.g., en-GB) |
phonePrefix | string | - | yes | phone prefix (e.g., +44) |
Change Log - @mercell/language-selector-react
This log was last generated on Mon, 06 Feb 2023 12:33:55 GMT and should not be manually modified.
3.0.1
Mon, 06 Feb 2023 12:33:55 GMT
Patches
- Fix key prop from domain to name_domain
3.0.0
Fri, 11 Nov 2022 09:18:57 GMT
Breaking changes
- New styling approach - use only tailwind classes, add tailwind-merge library
2.0.0
Thu, 15 Sep 2022 06:07:41 GMT
Breaking changes
- Migration to Tailwind3, React 18 and ViteJS from webpack.
1.0.15
Thu, 30 Jun 2022 10:57:49 GMT
Patches
- Package.json refactor, add test suite, more tests soon
1.0.14
Wed, 22 Jun 2022 08:30:02 GMT
Version update only
1.0.13
Wed, 15 Jun 2022 15:57:11 GMT
Patches
- Update example in dev folder
1.0.12
Wed, 15 Jun 2022 15:28:54 GMT
Patches
- Manual package bump - tracking action update
1.0.11
Wed, 15 Jun 2022 15:10:09 GMT
Patches
- Add updated version of tracking PoC to the component
1.0.10
Mon, 13 Jun 2022 09:20:15 GMT
Patches
- Add tracking PoC to the component
1.0.9
Tue, 03 May 2022 10:38:35 GMT
Patches
- Update regarding new dropdown-menu
1.0.8
Fri, 08 Apr 2022 10:19:50 GMT
Patches
- Bump dependencies
1.0.7
Tue, 05 Apr 2022 09:01:16 GMT
Patches
- lng button -fixed focus/clickable area"
1.0.6
Mon, 28 Feb 2022 12:45:49 GMT
Patches
- Dependency update
1.0.5
Mon, 28 Feb 2022 10:55:32 GMT
Patches
- Bump typescript
1.0.4
Wed, 26 Jan 2022 16:19:19 GMT
Patches
- Move dependencies to peerDependencies to avoid duplication in installation process in project
- Adding the same peerDependencies to devDependencies
1.0.3
Fri, 21 Jan 2022 13:08:25 GMT
Patches
- Package json updat
1.0.2
Tue, 18 Jan 2022 14:33:13 GMT
Patches
- Breakpoints adjustment
1.0.1
Wed, 05 Jan 2022 13:06:22 GMT
Patches
- adjusted styling
1.0.0
Wed, 15 Dec 2021 22:20:34 GMT
Breaking changes
- Update to match figma design
0.0.3
Thu, 18 Nov 2021 14:00:43 GMT
Patches
- Deps update of tailwind
0.0.2
Mon, 15 Nov 2021 16:08:43 GMT
Patches
- Language selector(global menu compatible)
No figma currently available.