@vixoniccom/aniversarios 1.2.1 → 1.2.3-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +28 -8
  2. package/build.zip +0 -0
  3. package/configuration.json +35 -6
  4. package/package.json +7 -9
  5. package/src/App.tsx +59 -73
  6. package/src/components/AnniversaryItem/components/AnniversaryDate/CircleDate/index.tsx +31 -0
  7. package/src/components/AnniversaryItem/components/AnniversaryDate/FlatDate/index.tsx +47 -0
  8. package/src/components/{anniversary-item/shared/anniversary-date/outline/OutlineDate.tsx → AnniversaryItem/components/AnniversaryDate/OutlineDate/index.tsx} +7 -25
  9. package/src/components/{anniversary-item/shared/anniversary-date/text-calendar/TextCalendarDate.tsx → AnniversaryItem/components/AnniversaryDate/TextCalendarDate/index.tsx} +7 -16
  10. package/src/components/{anniversary-item/shared/anniversary-date/text/TextDate.tsx → AnniversaryItem/components/AnniversaryDate/TextDate/index.tsx} +2 -12
  11. package/src/components/{anniversary-item/shared/anniversary-date/AnniversaryDate.tsx → AnniversaryItem/components/AnniversaryDate/index.tsx} +7 -11
  12. package/src/components/AnniversaryItem/components/AnniversaryDate/utils.ts +18 -0
  13. package/src/components/{anniversary-item/shared/AnniversaryImage.tsx → AnniversaryItem/components/AnniversaryImage/index.tsx} +11 -19
  14. package/src/components/AnniversaryItem/components/ClassicItem/index.tsx +109 -0
  15. package/src/components/{anniversary-item/shared/separator → AnniversaryItem/components/Separator}/Separator.tsx +3 -6
  16. package/src/components/AnniversaryItem/components/index.ts +11 -0
  17. package/src/components/AnniversaryItem/components/utils.ts +75 -0
  18. package/src/components/AnniversaryItem/index.tsx +17 -0
  19. package/src/components/{FontLoader.tsx → FontLoader/index.tsx} +11 -12
  20. package/src/components/FormattedText/index.tsx +81 -0
  21. package/src/components/{items-container → ItemsContainer/components}/Item.tsx +2 -10
  22. package/src/components/ItemsContainer/components/animation.ts +130 -0
  23. package/src/components/{items-container/ItemsContainer.tsx → ItemsContainer/index.tsx} +54 -61
  24. package/src/components/{Render.tsx → Render/index.tsx} +9 -11
  25. package/src/components/index.ts +13 -0
  26. package/src/context/configureContext/ConfigureContext.tsx +8 -0
  27. package/src/context/configureContext/ConfigureProvider.tsx +72 -0
  28. package/src/context/configureContext/configureReducer.ts +62 -0
  29. package/src/context/dataContext/DataContex.tsx +8 -0
  30. package/src/context/dataContext/DataProvider.tsx +25 -0
  31. package/src/context/dataContext/dataReducer.ts +12 -0
  32. package/src/helpers/filterEmployees.ts +31 -37
  33. package/src/helpers/getEmployees.ts +18 -22
  34. package/src/helpers/utils.ts +44 -50
  35. package/src/main.ts +0 -0
  36. package/src/main.tsx +2 -2
  37. package/src/test/parameters.json +97 -97
  38. package/tsconfig.json +4 -4
  39. package/src/components/FormattedText.tsx +0 -81
  40. package/src/components/anniversary-item/AnniversaryItem.tsx +0 -22
  41. package/src/components/anniversary-item/clasic/ClasicItem.tsx +0 -220
  42. package/src/components/anniversary-item/shared/anniversary-date/DateUtils.ts +0 -33
  43. package/src/components/anniversary-item/shared/anniversary-date/circle/CircleDate.tsx +0 -39
  44. package/src/components/anniversary-item/shared/anniversary-date/flat/FlatDate.tsx +0 -79
  45. package/src/components/anniversary-item/shared/utils.ts +0 -10
  46. package/src/components/items-container/animation.ts +0 -125
  47. package/src/contex/configureContext/ConfigureContext.tsx +0 -8
  48. package/src/contex/configureContext/ConfigureProvider.tsx +0 -77
  49. package/src/contex/configureContext/configureReducer.ts +0 -67
  50. package/src/contex/dataContext/DataContex.tsx +0 -8
  51. package/src/contex/dataContext/DataProvider.tsx +0 -31
  52. package/src/contex/dataContext/dataReducer.ts +0 -19
  53. package/src/helpers/parseMonthAndDay.ts +0 -38
  54. package/src/helpers/setToken.ts +0 -69
  55. package/src/hooks/useFetch.ts +0 -47
  56. package/src/model/income.ts +0 -129
  57. /package/src/components/{anniversary-item/shared → AnniversaryItem/components}/default-profile.png +0 -0
