@umituz/react-native-design-system 2.6.87 → 2.6.88

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.
@@ -0,0 +1,384 @@
1
+ # MediaCard
2
+
3
+ MediaCard, resim, video veya medya içeriği göstermek için optimize edilmiş bir kart bileşenidir. Overlay text, badge ve seçim durumu destekler.
4
+
5
+ ## Özellikler
6
+
7
+ - 🖼️ **Görsel Odaklı**: Resim/video odaklı tasarım
8
+ - 📝 **Overlay Text**: Üzerinde metin gösterimi
9
+ - 🏷️ **Badge**: Rozet/badge desteği
10
+ - ✅ **Selected State**: Seçim durumu
11
+ - 📏 **3 Size**: Small, Medium, Large
12
+ - 👆 **Pressable**: Tıklanabilir kart
13
+ - ♿ **Erişilebilir**: Tam erişilebilirlik desteği
14
+
15
+ ## Kurulum
16
+
17
+ ```tsx
18
+ import { MediaCard } from 'react-native-design-system';
19
+ ```
20
+
21
+ ## Temel Kullanım
22
+
23
+ ```tsx
24
+ import React from 'react';
25
+ import { View } from 'react-native';
26
+ import { MediaCard } from 'react-native-design-system';
27
+
28
+ export const BasicExample = () => {
29
+ return (
30
+ <View style={{ padding: 16 }}>
31
+ <MediaCard
32
+ uri="https://example.com/image.jpg"
33
+ title="Görsel Başlığı"
34
+ subtitle="Alt başlık"
35
+ />
36
+ </View>
37
+ );
38
+ };
39
+ ```
40
+
41
+ ## Basic Card
42
+
43
+ ```tsx
44
+ <MediaCard
45
+ uri="https://example.com/image.jpg"
46
+ />
47
+ ```
48
+
49
+ ## Title & Subtitle
50
+
51
+ ```tsx
52
+ <MediaCard
53
+ uri="https://example.com/image.jpg"
54
+ title="Manzara"
55
+ subtitle="Doğa harikası"
56
+ />
57
+ ```
58
+
59
+ ## Badge
60
+
61
+ ```tsx
62
+ <MediaCard
63
+ uri="https://example.com/image.jpg"
64
+ title="Yeni"
65
+ badge="YENİ"
66
+ />
67
+ ```
68
+
69
+ ## Seçim Durumu
70
+
71
+ ```tsx
72
+ <MediaCard
73
+ uri="https://example.com/image.jpg"
74
+ title="Seçili"
75
+ selected
76
+ />
77
+ ```
78
+
79
+ ## Boyutlar
80
+
81
+ ```tsx
82
+ <View style={{ flexDirection: 'row', gap: 8 }}>
83
+ {/* Small */}
84
+ <MediaCard
85
+ uri="https://example.com/image.jpg"
86
+ size="sm"
87
+ />
88
+
89
+ {/* Medium */}
90
+ <MediaCard
91
+ uri="https://example.com/image.jpg"
92
+ size="md"
93
+ />
94
+
95
+ {/* Large */}
96
+ <MediaCard
97
+ uri="https://example.com/image.jpg"
98
+ size="lg"
99
+ />
100
+ </View>
101
+ ```
102
+
103
+ ## Pressable
104
+
105
+ ```tsx
106
+ <MediaCard
107
+ uri="https://example.com/image.jpg"
108
+ title="Tıkla"
109
+ onPress={() => console.log('Tıklandı')}
110
+ />
111
+ ```
112
+
113
+ ## Custom Genişlik
114
+
115
+ ```tsx
116
+ <MediaCard
117
+ uri="https://example.com/image.jpg"
118
+ width={200}
119
+ size="lg"
120
+ />
121
+ ```
122
+
123
+ ## Overlay Pozisyonu
124
+
125
+ ```tsx
126
+ <View style={{ gap: 8 }}>
127
+ {/* Altta */}
128
+ <MediaCard
129
+ uri="https://example.com/image.jpg"
130
+ overlayPosition="bottom"
131
+ title="Altta"
132
+ />
133
+
134
+ {/* Ortada */}
135
+ <MediaCard
136
+ uri="https://example.com/image.jpg"
137
+ overlayPosition="center"
138
+ title="Ortada"
139
+ />
140
+ </View>
141
+ ```
142
+
143
+ ## Overlay Gizle
144
+
145
+ ```tsx
146
+ <MediaCard
147
+ uri="https://example.com/image.jpg"
148
+ showOverlay={false}
149
+ />
150
+ ```
151
+
152
+ ## Örnek Kullanımlar
153
+
154
+ ### Fotoğraf Galeri
155
+
156
+ ```tsx
157
+ export const PhotoGallery = ({ photos }) => {
158
+ return (
159
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8, padding: 16 }}>
160
+ {photos.map((photo) => (
161
+ <MediaCard
162
+ key={photo.id}
163
+ uri={photo.uri}
164
+ size="sm"
165
+ onPress={() => navigation.navigate('PhotoDetail', { photoId: photo.id })}
166
+ />
167
+ ))}
168
+ </View>
169
+ );
170
+ };
171
+ ```
172
+
173
+ ### Şablon Seçimi
174
+
175
+ ```tsx
176
+ export const TemplateGallery = ({ templates }) => {
177
+ const [selectedTemplate, setSelectedTemplate] = useState(null);
178
+
179
+ return (
180
+ <View style={{ padding: 16 }}>
181
+ <FlatList
182
+ data={templates}
183
+ numColumns={2}
184
+ keyExtractor={(item) => item.id}
185
+ renderItem={({ item }) => (
186
+ <MediaCard
187
+ uri={item.thumbnail}
188
+ title={item.name}
189
+ selected={selectedTemplate?.id === item.id}
190
+ onPress={() => setSelectedTemplate(item)}
191
+ style={{ margin: 8 }}
192
+ />
193
+ )}
194
+ />
195
+
196
+ <Button
197
+ title="Şablonu Kullan"
198
+ onPress={() => applyTemplate(selectedTemplate)}
199
+ />
200
+ </View>
201
+ );
202
+ };
203
+ ```
204
+
205
+ ### Ürün Kartları
206
+
207
+ ```tsx
208
+ export const ProductGrid = ({ products }) => {
209
+ return (
210
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 16 }}>
211
+ {products.map((product) => (
212
+ <MediaCard
213
+ key={product.id}
214
+ uri={product.image}
215
+ title={product.name}
216
+ subtitle={`${product.price} TL`}
217
+ badge={product.isNew ? 'YENİ' : ''}
218
+ onPress={() => navigation.navigate('ProductDetail', { productId: product.id })}
219
+ />
220
+ ))}
221
+ </View>
222
+ );
223
+ };
224
+ ```
225
+
226
+ ### Hikaye Seçimi
227
+
228
+ ```tsx
229
+ export const StorySelector = ({ stories }) => {
230
+ return (
231
+ <ScrollView horizontal style={{ padding: 16 }}>
232
+ {stories.map((story) => (
233
+ <MediaCard
234
+ key={story.id}
235
+ uri={story.avatar}
236
+ size="sm"
237
+ aspectRatio={1}
238
+ onPress={() => openStory(story)}
239
+ style={{ marginRight: 8 }}
240
+ />
241
+ ))}
242
+ </ScrollView>
243
+ );
244
+ };
245
+ ```
246
+
247
+ ### Meme Koleksiyonu
248
+
249
+ ```tsx
250
+ export const MemeGallery = ({ memes }) => {
251
+ const [selectedMemes, setSelectedMemes] = useState(new Set());
252
+
253
+ const toggleSelection = (id) => {
254
+ const newSet = new Set(selectedMemes);
255
+ if (newSet.has(id)) {
256
+ newSet.delete(id);
257
+ } else {
258
+ newSet.add(id);
259
+ }
260
+ setSelectedMemes(newSet);
261
+ };
262
+
263
+ return (
264
+ <View style={{ flexDirection: 'row', flexWrap: 'wrap', gap: 8 }}>
265
+ {memes.map((meme) => (
266
+ <MediaCard
267
+ key={meme.id}
268
+ uri={meme.image}
269
+ selected={selectedMemes.has(meme.id)}
270
+ onPress={() => toggleSelection(meme.id)}
271
+ />
272
+ ))}
273
+ </View>
274
+ );
275
+ };
276
+ ```
277
+
278
+ ### Arka Plan Seçimi
279
+
280
+ ```tsx
281
+ export const BackgroundPicker = ({ backgrounds }) => {
282
+ const [selectedBg, setSelectedBg] = useState(backgrounds[0]);
283
+
284
+ return (
285
+ <View style={{ padding: 16 }}>
286
+ <FlatList
287
+ data={backgrounds}
288
+ numColumns={3}
289
+ keyExtractor={(item) => item.id}
290
+ renderItem={({ item }) => (
291
+ <MediaCard
292
+ uri={item.thumbnail}
293
+ selected={selectedBg?.id === item.id}
294
+ onPress={() => setSelectedBg(item)}
295
+ style={{ margin: 4 }}
296
+ />
297
+ )}
298
+ />
299
+ </View>
300
+ );
301
+ };
302
+ ```
303
+
304
+ ## Props
305
+
306
+ ### MediaCardProps
307
+
308
+ | Prop | Tip | Varsayılan | Açıklama |
309
+ |------|-----|------------|----------|
310
+ | `uri` | `string` | - **(Zorunlu)** | Resim URI'si |
311
+ | `title` | `string` | - | Başlık metni |
312
+ | `subtitle` | `string` | - | Alt başlık |
313
+ | `badge` | `string \| number` | - | Badge içeriği |
314
+ | `selected` | `boolean` | `false` | Seçili durumu |
315
+ | `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Kart boyutu |
316
+ | `aspectRatio` | `number` | `0.8` | En-boy oranı |
317
+ | `overlayPosition` | `'top' \| 'bottom' \| 'center'` | `'bottom'` | Overlay pozisyonu |
318
+ | `showOverlay` | `boolean` | `true` | Overlay göster |
319
+ | `width` | `number` | - | Custom genişlik |
320
+ | `onPress` | `() => void` | - | Tıklama olayı |
321
+ | `testID` | `string` | - | Test ID'si |
322
+
323
+ ## Best Practices
324
+
325
+ ### 1. Boyut Seçimi
326
+
327
+ ```tsx
328
+ // Yoğun grid
329
+ <MediaCard size="sm" />
330
+
331
+ // Normal grid
332
+ <MediaCard size="md" />
333
+
334
+ // Vurgu
335
+ <MediaCard size="lg" />
336
+ ```
337
+
338
+ ### 2. Aspect Ratio
339
+
340
+ ```tsx
341
+ // Kare
342
+ <MediaCard aspectRatio={1} />
343
+
344
+ // Dikdörtgen
345
+ <MediaCard aspectRatio={0.8} />
346
+
347
+ // Yatay
348
+ <MediaCard aspectRatio={1.2} />
349
+ ```
350
+
351
+ ### 3. Overlay Kullanımı
352
+
353
+ ```tsx
354
+ // Bilgi için
355
+ <MediaCard title="Başlık" subtitle="Açıklama" />
356
+
357
+ // Sadece görsel
358
+ <MediaCard showOverlay={false} />
359
+ ```
360
+
361
+ ## Erişilebilirlik
362
+
363
+ MediaCard, tam erişilebilirlik desteği sunar:
364
+
365
+ - ✅ Touch uygun boyut
366
+ - ✅ Screen reader desteği
367
+ - ✅ Selected state anonsu
368
+ - ✅ Test ID desteği
369
+
370
+ ## Performans İpuçları
371
+
372
+ 1. **Optimization**: Resimleri optimize edin
373
+ 2. **Caching**: Resimleri cache'leyin
374
+ 3. **Lazy Loading**: Uzun listelerde lazy load kullanın
375
+
376
+ ## İlgili Bileşenler
377
+
378
+ - [`AtomicCard`](../../atoms/AtomicCard.README.md) - Basit kart
379
+ - [`GlowingCard`](../GlowingCard/README.md) - Parlak kart
380
+ - [`AtomicImage`](../../atoms/AtomicImage/README.md) - Resim bileşeni
381
+
382
+ ## Lisans
383
+
384
+ MIT