theme.ts 8.9 KB
Newer Older
Maksym Tishchenko's avatar
Maksym Tishchenko committed
1
2
import { createTheme } from '@material-ui/core/styles';
import { ThemeOptions } from '@material-ui/core/styles/createTheme';
3

4
5
const HEADING_FONT_FAMILY = '"Roboto", sans-serif';
const TEXT_FONT_FAMILY = '"Roboto", sans-serif';
Matija Obreza's avatar
Matija Obreza committed
6
// const CODE_FONT_FAMILY = '"JetBrainsMono", "Menlo", "Courier New"';
7

Maksym Tishchenko's avatar
Maksym Tishchenko committed
8
const theme = (dir) => createTheme({
9
10
  direction: dir,
  shape: {
Matija Obreza's avatar
Matija Obreza committed
11
    borderRadius: 0, // No radius on Paper, Card!
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  },
  overrides: {
    MuiFormControl: {
      root: {
        marginTop: '0.71rem', // 10px
        marginBottom: '0.71rem', // 10px
      },
    },
    MuiFormControlLabel: {
      root: {
        'html[dir="ltr"] &' : {
          marginRight: 0,
        },
        'html[dir="rtl"] &' : {
          marginRight: '-14px',
          marginLeft: 0,
        },
      },
    },
    MuiTypography: {
      body2: {
        color: 'initial',
        fontWeight: 'initial',

      },
      h5: {
        color: 'unset',
        fontWeight: 600,
        fontSize: '24px',
      },
    },
Oleksii Savran's avatar
Oleksii Savran committed
43
44
45
46
47
48
49
    // MuiCheckbox: {
    //   colorSecondary: {
    //     '&$checked': {
    //       color: '#88ba42',
    //     },
    //   },
    // },
50
51
52
53
54
55
56
    // MuiRadio: {
    //   colorSecondary: {
    //     '&$checked': {
    //       color: '#88ba42',
    //     },
    //   },
    // },
57
58
59
60
61
62
63
64
65
66
    // MuiSwitch: {
    //   colorSecondary: {
    //     '&$checked': {
    //       'color': '#88ba42',
    //       '& + $bar': {
    //         backgroundColor: '#9ac45e',
    //       },
    //     },
    //   },
    // },
67
68
69
70
71
72
73
74
75
76
77
78
79
    MuiChip: {
      deleteIcon: {
        'html[dir="rtl"] &': {
          marginLeft: '8px',
        },
      },
    },
    MuiFormLabel: {
      root: {
        'fontSize': '1em',
        'color': 'rgba(0, 0, 0, 0.54);',
        'html[dir="rtl"] &': {
          // position: 'relative',
Maksym Tishchenko's avatar
Maksym Tishchenko committed
80
          right: '1.5rem',
81
82
83
84
85
86
87
88
89
90
91
92
93
        },
      },
    },
    MuiMenuItem: {
      root: {
        minHeight: '48px !important',
      },
    },
    MuiPaper: {
      root: {
        color: 'inherit',
      },
    },
94
95
96
97
98
99
100
101
102
    MuiTabs: {
      root: {
        minHeight: '60px',
      },
      scrollButtonsDesktop: {
        '& > svg': {
          color: 'white',
        },
      },
Matija Obreza's avatar
Matija Obreza committed
103
104
105
      indicator: {
        backgroundColor: '#e240a3',
      },
106
107
108
109
110
111
112
113
114
115
116
    },
    MuiTab: {
      root: {
        minHeight: '60px',
      },
      textColorPrimary: {
        'color': 'white',
        '&$selected': {
          color: 'white',
          fontWeight: 700,
        },
117
118
119
        '&$disabled': {
          color: '#696b6e',
        },
120
121
122
123
124
125
126
127
128
129
      },
    },
    PrivateTabIndicator: {
      root: {
        height: '4px',
      },
      colorPrimary: {
        backgroundColor: 'white',
      },
    },
130
131
132
  },
  palette: {
    primary: {
Oleksii Savran's avatar
Oleksii Savran committed
133
134
135
136
      main: '#00396d',
      light: '#41639c',
      dark: '#001441',
      contrastText: '#ffffff',
137
138
    },
    secondary: {
Oleksii Savran's avatar
Oleksii Savran committed
139
140
      main: '#374d66',
      light: '#637994',
Matija Obreza's avatar
Matija Obreza committed
141
      A100: '#d8e3fb',
142
      A200: '#d8d8d8',
Oleksii Savran's avatar
Oleksii Savran committed
143
144
145
      dark: '#0a253b',
      contrastText: '#ffffff',
    },
146
147
148
149
150
151
    backgroundGrey: {
      main: '#3e4043',
      dark: '#181a1c',
      light: '#696b6e',
      contrastText: '#ffffff',
    },
Matija Obreza's avatar
Matija Obreza committed
152
153
154
    backgroundSystemInventory: {
      main: 'rgb(248, 215, 255)',
    },
155
156
157
    menuItem: {
      selected: 'rgba(0, 0, 0, 0.1)'
    },
Maksym Tishchenko's avatar
Maksym Tishchenko committed
158
159
160
    dirtyFieldBackground: {
      main: '#e3eef8',
    },
161
    formBackground: '#d6dae2',
Matija Obreza's avatar
Matija Obreza committed
162
    tonalOffset: 0.2,
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
  },

  arrows: {
    expand: {
      cursor: 'pointer',
      float: 'right',
      position: 'relative',
      right: '15px',
      height: '50px',
    },
    collapse: {
      'cursor': 'pointer',
      'float': 'right',
      'height': '40px',
      'html[dir="rtl"] &' : {
        float: 'left',
      },
    },
    opened: {
      transform: 'rotate(270deg)',
    },
    closed: {
      transform: 'rotate(90deg)',
    },
  },

  buttons: {
    default: {
      fontSize: '0.9286rem',
      fontWeight: '500',
      minWidth: '100px',
      minHeight: 'auto',
      maxHeight: '32px',
      padding: '8px 20px',
    },

    blue: {
      'backgroundColor': '#0b6eb5',
      'color': '#fff',
      'fontSize': '0.9286rem',
      'fontWeight': '500',
      'minWidth': '100px',
      'minHeight': 'auto',
      'maxHeight': '32px',
      'padding': '8px 20px',
      '&:hover': {
        backgroundColor: '#127cbb',
      },
    },

    return: {
      'color': '#0b6eb5',
      'fontSize': '0.9286rem',
      'fontWeight': '500',
      'minHeight': 'auto',
      'maxHeight': '32px',
      '&:hover': {
        background: 'transparent',
      },
    },

    green: {
      'backgroundColor': '#88ba42',
      'color': '#fff',
      'fontSize': '0.9286rem',
      'fontWeight': '500',
      'minWidth': '100px',
      'minHeight': 'auto',
      'maxHeight': '32px',
      'padding': '8px 20px',
      '&:hover': {
        backgroundColor: '#8fc848',
      },
    },
    reset: {
      'float': 'right',
      'color': '#337ab7',
      'textTransform': 'capitalize',
      '&:hover': {
        background: 'transparent',
      },
    },

    edit: {
      'background': '#e8e6e0',
      'fontSize': '0.9286rem',
      'fontWeight': '500',
      'minWidth': '100px',
      'minHeight': 'auto',
      'maxHeight': '32px',
      'padding': '8px 20px',
      '& a': {
        'color': '#2b2924',

        '&:hover': {
          textDecoration: 'none',
        },
      },
    },

    create: {
      '& a': {
        'color': '#000',

        '&:hover': {
          textDecoration: 'none',
        },
      },
    },

    dashboardBigButton: {
      'width': '100%',
      'backgroundColor': '#88ba42',
      'color': '#fff',
      'fontSize': '0.9286rem',
      'fontWeight': '400',
      'minWidth': '100px',
      'minHeight': 'auto',
      'maxHeight': 'auto',
      '&:hover': {
        backgroundColor: '#8fc848',
      },
      '&>span': {
        display: 'inline-block',
        width: '100%',
      },
    },

    headerButton: {
      fontSize: '13px',
      lineHeight: '15px',
      padding: '8px 20px',
      minHeight: 'auto',
    },
  },

  typography: {
    // https://material-ui.com/style/typography/#migration-to-typography-v2
    // Switch to V2
302
303
    // htmlFontSize: 12,
    fontFamily: TEXT_FONT_FAMILY,
304
305
306
307
308
309
310
    fontSize: 14,
    fontWeightLight: 300,
    fontWeightRegular: 400,
    fontWeightMedium: 500,
    display4: {
      fontSize: '3rem',
      fontWeight: 600,
311
      fontFamily: TEXT_FONT_FAMILY,
312
313
314
315
316
317
318
319
      letterSpacing: '0',
      lineHeight: '1.14286em',
      marginLeft: '0',
      color: 'rgba(0, 0, 0, 0.54)',
    },
    display3: {
      fontSize: '14px',
      fontWeight: 400,
320
      fontFamily: TEXT_FONT_FAMILY,
321
322
323
324
325
326
327
328
      lineHeight: '1.5em',
      marginLeft: 0,
      letterSpacing: 0,
      color: 'rgba(0, 0, 0, 0.87)',
    },
    display2: {
      fontSize: '14px',
      fontWeight: 600,
329
      fontFamily: TEXT_FONT_FAMILY,
330
331
332
333
334
335
336
337
      lineHeight: '1.5em',
      marginLeft: 0,
      letterSpacing: 0,
      color: 'rgba(0, 0, 0, 0.87)',
    },
    display1: {
      fontSize: '2.125rem',
      fontWeight: 400,
338
      fontFamily: TEXT_FONT_FAMILY,
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
      lineHeight: '1.20588em',
      marginLeft: '-.04em',
      color: 'rgba(0, 0, 0, 0.54)',
    },
    headline: {
      fontSize: '1.714rem',
      fontWeight: 600,
      fontFamily: HEADING_FONT_FAMILY,
      lineHeight: '1.35417em',
      color: 'inherit',
    },
    title: {
      fontSize: '1.3125rem',
      fontWeight: 600,
      fontFamily: HEADING_FONT_FAMILY,
      lineHeight: '1.875em',
      color: 'rgba(0, 0, 0, 0.87)',
    },
    subheading: {
      fontSize: '1rem',
      fontWeight: 400,
      fontFamily: HEADING_FONT_FAMILY,
      lineHeight: '1.5em',
      color: 'rgba(0, 0, 0, 0.87)',
    },
    body2: {
      fontSize: '0.875rem',
      fontWeight: 500,
367
      fontFamily: TEXT_FONT_FAMILY,
368
369
370
371
372
373
      lineHeight: '1.71429em',
      color: '#006cb4',
    },
    body1: {
      fontSize: '0.875rem',
      fontWeight: 400,
374
      fontFamily: TEXT_FONT_FAMILY,
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
      lineHeight: '1.46429em',
      color: 'rgba(0, 0, 0, 0.87)',
    },
    caption: {
      fontSize: '0.75rem',
      fontWeight: 400,
      fontFamily: HEADING_FONT_FAMILY,
      lineHeight: '1.375em',
      color: 'rgba(0, 0, 0, 0.54)',
    },
  },

  leftPanel: {
    root: {
      zIndex: 1,
      boxShadow: '4px 0px 1px -1px rgba(0, 0, 0, 0.2)',
      backgroundColor: '#fff',
    },
    title: {
      display: 'inline-block',
      textTransform: 'uppercase',
      margin: 0,
      fontSize: '1.3125rem',
      lineHeight: '1.875em',
    },
  },

  table: {
    grayRowsEven: {
      '&:nth-child(even)': {
        '& > div': {
          backgroundColor: '#f8f7f5',
        },
        '& div:first-child': {
          'backgroundColor': '#fff',
          '& > h3': {
            backgroundColor: '#f8f7f5',
          },
        },
      },
    },
    grayRowsOdd: {
      '&:nth-child(odd)': {
        '& > div': {
          backgroundColor: '#f8f7f5',
        },
        '& div:first-child': {
          'backgroundColor': '#fff',
          '& > h3': {
            backgroundColor: '#f8f7f5',
          },
        },
      },
    },
  },

} as ThemeOptions);

export default theme;