Skip to main content

Globals

The globals is an object that has general data that can be used in the entire application.

Usage#

import Globals from 'mongez/globals';
console.log(Globals.direction); // ltr

Available Properties

The Globals object has the following properties, these properties values are changed dynamically and automatically.

PropertyDefault ValueDescription
directionBsed on the value of REACT_APP_DIRECTION in .env file, if not defined its ltrGet the current application direction.
localeCodeBased on the value of REACT_APP_LOCALE_CODE in .env file, if not defined its enGet the current application locale Code.
leftleftIf the current direction is ltr, then its value will be left, if the direction is rtl, then the value will be right.
rightrightIf the current direction is ltr, then its value will be right, if the direction is rtl, then the value will be left.
marginLeftmargin-leftGet the value of margin left, will be right if the direction is rtl
marginRightmargin-rightGet the value of margin right, will be left if the direction is rtl
paddingLeftpadding-leftGet the value of padding left, will be right if the direction is rtl
paddingRightpadding-rightGet the value of padding right, will be left if the direction is rtl

The entire list is:

left: left,right: right,direction: direction,marginLeft: `margin-${left}`,marginRight: `margin-${right}`,paddingLeft: `padding-${left}`,paddingRight: `padding-${right}`,localeCode: localeCode,