11import type { IterableEmbeddedViewConfig } from '../../classes/IterableEmbeddedViewConfig' ;
2- import {
3- defaultBorderWidth ,
4- defaultBorderCornerRadius ,
5- embeddedColors ,
6- } from '../../constants/embeddedViewDefaults' ;
2+ import { embeddedStyles } from '../../constants/embeddedViewDefaults' ;
73import type { IterableEmbeddedViewType } from '../../enums/IterableEmbeddedViewType' ;
8- import { getDefaultColor } from './getDefaultColor ' ;
4+ import { getDefaultStyle } from './getDefaultStyle ' ;
95
106export const getStyles = (
117 viewType : IterableEmbeddedViewType ,
@@ -14,61 +10,29 @@ export const getStyles = (
1410 return {
1511 backgroundColor :
1612 c ?. backgroundColor ??
17- getDefaultColor ( viewType , {
18- banner : embeddedColors . background . banner ,
19- card : embeddedColors . background . card ,
20- notification : embeddedColors . background . notification ,
21- } ) ,
13+ getDefaultStyle ( viewType , embeddedStyles . background ) ,
2214 borderColor :
23- c ?. borderColor ??
24- getDefaultColor ( viewType , {
25- banner : embeddedColors . border . banner ,
26- card : embeddedColors . border . card ,
27- notification : embeddedColors . border . notification ,
28- } ) ,
29- borderWidth : c ?. borderWidth ?? defaultBorderWidth ,
30- borderCornerRadius : c ?. borderCornerRadius ?? defaultBorderCornerRadius ,
15+ c ?. borderColor ?? getDefaultStyle ( viewType , embeddedStyles . border ) ,
16+ borderWidth :
17+ c ?. borderWidth ?? getDefaultStyle ( viewType , embeddedStyles . borderWidth ) ,
18+ borderCornerRadius :
19+ c ?. borderCornerRadius ??
20+ getDefaultStyle ( viewType , embeddedStyles . borderRadius ) ,
3121 primaryBtnBackgroundColor :
3222 c ?. primaryBtnBackgroundColor ??
33- getDefaultColor ( viewType , {
34- banner : embeddedColors . primaryBtnBackground . banner ,
35- card : embeddedColors . primaryBtnBackground . card ,
36- notification : embeddedColors . primaryBtnBackground . notification ,
37- } ) ,
23+ getDefaultStyle ( viewType , embeddedStyles . primaryBtnBackground ) ,
3824 primaryBtnTextColor :
3925 c ?. primaryBtnTextColor ??
40- getDefaultColor ( viewType , {
41- banner : embeddedColors . primaryBtnText . banner ,
42- card : embeddedColors . primaryBtnText . card ,
43- notification : embeddedColors . primaryBtnText . notification ,
44- } ) ,
26+ getDefaultStyle ( viewType , embeddedStyles . primaryBtnText ) ,
4527 secondaryBtnBackgroundColor :
4628 c ?. secondaryBtnBackgroundColor ??
47- getDefaultColor ( viewType , {
48- banner : embeddedColors . secondaryBtnBackground . banner ,
49- card : embeddedColors . secondaryBtnBackground . card ,
50- notification : embeddedColors . secondaryBtnBackground . notification ,
51- } ) ,
29+ getDefaultStyle ( viewType , embeddedStyles . secondaryBtnBackground ) ,
5230 secondaryBtnTextColor :
5331 c ?. secondaryBtnTextColor ??
54- getDefaultColor ( viewType , {
55- banner : embeddedColors . secondaryBtnText . banner ,
56- card : embeddedColors . secondaryBtnText . card ,
57- notification : embeddedColors . secondaryBtnText . notification ,
58- } ) ,
32+ getDefaultStyle ( viewType , embeddedStyles . secondaryBtnText ) ,
5933 titleTextColor :
60- c ?. titleTextColor ??
61- getDefaultColor ( viewType , {
62- banner : embeddedColors . titleText . banner ,
63- card : embeddedColors . titleText . card ,
64- notification : embeddedColors . titleText . notification ,
65- } ) ,
34+ c ?. titleTextColor ?? getDefaultStyle ( viewType , embeddedStyles . titleText ) ,
6635 bodyTextColor :
67- c ?. bodyTextColor ??
68- getDefaultColor ( viewType , {
69- banner : embeddedColors . bodyText . banner ,
70- card : embeddedColors . bodyText . card ,
71- notification : embeddedColors . bodyText . notification ,
72- } ) ,
36+ c ?. bodyTextColor ?? getDefaultStyle ( viewType , embeddedStyles . bodyText ) ,
7337 } ;
7438} ;
0 commit comments