import React, { useState } from 'react'; import { View, Text, ScrollView, StyleSheet, Pressable, Alert, } from 'react-native'; import { Ux4gSocialLink, Ux4gSocialLinkGroup, Ux4gSocialLinkList, SocialMediaIcon, SocialLinkSize, } from '../components/social-links/SocialLinks'; import { useUx4gTheme } from '../theme/Ux4gThemeContext'; const ALL_ICONS: SocialMediaIcon[] = [ 'github', 'google', 'twitter', 'instagram', 'youtube', 'whatsapp', 'slack', 'figma', 'dribbble', 'behance', 'gmail', 'medium', 'reddit', 'skype', 'notion', 'stackoverflow', 'apple', 'android', 'zoom', 'microsoftTeams', 'googleMeet', 'googlePlay', 'social', 'vector', ]; const SIZE_OPTIONS: SocialLinkSize[] = ['xs', 's', 'm', 'l', 'xl', 'xxl']; export const SocialLinksShowcase: React.FC = () => { const theme = useUx4gTheme(); const colors = theme.colors; const [activeSize, setActiveSize] = useState('m'); const [enableBg, setEnableBg] = useState(false); const [useColored, setUseColored] = useState(false); const cardStyle = [ styles.card, { backgroundColor: theme.isDark ? '#1F1F1F' : '#FFFFFF', borderColor: theme.isDark ? '#333333' : '#E4E4E7', }, ]; const titleStyle = [ styles.sectionTitle, { color: theme.isDark ? '#F4F4F5' : '#18181B' }, ]; const subtitleStyle = [ styles.subText, { color: theme.isDark ? '#A1A1AA' : '#71717A' }, ]; const handleIconPress = (icon: SocialMediaIcon) => () => { Alert.alert('Social Link Pressed', `You tapped: ${icon}`); }; return ( 🔗 Social Links Component React Native port of Flutter `social_links.dart`. Supports 24 social media icons, 6 sizes (xs–xxl), white/colored variants, optional circular backgrounds, and interactive press callbacks. {/* 1. Single Icon — All Sizes */} 1. Single Icon — All Sizes `Ux4gSocialLink` rendered at each size (xs=16, s=20, m=24, l=32, xl=40, xxl=48). {SIZE_OPTIONS.map((sz) => ( Alert.alert('Size', `GitHub at size "${sz}"`)} /> {sz} ))} {/* 2. White vs Colored Variants */} 2. White vs Colored Variants Left: white/mono (tinted with `onSurface`). Right: branded color (`useColoredIcon: true`). White (tinted) {['github', 'google', 'twitter', 'instagram', 'youtube', 'whatsapp'].map((icon) => ( ))} Colored {['github', 'google', 'twitter', 'instagram', 'youtube', 'whatsapp'].map((icon) => ( ))} {/* 3. With Circular Background */} 3. With Circular Background `enableBackground: true` wraps each icon in a tinted circular container (default: primary @ 10% alpha). {['figma', 'slack', 'dribbble', 'behance', 'gmail', 'notion'].map((icon) => ( Alert.alert('Background', `${icon} pressed`)} /> ))} {['figma', 'slack', 'dribbble', 'behance', 'gmail', 'notion'].map((icon) => ( ))} {/* 4. Custom Container Size */} 4. Custom Container Size `containerSize` overrides the auto-calculated background circle size. {/* 5. Interactive Controls */} 5. Interactive Controls Toggle size, background, and color variant using the controls below. {/* Size selector */} Size: {SIZE_OPTIONS.map((sz) => ( setActiveSize(sz)} style={[ styles.pill, { borderColor: colors.primary, backgroundColor: activeSize === sz ? colors.primary : 'transparent', }, ]} > {sz} ))} {/* Toggles */} setEnableBg(!enableBg)} style={[styles.togglePill, { borderColor: colors.primary }]} > Background: {enableBg ? 'ON' : 'OFF'} setUseColored(!useColored)} style={[styles.togglePill, { borderColor: colors.primary }]} > Colored: {useColored ? 'ON' : 'OFF'} {/* Preview */} {['github', 'google', 'twitter', 'instagram', 'youtube', 'whatsapp', 'slack', 'figma'].map( (icon) => ( Alert.alert('Pressed', icon)} /> ) )} {/* 6. SocialLinkGroup (Wrap layout) */} 6. SocialLinkGroup (`Ux4gSocialLinkGroup`) Wrapping row of icons with configurable `spacing`. Matches Flutter `Ux4gSocialLinkGroup` Wrap widget. {/* 7. SocialLinkGroup — Colored */} 7. SocialLinkGroup — Colored Icons All 24 icons rendered with branded colors (`useColoredIcon` via individual `Ux4gSocialLink`). {ALL_ICONS.map((icon) => ( Alert.alert('Colored', icon)} /> ))} {/* 8. SocialLinkList — Horizontal */} 8. SocialLinkList — Horizontal `Ux4gSocialLinkList` with `direction: horizontal` and various `alignment` values. {(['flex-start', 'center', 'flex-end', 'space-between'] as const).map((align) => ( alignment: {align} ))} {/* 9. SocialLinkList — Vertical */} 9. SocialLinkList — Vertical `direction: vertical` layout for stacked social link menus. {/* 10. Custom Color Tint */} 10. Custom Color Tint Using the `color` prop to override icon tint with custom colors. ); }; const styles = StyleSheet.create({ container: { flex: 1, }, contentContainer: { padding: 16, paddingBottom: 40, }, header: { marginBottom: 16, }, title: { fontSize: 22, fontWeight: '800', marginBottom: 6, }, subText: { fontSize: 14, lineHeight: 20, }, card: { borderWidth: 1, borderRadius: 16, padding: 16, marginBottom: 16, overflow: 'visible', }, sectionTitle: { fontSize: 16, fontWeight: '700', marginBottom: 4, }, sizeRow: { flexDirection: 'row', alignItems: 'flex-end', justifyContent: 'space-around', marginTop: 20, paddingVertical: 12, }, sizeItem: { alignItems: 'center', gap: 8, }, sizeLabel: { fontSize: 11, fontWeight: '600', }, variantRow: { flexDirection: 'row', marginTop: 16, gap: 12, }, variantColumn: { flex: 1, alignItems: 'center', }, variantDivider: { width: 1, alignSelf: 'stretch', }, variantLabel: { fontSize: 13, fontWeight: '700', marginBottom: 12, }, iconGrid: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, justifyContent: 'center', alignItems: 'center', }, bgRow: { flexDirection: 'row', flexWrap: 'wrap', gap: 12, justifyContent: 'center', alignItems: 'center', marginTop: 16, }, controlRow: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: 8, marginTop: 12, }, controlLabel: { fontSize: 14, fontWeight: '700', }, pillRow: { flexDirection: 'row', gap: 6, }, pill: { paddingHorizontal: 10, paddingVertical: 6, borderWidth: 1, borderRadius: 999, }, togglePill: { paddingHorizontal: 12, paddingVertical: 8, borderWidth: 1, borderRadius: 999, }, previewBox: { padding: 20, borderRadius: 12, marginTop: 16, }, listBox: { padding: 12, borderRadius: 10, }, alignLabel: { fontSize: 12, fontWeight: '600', fontFamily: 'monospace', marginBottom: 4, }, verticalBox: { padding: 20, borderRadius: 12, marginTop: 12, alignItems: 'center', }, });