1
- import React from 'react '
2
- import { Box , Grid , Modal , Typography , useMediaQuery , useTheme } from '@mui/material'
1
+ import { ArrowBackIosNewRounded , CloseRounded } from '@mui/icons-material '
2
+ import { Box , Button , Grid , Modal , Typography } from '@mui/material'
3
3
import { useTranslation } from 'react-i18next'
4
+ import styled from 'styled-components'
5
+
4
6
interface DonateModalProps {
5
7
isVisible : boolean
6
8
onClose : ( ) => void
@@ -12,88 +14,129 @@ const boxStyle = {
12
14
left : '50%' ,
13
15
transform : 'translate(-50%, -50%)' ,
14
16
maxWidth : '1250px' ,
15
- maxHeight : 'calc(100vh - 210px)' ,
16
- overflowY : 'auto' ,
17
17
width : '80%' ,
18
18
bgcolor : 'background.paper' ,
19
+ outline : 'none' ,
20
+ border : '1px solid #ccc' ,
19
21
boxShadow : 24 ,
20
- p : 4 ,
22
+ borderRadius : '8px' ,
21
23
} as const
22
24
23
- export const DonateModal : React . FC < DonateModalProps > = ( { isVisible, onClose } ) => {
24
- /**
25
- * @description This hook is used to determine if the image should collapse or not based on if the user is a mobile, tablet user or not.
26
- */
27
- const shouldImgCollapse = useMediaQuery ( '(max-width: 950px)' )
28
- const { t } = useTranslation ( )
29
- const { direction } = useTheme ( )
25
+ const ButtonDonate = styled . a `
26
+ margin-top: 16px;
27
+ outline: none;
28
+ direction: rtl;
29
+ display: inline-flex;
30
+ align-items: stretch;
31
+ color: white;
32
+ flex-wrap: nowrap;
33
+ text-decoration: none;
34
+ font-weight: bold;
35
+ width: 100%;
36
+ max-width: 420px;
37
+ border-radius: 1000px;
38
+ overflow: hidden;
39
+ transition: ease box-shadow 0.25s;
40
+ box-shadow: transparent 0 0 0 0;
41
+ &:focus {
42
+ box-shadow: #1498e588 0 0 0 3px;
43
+ }
44
+ `
45
+ const ButtonDonateText = styled . span `
46
+ background-color: #16a9ff;
47
+ padding: 8px 32px 8px 8px;
48
+ text-align: center;
49
+ font-size: 32px;
50
+ width: 100%;
51
+ `
52
+
53
+ const ButtonDonateIcon = styled . span `
54
+ padding: 16px;
55
+ width: 32px;
56
+ min-height: 32px;
57
+ display: flex;
58
+ justify-content: center;
59
+ align-items: center;
60
+ background-color: #1498e5;
61
+ `
30
62
31
- // Use Image with Hebrew text for RTL and English text for LTR
32
- const donateNowImageUrlEN =
33
- 'https://www.hasadna.org.il/wp-content/uploads/2018/08/button-300x73.png'
34
- const donateNowImageUrlHE =
35
- 'https://www.hasadna.org.il/wp-content/uploads/2018/08/button-EN-300x73.png'
63
+ const DonateModal = ( { isVisible, onClose } : DonateModalProps ) => {
64
+ const { t } = useTranslation ( )
36
65
37
66
return (
38
67
< Modal
39
- dir = { direction }
40
68
open = { isVisible }
41
69
onClose = { onClose }
42
70
aria-modal = "true"
43
71
role = "dialog"
44
72
aria-labelledby = "modal-modal-title"
45
73
aria-describedby = "modal-modal-description"
46
- sx = { {
47
- textAlign : `${ direction === 'ltr' ? 'right' : 'left' } ` as const ,
48
- color : 'text.primary' , // Dynamically uses the theme’s text color
49
- } } >
50
- < Box dir = { direction } sx = { boxStyle } >
51
- < button onClick = { onClose } className = "close-modal-icon" >
52
- X
53
- </ button >
54
- < Typography id = "modal-modal-title" variant = "h6" component = "h2" >
55
- { t ( 'how_to_donate_title' ) }
74
+ sx = { { color : 'text.primary' } } >
75
+ < Box sx = { boxStyle } >
76
+ < Typography
77
+ component = "div"
78
+ display = "flex"
79
+ justifyContent = "space-between"
80
+ alignItems = "start"
81
+ padding = { 2 }
82
+ paddingBottom = { 0 } >
83
+ < h1 id = "modal-modal-title" style = { { margin : 0 } } >
84
+ { t ( 'how_to_donate_title' ) }
85
+ </ h1 >
86
+ < Button
87
+ color = "inherit"
88
+ sx = { { borderRadius : 1000 , minWidth : 32 , width : 32 , height : 32 , padding : '4px' } }
89
+ onClick = { onClose } >
90
+ < CloseRounded sx = { { height : '100%' , width : '100%' } } />
91
+ </ Button >
56
92
</ Typography >
57
- < p > { t ( 'how_to_donate_text' ) } </ p >
58
- < Grid container spacing = { 2 } direction = { shouldImgCollapse ? 'column-reverse' : 'row' } >
59
- < Grid size = { { xs : 6 } } >
60
- < Typography id = "modal-modal-description" sx = { { mt : 2 } } >
61
- < h2 > { t ( 'donate_through_jgive.com_title' ) } </ h2 >
93
+ < Box padding = { 2 } overflow = "auto" maxHeight = "calc(100vh - 210px)" >
94
+ < p style = { { margin : 0 } } > { t ( 'how_to_donate_text' ) } </ p >
95
+ < Grid container spacing = { 2 } >
96
+ < Grid size = { { xs : 12 , md : 6 } } >
97
+ < Typography component = "div" id = "modal-modal-description" >
98
+ < h2 > { t ( 'donate_through_jgive.com_title' ) } </ h2 >
99
+ </ Typography >
62
100
< a
63
101
href = "https://www.jgive.com/new/he/ils/donation-targets/3268"
64
102
target = "_blank"
65
- rel = "noreferrer" >
103
+ rel = "noreferrer"
104
+ style = { { textDecoration : 'none' , color : 'inherit' , outline : 'none' } } >
66
105
< img
67
106
src = "https://www.hasadna.org.il/wp-content/uploads/2017/12/%D7%AA%D7%A8%D7%95%D7%9E%D7%95%D7%AA.jpg"
68
107
alt = { t ( 'donation_link' ) }
69
- width = { '90%' }
70
- style = { { maxWidth : '420px' } }
71
- />
72
- < img
73
- width = { '90%' }
74
- src = { direction === 'rtl' ? donateNowImageUrlEN : donateNowImageUrlHE }
75
- alt = { t ( 'donate_to_hasadna' ) }
76
- // style={{ margin: shouldImgCollapse ? 'auto' : '', display: 'block' }}
77
- style = { { display : 'block' , maxWidth : '300px' } }
108
+ width = "100%"
109
+ style = { { maxWidth : '420px' , borderRadius : 8 } }
78
110
/>
79
111
</ a >
80
- </ Typography >
81
- </ Grid >
82
- < Grid dir = { direction } size = { { xs : 6 } } >
83
- < h2 > { t ( 'donation_through_bank_title' ) } </ h2 >
84
- < p > { t ( 'donation_through_bank_reccomendation' ) } </ p >
85
- < Typography id = "modal-modal-description" sx = { { mt : 2 } } >
86
- { t ( 'bank' ) } : { t ( 'donation_through_bank_details_bank' ) }
87
- < br />
88
- { t ( 'branch' ) } : { t ( 'donation_through_bank_details_branch' ) }
89
- < br />
90
- { t ( 'account' ) } : { t ( 'donation_through_bank_details_account' ) }
91
- < br />
92
- { t ( 'account_name' ) } : { t ( 'donation_through_bank_details_account_name' ) }
93
- </ Typography >
94
- < sub > { t ( 'donation_through_bank_details_additional_message' ) } </ sub >
112
+ < ButtonDonate
113
+ href = "https://www.jgive.com/new/he/ils/donation-targets/3268"
114
+ target = "_blank"
115
+ rel = "noreferrer" >
116
+ < ButtonDonateText > { t ( 'donate' ) } </ ButtonDonateText >
117
+ < ButtonDonateIcon >
118
+ < ArrowBackIosNewRounded sx = { { fontSize : 32 } } />
119
+ </ ButtonDonateIcon >
120
+ </ ButtonDonate >
121
+ </ Grid >
122
+ < Grid size = { { xs : 12 , md : 6 } } >
123
+ < Typography component = "div" >
124
+ < h2 > { t ( 'donation_through_bank_title' ) } </ h2 >
125
+ </ Typography >
126
+ < p > { t ( 'donation_through_bank_reccomendation' ) } </ p >
127
+ < Typography id = "modal-modal-description" sx = { { mt : 2 } } >
128
+ { t ( 'bank' ) } : { t ( 'donation_through_bank_details_bank' ) }
129
+ < br />
130
+ { t ( 'branch' ) } : { t ( 'donation_through_bank_details_branch' ) }
131
+ < br />
132
+ { t ( 'account' ) } : { t ( 'donation_through_bank_details_account' ) }
133
+ < br />
134
+ { t ( 'account_name' ) } : { t ( 'donation_through_bank_details_account_name' ) }
135
+ </ Typography >
136
+ < sub > { t ( 'donation_through_bank_details_additional_message' ) } </ sub >
137
+ </ Grid >
95
138
</ Grid >
96
- </ Grid >
139
+ </ Box >
97
140
</ Box >
98
141
</ Modal >
99
142
)
0 commit comments