@@ -1,106 +1,106 @@
1
1
  {
2
- "parameters": {
3
- "apiDomain": "https://docs.google.com/spreadsheets/d/1g-tvPAIk7tCXgn6DuwHp3zC8Gmx55C3wyxZkfSK4VcE/edit?usp=sharing",
4
- "msj0": " No ingresos ",
5
- "padding": "365px 25px 80px 40px",
6
- "dataMode": "yearly",
7
- "template": "standard",
8
- "dateStyle": "circle",
9
- "photosZip": {
10
- "id": "d1093778-f3c9-42c8-9b07-9f8736390aeb",
11
- "filename": "d1093778-f3c9-42c8-9b07-9f8736390aeb.zip",
12
- "__isAsset": true,
13
- "extension": "zip"
2
+ "parameters": {
3
+ "apiDomain": "https://docs.google.com/spreadsheets/d/1nxPf6Y97fPubVE9mWhShrWvcXAlndD4x-qSvdjgoIVk/edit?usp=sharing",
4
+ "msj0": "No ingresos",
5
+ "padding": "365px 25px 80px 40px",
6
+ "dataMode": "monthly",
7
+ "template": "standard",
8
+ "dateStyle": "circle",
9
+ "photosZip": {
10
+ "id": "d1093778-f3c9-42c8-9b07-9f8736390aeb",
11
+ "filename": "d1093778-f3c9-42c8-9b07-9f8736390aeb.zip",
12
+ "__isAsset": true,
13
+ "extension": "zip"
14
+ },
15
+ "imageStyle": "circle",
16
+ "nameFormat": {
17
+ "font": {
18
+ "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
19
+ "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
20
+ "__isAsset": true
21
+ },
22
+ "fontSize": 3.8,
23
+ "alignment": {
24
+ "horizontal": "left"
25
+ },
26
+ "fontColor": "#585858"
27
+ },
28
+ "photosMode": "zip",
29
+ "updateTime": 60000,
30
+ "dateEnabled": true,
31
+ "excludePast": false,
32
+ "itemMargins": "5px",
33
+ "orientation": "h",
34
+ "datePosition": 1,
35
+ "imageEnabled": true,
36
+ "textPosition": 3,
37
+ "animationMode": "fade",
38
+ "animationTime": "5",
39
+ "containerRows": "3",
40
+ "dateAlignment": "center",
41
+ "dateDayFormat": {
42
+ "font": {
43
+ "id": "c705a739-312e-4334-9231-e73a05e9d382",
44
+ "filename": "c705a739-312e-4334-9231-e73a05e9d382.ttf",
45
+ "__isAsset": true
14
46
  },
15
- "imageStyle": "circle",
16
- "nameFormat": {
17
- "font": {
18
- "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
19
- "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
20
- "__isAsset": true
21
- },
22
- "fontSize": 3.8,
23
- "alignment": {
24
- "horizontal": "left"
25
- },
26
- "fontColor": "#585858"
47
+ "fontSize": 55,
48
+ "alignment": {
49
+ "horizontal": "center"
27
50
  },
28
- "photosMode": "zip",
29
- "updateTime": 600000,
30
- "dateEnabled": true,
31
- "excludePast": false,
32
- "itemMargins": "5px",
33
- "orientation": "h",
34
- "datePosition": 1,
35
- "imageEnabled": true,
36
- "textPosition": 3,
37
- "animationMode": "fade",
38
- "animationTime": "5",
39
- "containerRows": "3",
40
- "dateAlignment": "center",
41
- "dateDayFormat": {
42
- "font": {
43
- "id": "c705a739-312e-4334-9231-e73a05e9d382",
44
- "filename": "c705a739-312e-4334-9231-e73a05e9d382.ttf",
45
- "__isAsset": true
46
- },
47
- "fontSize": 55,
48
- "alignment": {
49
- "horizontal": "center"
50
- },
51
- "fontColor": "#ffffff"
51
+ "fontColor": "#ffffff"
52
+ },
53
+ "imagePosition": 2,
54
+ "textAlignment": "center",
55
+ "animationOrder": false,
56
+ "animationSpeed": 1.5,
57
+ "imageAlignment": "center",
58
+ "backgroundImage": {
59
+ "id": "cumples",
60
+ "filename": "cumples.png",
61
+ "__isAsset": true
62
+ },
63
+ "dateMonthFormat": {
64
+ "font": {
65
+ "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
66
+ "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
67
+ "__isAsset": true
68
+ },
69
+ "fontSize": 20,
70
+ "alignment": {
71
+ "horizontal": "center"
52
72
  },
53
- "imagePosition": 2,
54
- "textAlignment": "center",
55
- "animationOrder": false,
56
- "animationSpeed": 1.5,
57
- "imageAlignment": "center",
58
- "backgroundImage": {
59
- "id": "cumples",
60
- "filename": "cumples.png",
73
+ "fontColor": "#ffffff"
74
+ },
75
+ "containerColumns": "1",
76
+ "containerRowsGap": "5",
77
+ "datePrimaryColor": "#d13139",
78
+ "abbreviatedMonths": false,
79
+ "descriptionFormat": {
80
+ "font": {
81
+ "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
82
+ "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
61
83
  "__isAsset": true
62
84
  },
63
- "dateMonthFormat": {
64
- "font": {
65
- "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
66
- "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
67
- "__isAsset": true
68
- },
69
- "fontSize": 20,
70
- "alignment": {
71
- "horizontal": "center"
72
- },
73
- "fontColor": "#ffffff"
85
+ "fontSize": 3.8,
86
+ "alignment": {
87
+ "horizontal": "left"
88
+ },
89
+ "fontColor": "#585858"
90
+ },
91
+ "descriptionEnabled": true,
92
+ "optionalEnabled": true,
93
+ "optionalFormat": {
94
+ "font": {
95
+ "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
96
+ "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
97
+ "__isAsset": true
74
98
  },
75
- "containerColumns": "1",
76
- "containerRowsGap": "5",
77
- "datePrimaryColor": "#d13139",
78
- "abbreviatedMonths": false,
79
- "descriptionFormat": {
80
- "font": {
81
- "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
82
- "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
83
- "__isAsset": true
84
- },
85
- "fontSize": 3.8,
86
- "alignment": {
87
- "horizontal": "left"
88
- },
89
- "fontColor": "#585858"
99
+ "fontSize": 3.8,
100
+ "alignment": {
101
+ "horizontal": "left"
90
102
  },
91
- "descriptionEnabled": true,
92
- "optionalEnabled": true,
93
- "optionalFormat": {
94
- "font": {
95
- "id": "7953953c-7029-4730-ae4d-cff4abd5288f",
96
- "filename": "7953953c-7029-4730-ae4d-cff4abd5288f.ttf",
97
- "__isAsset": true
98
- },
99
- "fontSize": 3.8,
100
- "alignment": {
101
- "horizontal": "left"
102
- },
103
- "fontColor": "#585858"
104
- }
103
+ "fontColor": "#585858"
105
104
  }
106
- }
105
+ }
106
+ }
package/tsconfig.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2015",
4
- "module": "es2015",
3
+ "target": "es6",
4
+ "module": "esnext",
5
5
  "moduleResolution": "node",
6
- "jsx": "preserve",
6
+ "jsx": "react-jsx",
7
7
  "allowJs": true,
8
8
  "checkJs": true,
9
9
  "allowSyntheticDefaultImports": true,
@@ -25,4 +25,4 @@
25
25
  },
26
26
  "include": ["./src/**/*"],
27
27
  "exclude": ["./node_modules/**/*"]
28
- }
28
+ }
@@ -1,81 +0,0 @@
1
- import React from 'react'
2
- import { isNumber } from 'lodash'
3
-
4
- const alignments = {
5
- center: 'center',
6
- left: 'flex-start',
7
- right: 'flex-end'
8
- }
9
-
10
- type aligment = {
11
- horizontal: keyof typeof alignments,
12
- vertical: keyof typeof alignments
13
- }
14
-
15
-
16
- interface Props {
17
- format?: any
18
- lineHeight: number
19
- maxChar?: number
20
- style?: number
21
- text: string
22
- unit: string
23
- }
24
- export const FormattedText = ({ text, format, maxChar, lineHeight, style, unit }: Props) => {
25
-
26
- const trimText = (text: any, maxChar: any) => {
27
- const isValid = maxChar && isNumber(maxChar) && maxChar >= 3
28
- if (isValid && (text && text.length > maxChar) || false) {
29
- let returnText = text.substring(0, maxChar - 3)
30
- returnText.substr(-1, 3)
31
- return `${returnText.trim()}...`
32
- }
33
- return text
34
- }
35
-
36
- const checkNested = (obj: any, path: any): any => {
37
- let arr = path.split('.')
38
- if (arr.length > 0) {
39
- if (obj.hasOwnProperty(arr[0])) {
40
- if (arr.length > 1) return checkNested(obj[arr[0]], arr.splice(1).join('.'))
41
- else return true
42
- } else return false
43
- }
44
- }
45
-
46
- const getHorizontalAlignment = (alignment: aligment) => {
47
- if (alignment) {
48
- let hA = alignment.horizontal
49
- return alignments.hasOwnProperty(hA) ? alignments[alignment.horizontal] : 'flex-start'
50
- }
51
- return 'flex-start'
52
- }
53
-
54
- const renderText = maxChar ? trimText(text, maxChar) : text
55
-
56
- let containerStyle = Object.assign({
57
- display: 'inline-flex',
58
- justifyContent: getHorizontalAlignment(format.alignment)
59
- }, style)
60
-
61
- return (
62
- <div style={containerStyle}>
63
- <span style={{
64
- color: format.fontColor,
65
- fontFamily: checkNested(format, 'font.filename') ? `"${format.font.filename.replace('.', '-')}"` : '',
66
- fontSize: `${format.fontSize}${unit}`,
67
- textAlign: checkNested(format, 'alignment.horizontal') ? format.alignment.horizontal : 'left',
68
- lineHeight: lineHeight
69
- }}>{renderText}</span>
70
- </div>
71
- )
72
- }
73
-
74
-
75
-
76
- FormattedText.defaultProps = {
77
- format: {},
78
- lineHeight: 1,
79
- unit: 'vh',
80
- maxChar: undefined
81
- }
@@ -1,22 +0,0 @@
1
- import React from 'react'
2
- import { ClasicItem } from './clasic/ClasicItem'
3
-
4
- const itemStyles = {
5
- standard: ClasicItem
6
- }
7
-
8
- interface Props {
9
- style: string,
10
- anniversary: DataEmployee
11
- }
12
-
13
- export const AnniversaryItem = ({ style, anniversary }: Props) => {
14
-
15
- // let StyledItem = itemStyles.hasOwnProperty(this.props.style) ? itemStyles['circle'] : itemStyles.standard
16
- let StyledItem = itemStyles.hasOwnProperty(style) ? itemStyles['standard'] : itemStyles.standard
17
-
18
- return <StyledItem anniversary={anniversary} />
19
-
20
- }
21
-
22
-
@@ -1,220 +0,0 @@
1
- import React, { useContext, useEffect, useRef, useState } from "react";
2
- import { AnniversaryImage } from "../shared/AnniversaryImage";
3
- import { Separator } from "../shared/separator/Separator";
4
- import { AnniversaryDate } from "../shared/anniversary-date/AnniversaryDate";
5
- import { FormattedText } from "../../FormattedText";
6
- import { ConfigureContext } from "../../../contex/configureContext/ConfigureContext";
7
-
8
- interface Props {
9
- anniversary: DataEmployee;
10
- }
11
-
12
- export const ClasicItem = ({ anniversary }: Props) => {
13
- const { configureState } = useContext(ConfigureContext);
14
- const { parameters, downloadsPath } = configureState;
15
-
16
- const { orientation, separatorColor, separatorWidth, imageSize } = parameters;
17
- const cont = useRef(null);
18
-
19
- const parseBorderMargin = (marginString: any) => {
20
- let pattern = /(( )?[+-]?[0-9]+.?([0-9]+)?(px|em|ex|%|in|cm|mm|pt|pc))?/g;
21
- let match = marginString ? marginString.match(pattern) : [""];
22
- switch (match.length) {
23
- case 1:
24
- return { r: "4%", l: "4%" };
25
- case 2:
26
- return { r: match[0], l: match[0] };
27
- default:
28
- return { r: match[0], l: match[1] };
29
- }
30
- };
31
-
32
- const parseElementStyles = (
33
- margin: string,
34
- position: number,
35
- defaultPosition: number,
36
- parameters: VixonicParameters
37
- ) => {
38
- const { orientation, separator } = parameters;
39
- const marginAttr = orientation === "v" ? "marginBottom" : "marginRight";
40
- const sizeAttr = orientation === "v" ? "width" : "height";
41
- let pos = position !== undefined ? position : defaultPosition;
42
- return {
43
- order: pos,
44
- [sizeAttr]: "100%",
45
- [marginAttr]:
46
- margin !== undefined && margin !== ""
47
- ? `${margin}%`
48
- : pos === 3 || separator === true
49
- ? 0
50
- : "4%",
51
- };
52
- };
53
-
54
- const parseParameters = (parameters: any) => {
55
- const imageAlignment = parameters.imageAlignment || "center";
56
- const textAlignment = parameters.textAlignment || "center";
57
- const dateAlignment = parameters.dateAlignment || "center";
58
-
59
- return {
60
- imageEnabled: parameters.imageEnabled,
61
- imageStyle: Object.assign(
62
- {
63
- flexShrink: 0,
64
- display: "flex",
65
- justifyContent: imageAlignment,
66
- alignItems: imageAlignment,
67
- },
68
- parseElementStyles(
69
- parameters.imageMargin,
70
- parameters.imagePosition,
71
- 1,
72
- parameters
73
- )
74
- ),
75
- descriptionEnabled: parameters.descriptionEnabled,
76
- optionalEnabled: parameters.optionalEnabled,
77
- textStyle: Object.assign(
78
- { display: "flex", justifyContent: textAlignment, flex: 1 },
79
- parseElementStyles(
80
- parameters.textMargin,
81
- parameters.textPosition,
82
- 2,
83
- parameters
84
- )
85
- ),
86
- dateEnabled: parameters.dateEnabled,
87
- dateStyle: Object.assign(
88
- {
89
- display: "flex",
90
- justifyContent: dateAlignment,
91
- alignItems: dateAlignment,
92
- flexShrink: 0,
93
- },
94
- parseElementStyles(
95
- parameters.dateMargin,
96
- parameters.datePosition,
97
- 3,
98
- parameters
99
- )
100
- ),
101
- };
102
- };
103
-
104
- const [margins, setMargins] = useState(
105
- parseBorderMargin(parameters.itemMargins)
106
- );
107
- const [state, setState] = useState(
108
- Object.assign({}, parseParameters(parameters))
109
- );
110
-
111
- useEffect(() => {
112
- setMargins(parseBorderMargin(parameters.itemMargins));
113
- setState(Object.assign({}, parseParameters(parameters)));
114
- }, []);
115
-
116
- const getPhotoUrl = (filename: string) => {
117
- let mode = parameters.photosMode;
118
- if (
119
- mode === "zip" &&
120
- parameters.photosZip &&
121
- parameters.photosZip.filename !== undefined
122
- ) {
123
- return (
124
- downloadsPath +
125
- "/" +
126
- parameters.photosZip.filename.replace(".zip", "/") +
127
- filename
128
- );
129
- } else {
130
- return filename; //this.props.parameters.photosUrl + filename
131
- }
132
- };
133
-
134
- const separatorProps = {
135
- orientation: orientation,
136
- size: separatorWidth,
137
- color: separatorColor,
138
- margins:
139
- orientation === "v"
140
- ? `${margins.r} 0 ${margins.l} 0`
141
- : `0 ${margins.r} 0 ${margins.l}`,
142
- };
143
-
144
- return (
145
- <div
146
- style={{
147
- display: "flex",
148
- flexDirection: orientation === "v" ? "column" : "row",
149
- backgroundColor: "transparent",
150
- overflow: "hidden",
151
- alignItems: "center",
152
- height: "100%",
153
- width: "100%",
154
- }}
155
- ref={cont}
156
- >
157
- {state.imageEnabled && parameters.imageStyle && (
158
- <div style={state.imageStyle}>
159
- {
160
- <AnniversaryImage
161
- url={anniversary.image ? getPhotoUrl(anniversary.image) : null}
162
- orientation={orientation}
163
- size={imageSize}
164
- borderStyle={parameters.imageStyle}
165
- />
166
- }
167
- </div>
168
- )}
169
- {state.imageEnabled && parameters.separator && (
170
- <Separator order={state.imageStyle.order} {...separatorProps} />
171
- )}
172
- <div
173
- style={{
174
- ...state.textStyle,
175
- flexDirection: "column",
176
- }}
177
- >
178
- <FormattedText
179
- text={anniversary.name}
180
- format={parameters.nameFormat}
181
- maxChar={Number(parameters.nameMaxChar)}
182
- lineHeight={1.2}
183
- />
184
- {state.descriptionEnabled && (
185
- <FormattedText
186
- text={anniversary.position}
187
- format={parameters.descriptionFormat}
188
- maxChar={Number(parameters.descriptionMaxChar)}
189
- lineHeight={1.2}
190
- />
191
- )}
192
- {
193
- state.optionalEnabled && (
194
- <FormattedText
195
- text={anniversary.optional}
196
- format={parameters.optionalFormat}
197
- maxChar={Number(parameters.descriptionMaxChar)}
198
- lineHeight={1.2}
199
- />
200
- )
201
- }
202
- </div>
203
- {parameters.separator && (
204
- <Separator order={state.textStyle.order} {...separatorProps} />
205
- )}
206
- {state.dateEnabled && parameters.dateStyle && (
207
- <div style={state.dateStyle}>
208
- <AnniversaryDate
209
- style={parameters.dateStyle}
210
- day={anniversary.day}
211
- month={anniversary.month}
212
- />
213
- </div>
214
- )}
215
- {state.dateEnabled && parameters.separator && (
216
- <Separator order={state.dateStyle.order} {...separatorProps} />
217
- )}
218
- </div>
219
- );
220
- };
@@ -1,33 +0,0 @@
1
- import PropTypes from 'prop-types'
2
- import { utils } from '../utils';
3
-
4
- const Months = ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre']
5
-
6
- export class AnniveraryDateUtil {
7
-
8
- static getZeroLeadedText(text:any) {
9
- return `0${text}`.slice(-2)
10
- }
11
-
12
- static getMonth(index:any, abbreviated:any) {
13
- if (!abbreviated) return Months[index]
14
- return Months[index].substring(0, 3).toUpperCase()
15
- }
16
-
17
- static utils(orientation:any, size :any = undefined) {
18
- return utils(orientation, size)
19
- }
20
-
21
- static commonPropTypes() {
22
- return {
23
- day: PropTypes.number.isRequired,
24
- dayFormat: PropTypes.object,
25
- month: PropTypes.number.isRequired,
26
- monthFormat: PropTypes.object,
27
- primaryColor: PropTypes.string,
28
- abbreviatedMonths: PropTypes.bool,
29
- orientation: PropTypes.string
30
- }
31
- }
32
- }
33
-
@@ -1,39 +0,0 @@
1
- import React, { useContext } from 'react'
2
- import { AnniveraryDateUtil } from '../DateUtils'
3
- import { FormattedText } from '../../../../FormattedText'
4
- import { ConfigureContext } from '../../../../../contex/configureContext/ConfigureContext'
5
-
6
- interface Props {
7
- day: number,
8
- month: number
9
- }
10
-
11
- export const CircleDate = ({ day, month }: Props) => {
12
-
13
-
14
- const { configureState } = useContext(ConfigureContext)
15
- const { orientation, dateMonthFormat, datePrimaryColor, dateDayFormat } = configureState.parameters
16
- const sizeProp = AnniveraryDateUtil.utils(orientation)
17
-
18
- let monthSize = (dateMonthFormat && dateMonthFormat.fontSize || 100) * 400 / 100
19
- let daySize = (dateDayFormat && dateDayFormat.fontSize || 100) * 400 / 100
20
-
21
- return (
22
- <svg {...sizeProp} viewBox='0 0 400 400' xmlSpace='preserve'>
23
- <g>
24
- <circle fill={datePrimaryColor} cx='200' cy='200' r='200' />
25
- <foreignObject width='400' height='400'>
26
- {/* <div xmlns='http://www.w3.org/1999/xhtml' style={{ height: 400, width: 400, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}> */}
27
- <div style={{ height: 400, width: 400, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center' }}>
28
- <FormattedText text={AnniveraryDateUtil.getMonth(month, true)} format={Object.assign({}, dateMonthFormat, { fontSize: monthSize })} unit='px' />
29
- <FormattedText text={AnniveraryDateUtil.getZeroLeadedText(day)} format={Object.assign({}, dateDayFormat, { fontSize: daySize })} unit='px' />
30
- </div>
31
- </foreignObject>
32
- </g>
33
- </svg>
34
- )
35
- }
36
-
37
-
38
- CircleDate.propTypes = AnniveraryDateUtil.commonPropTypes()
39
-