trc-client-core
Version:
The core of the TRC Client
51 lines (34 loc) • 1.28 kB
Markdown
Constants can be one of two types:
Named exports are used to reduce the mistakes caused by mistakes in strings.
If the site is using variations on the name of a constant make sure to standardise to just one.
1. Uppercase.
2. Exports a single string.
3. File name is singular. (trc/constants/Color.js)
```js
export RED = '#FF0000';
export BLUE = '#00FF00';
export GREEN = '#0000FF';
```
Collection constants are used to group things that share one parent type.
Where possible limit the number of custom props.
If the site is using variations on the name of a constant make sure to standardise to just one.
1. Exports a single array through `default`.
2. Each element must be an object.
3. Each object must contain a `value` field.
4. Uppercase is preffered.
5. May contain other custom properties.
6. Filename is pluralized. (trc/constants/DepartmentCategories.js)
```js
export default = [
{value:"tech", label: "Tech"},
{value:"sales", label: "Sales"},
{value:"service", label: "Service"},
{value:"parts", label: "Parts"},
{value:"management", label: "Management"},
{value:"TMCA", label: "TMCA"},
{value:"body_paint", label: "Body & Paint"}
];
```