@@ -12,9 +12,8 @@ import {
1212 useMessagesContext ,
1313} from '../../contexts/messagesContext/MessagesContext' ;
1414import { useTheme } from '../../contexts/themeContext/ThemeContext' ;
15- import { Left } from '../../icons/Left ' ;
15+ import { GiphyIcon } from '../../icons' ;
1616import { Lightning } from '../../icons/Lightning' ;
17- import { Right } from '../../icons/Right' ;
1817import type {
1918 DefaultAttachmentType ,
2019 DefaultChannelType ,
@@ -28,25 +27,20 @@ import type {
2827import { makeImageCompatibleUrl } from '../../utils/utils' ;
2928
3029const styles = StyleSheet . create ( {
30+ buttonContainer : { alignItems : 'center' , borderTopWidth : 1 , flex : 1 , justifyContent : 'center' } ,
3131 cancel : {
3232 fontSize : 14 ,
3333 fontWeight : '600' ,
3434 paddingVertical : 16 ,
3535 } ,
36- cancelContainer : {
37- alignItems : 'center' ,
38- borderRightWidth : 1 ,
39- flex : 1 ,
40- justifyContent : 'center' ,
41- } ,
4236 container : {
4337 overflow : 'hidden' ,
44- width : 256 ,
38+ width : 270 ,
4539 } ,
4640 giphy : {
47- borderTopLeftRadius : 8 ,
48- borderTopRightRadius : 8 ,
49- height : 140 ,
41+ borderRadius : 2 ,
42+ height : 170 ,
43+ width : 270 ,
5044 } ,
5145 giphyContainer : {
5246 alignItems : 'center' ,
@@ -56,36 +50,47 @@ const styles = StyleSheet.create({
5650 justifyContent : 'center' ,
5751 width : 68 ,
5852 } ,
53+ giphyHeaderText : {
54+ fontSize : 16 ,
55+ fontWeight : '600' ,
56+ } ,
57+ giphyHeaderTitle : {
58+ fontSize : 14 ,
59+ } ,
5960 giphyMask : {
6061 bottom : 8 ,
6162 left : 8 ,
6263 position : 'absolute' ,
6364 } ,
64- giphyText : { fontSize : 11 , fontWeight : '600' } ,
65+ giphyMaskText : { fontSize : 13 , fontWeight : '600' } ,
66+ header : {
67+ alignItems : 'center' ,
68+ display : 'flex' ,
69+ flexDirection : 'row' ,
70+ justifyContent : 'space-between' ,
71+ padding : 8 ,
72+ width : '60%' ,
73+ } ,
6574 margin : {
66- margin : 8 ,
75+ margin : 1 ,
6776 } ,
6877 row : { flexDirection : 'row' } ,
6978 selectionContainer : {
70- borderRadius : 8 ,
79+ borderBottomLeftRadius : 8 ,
7180 borderWidth : 1 ,
7281 overflow : 'hidden' ,
73- width : 250 ,
74- } ,
75- selector : {
76- alignItems : 'center' ,
77- borderBottomWidth : 1 ,
78- flexDirection : 'row' ,
79- justifyContent : 'space-between' ,
80- paddingBottom : 8 ,
81- paddingHorizontal : 8 ,
82+ width : 272 ,
8283 } ,
8384 send : {
8485 fontSize : 14 ,
8586 fontWeight : '600' ,
8687 paddingVertical : 16 ,
8788 } ,
88- sendContainer : { alignItems : 'center' , flex : 1 , justifyContent : 'center' } ,
89+ shuffle : {
90+ fontSize : 14 ,
91+ fontWeight : '600' ,
92+ paddingVertical : 16 ,
93+ } ,
8994 shuffleButton : {
9095 alignItems : 'center' ,
9196 borderRadius : 16 ,
@@ -94,11 +99,6 @@ const styles = StyleSheet.create({
9499 justifyContent : 'center' ,
95100 width : 32 ,
96101 } ,
97- title : {
98- fontSize : 14 ,
99- fontStyle : 'italic' ,
100- fontWeight : '500' ,
101- } ,
102102} ) ;
103103
104104export type GiphyPropsWithContext <
@@ -142,22 +142,22 @@ const GiphyWithContext = <
142142
143143 const {
144144 theme : {
145- colors : { accent_blue, black, border , grey , overlay , white } ,
145+ colors : { accent_blue, black, grey , grey_dark , grey_gainsboro , white } ,
146146 messageSimple : {
147147 giphy : {
148+ buttonContainer,
148149 cancel,
149- cancelContainer,
150150 container,
151151 giphy,
152152 giphyContainer,
153+ giphyHeaderText,
154+ giphyHeaderTitle,
153155 giphyMask,
154- giphyText,
156+ giphyMaskText,
157+ header,
155158 selectionContainer,
156- selector,
157159 send,
158- sendContainer,
159- shuffleButton,
160- title : titleStyle ,
160+ shuffle,
161161 } ,
162162 } ,
163163 } ,
@@ -175,59 +175,57 @@ const GiphyWithContext = <
175175 selectionContainer ,
176176 ] }
177177 >
178+ < View style = { [ styles . header , header ] } >
179+ < GiphyIcon />
180+ < Text style = { [ styles . giphyHeaderText , giphyHeaderText ] } > Giphy</ Text >
181+ < Text
182+ style = { [ styles . giphyHeaderTitle , giphyHeaderTitle , { color : grey_dark } ] }
183+ > { `/giphy ${ title } ` } </ Text >
184+ </ View >
178185 < View style = { styles . margin } >
179186 < Image
180187 resizeMode = 'cover'
181188 source = { { uri : makeImageCompatibleUrl ( uri ) } }
182189 style = { [ styles . giphy , giphy ] }
183190 />
184- < View style = { [ styles . giphyMask , giphyMask ] } >
185- < View style = { [ styles . giphyContainer , { backgroundColor : overlay } , giphyContainer ] } >
186- < Lightning height = { 16 } pathFill = { white } width = { 16 } />
187- < Text style = { [ styles . giphyText , { color : white } , giphyText ] } >
188- { type ?. toUpperCase ( ) }
189- </ Text >
190- </ View >
191- </ View >
192191 </ View >
193192 < View >
194- < View style = { [ styles . selector , { borderBottomColor : border } , selector ] } >
195- < TouchableOpacity
196- onPress = { ( ) => handleAction ( 'image_action' , 'shuffle' ) }
197- style = { [ styles . shuffleButton , { borderColor : border } , shuffleButton ] }
198- >
199- < Left />
200- </ TouchableOpacity >
201- < Text style = { [ styles . title , { color : black } , titleStyle ] } > { `"${ title } "` } </ Text >
193+ < View style = { styles . row } >
202194 < TouchableOpacity
203195 onPress = { ( ) => {
204- if ( actions ?. [ 1 ] . name && actions ?. [ 1 ] . value && handleAction ) {
205- handleAction ( actions [ 1 ] . name , actions [ 1 ] . value ) ;
196+ if ( actions ?. [ 2 ] . name && actions ?. [ 2 ] . value && handleAction ) {
197+ handleAction ( actions [ 2 ] . name , actions [ 2 ] . value ) ;
206198 }
207199 } }
208- style = { [ styles . shuffleButton , shuffleButton ] }
200+ style = { [
201+ styles . buttonContainer ,
202+ { borderColor : grey_gainsboro , borderRightWidth : 1 } ,
203+ buttonContainer ,
204+ ] }
209205 >
210- < Right / >
206+ < Text style = { [ styles . cancel , { color : grey } , cancel ] } > { actions ?. [ 2 ] . text } </ Text >
211207 </ TouchableOpacity >
212- </ View >
213- < View style = { styles . row } >
214208 < TouchableOpacity
215209 onPress = { ( ) => {
216- if ( actions ?. [ 2 ] . name && actions ?. [ 2 ] . value && handleAction ) {
217- handleAction ( actions [ 2 ] . name , actions [ 2 ] . value ) ;
210+ if ( actions ?. [ 1 ] . name && actions ?. [ 1 ] . value && handleAction ) {
211+ handleAction ( actions [ 1 ] . name , actions [ 1 ] . value ) ;
218212 }
219213 } }
220- style = { [ styles . cancelContainer , { borderRightColor : border } , cancelContainer ] }
214+ style = { [
215+ styles . buttonContainer ,
216+ { borderColor : grey_gainsboro , borderRightWidth : 1 } ,
217+ buttonContainer ,
218+ ] }
221219 >
222- < Text style = { [ styles . cancel , { color : grey } , cancel ] } > { actions ?. [ 2 ] . text } </ Text >
220+ < Text style = { [ styles . shuffle , { color : grey } , shuffle ] } > { actions ?. [ 1 ] . text } </ Text >
223221 </ TouchableOpacity >
224222 < TouchableOpacity
225223 onPress = { ( ) => {
226224 if ( actions ?. [ 0 ] . name && actions ?. [ 0 ] . value && handleAction ) {
227225 handleAction ( actions [ 0 ] . name , actions [ 0 ] . value ) ;
228226 }
229227 } }
230- style = { [ styles . sendContainer , sendContainer ] }
228+ style = { [ styles . buttonContainer , { borderColor : grey_gainsboro } , buttonContainer ] }
231229 >
232230 < Text style = { [ styles . send , { color : accent_blue } , send ] } > { actions ?. [ 0 ] . text } </ Text >
233231 </ TouchableOpacity >
@@ -272,9 +270,9 @@ const GiphyWithContext = <
272270 style = { [ styles . giphy , giphy ] }
273271 />
274272 < View style = { [ styles . giphyMask , giphyMask ] } >
275- < View style = { [ styles . giphyContainer , { backgroundColor : overlay } , giphyContainer ] } >
273+ < View style = { [ styles . giphyContainer , { backgroundColor : grey_dark } , giphyContainer ] } >
276274 < Lightning height = { 16 } pathFill = { white } width = { 16 } />
277- < Text style = { [ styles . giphyText , { color : white } , giphyText ] } >
275+ < Text style = { [ styles . giphyMaskText , { color : white } , giphyMaskText ] } >
278276 { type ?. toUpperCase ( ) }
279277 </ Text >
280278 </ View >
0 commit comments