|
| 1 | +'use client'; |
| 2 | + |
| 3 | +import { Box, Container, Typography, Paper, Grid, Snackbar, Alert } from '@mui/material'; |
| 4 | +import React, { useState } from 'react'; |
| 5 | +import { lightModePalette } from '@/pages/themes-explorer/palette'; |
| 6 | +import { Palette, Eye, Sun, Send, Star } from 'lucide-react'; |
| 7 | + |
| 8 | +export default function BorderAndIconColors() { |
| 9 | + const borderColors = lightModePalette.border; |
| 10 | + const iconColors = lightModePalette.icon; |
| 11 | + |
| 12 | + const [snackbarOpen, setSnackbarOpen] = useState(false); |
| 13 | + const [copiedText, setCopiedText] = useState(''); |
| 14 | + |
| 15 | + const handleCopy = (value) => { |
| 16 | + navigator.clipboard.writeText(value); |
| 17 | + setCopiedText(value); |
| 18 | + setSnackbarOpen(true); |
| 19 | + }; |
| 20 | + |
| 21 | + const handleClose = () => setSnackbarOpen(false); |
| 22 | + |
| 23 | + const borderSwatches = [ |
| 24 | + { key: 'default', label: 'Default', desc: 'Standard borders' }, |
| 25 | + { key: 'strong', label: 'Strong', desc: 'Emphasized borders' }, |
| 26 | + { key: 'brand', label: 'Brand', desc: 'Brand borders' }, |
| 27 | + { key: 'normal', label: 'Normal', desc: 'Normal borders' }, |
| 28 | + { key: 'neutral.default', label: 'Neutral Default', desc: 'Neutral borders' }, |
| 29 | + { key: 'neutral.alt', label: 'Neutral Alt', desc: 'Alternate neutral borders' }, |
| 30 | + ]; |
| 31 | + |
| 32 | + const iconSwatches = [ |
| 33 | + { key: 'default', label: 'Default', desc: 'Standard icons' }, |
| 34 | + { key: 'secondary', label: 'Secondary', desc: 'Secondary icons' }, |
| 35 | + { key: 'brand', label: 'Brand', desc: 'Brand icons' }, |
| 36 | + { key: 'inverse', label: 'Inverse', desc: 'Inverse icons' }, |
| 37 | + { key: 'weather', label: 'Weather', desc: 'Weather icons' }, |
| 38 | + { key: 'disabled', label: 'Disabled', desc: 'Disabled icons' }, |
| 39 | + { key: 'dualTone', label: 'Dual Tone', desc: 'Two-tone icons' }, |
| 40 | + { key: 'dualToneInverse', label: 'Dual Tone Inverse', desc: 'Inverse dual-tone icons' }, |
| 41 | + { key: 'neutral.default', label: 'Neutral Default', desc: 'Neutral icons' }, |
| 42 | + { key: 'neutral.alt', label: 'Neutral Alt', desc: 'Alt neutral icons' }, |
| 43 | + ]; |
| 44 | + |
| 45 | + // helper: safely get nested colors (e.g. border.neutral.default) |
| 46 | + const getColor = (obj, path) => { |
| 47 | + return path.split('.').reduce((acc, part) => acc && acc[part], obj); |
| 48 | + }; |
| 49 | + |
| 50 | + return ( |
| 51 | + <Container maxWidth="xl" sx={{ mt: 4 }}> |
| 52 | + {/* BORDER COLORS */} |
| 53 | + <Paper sx={{ p: 3, border: '1px solid #eee', borderRadius: '12px', mb: 4 }}> |
| 54 | + <Typography sx={{ fontSize: '1rem', fontWeight: 700 }}>Border Colors</Typography> |
| 55 | + <Typography sx={{ fontSize: '0.85rem', color: '#555', mb: 3 }}> |
| 56 | + Border colors for different emphasis levels |
| 57 | + </Typography> |
| 58 | + |
| 59 | + <Grid container spacing={3}> |
| 60 | + {borderSwatches.map(({ key, label, desc }) => ( |
| 61 | + <Grid item xs={12} sm={6} md={3} key={key}> |
| 62 | + <Paper |
| 63 | + elevation={1} |
| 64 | + sx={{ |
| 65 | + p: 2, |
| 66 | + borderRadius: '12px', |
| 67 | + border: '1px solid #eee', |
| 68 | + textAlign: 'center', |
| 69 | + display: 'flex', |
| 70 | + flexDirection: 'column', |
| 71 | + alignItems: 'center', |
| 72 | + gap: 1, |
| 73 | + }} |
| 74 | + > |
| 75 | + <Box |
| 76 | + onClick={() => handleCopy(getColor(borderColors, key))} |
| 77 | + sx={{ |
| 78 | + width: 60, |
| 79 | + height: 60, |
| 80 | + borderRadius: '8px', |
| 81 | + border: `4px solid ${getColor(borderColors, key)}`, |
| 82 | + cursor: 'pointer', |
| 83 | + '&:hover': { boxShadow: '0 0 0 3px rgba(0,0,0,0.1)' }, |
| 84 | + }} |
| 85 | + /> |
| 86 | + <Typography sx={{ fontWeight: 600, fontSize: '0.9rem' }}>{label}</Typography> |
| 87 | + <Typography sx={{ fontSize: '0.75rem', color: '#555' }}>{desc}</Typography> |
| 88 | + <Typography |
| 89 | + sx={{ |
| 90 | + fontSize: '0.75rem', |
| 91 | + backgroundColor: '#f5f5f5', |
| 92 | + borderRadius: '6px', |
| 93 | + px: 1, |
| 94 | + py: 0.3, |
| 95 | + mt: 0.5, |
| 96 | + fontFamily: 'monospace', |
| 97 | + }} |
| 98 | + > |
| 99 | + {getColor(borderColors, key)} |
| 100 | + </Typography> |
| 101 | + </Paper> |
| 102 | + </Grid> |
| 103 | + ))} |
| 104 | + </Grid> |
| 105 | + |
| 106 | + {/* Border Examples */} |
| 107 | + <Box sx={{ mt: 4, p: 2, border: '1px solid #eee', borderRadius: '10px' }}> |
| 108 | + <Typography sx={{ fontSize: '0.95rem', fontWeight: 700, mb: 1 }}> |
| 109 | + Border Examples |
| 110 | + </Typography> |
| 111 | + <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}> |
| 112 | + {borderSwatches.slice(0, 4).map(({ key, label }) => ( |
| 113 | + <Box |
| 114 | + key={key} |
| 115 | + sx={{ |
| 116 | + border: `2px solid ${getColor(borderColors, key)}`, |
| 117 | + borderRadius: '8px', |
| 118 | + px: 2, |
| 119 | + py: 1, |
| 120 | + minWidth: 120, |
| 121 | + textAlign: 'center', |
| 122 | + }} |
| 123 | + > |
| 124 | + {label} Border |
| 125 | + </Box> |
| 126 | + ))} |
| 127 | + </Box> |
| 128 | + </Box> |
| 129 | + </Paper> |
| 130 | + |
| 131 | + {/* ICON COLORS */} |
| 132 | + <Paper sx={{ p: 3, border: '1px solid #eee', borderRadius: '12px' }}> |
| 133 | + <Typography sx={{ fontSize: '1rem', fontWeight: 700 }}>Icon Colors</Typography> |
| 134 | + <Typography sx={{ fontSize: '0.85rem', color: '#555', mb: 3 }}> |
| 135 | + Icon colors for different contexts and states |
| 136 | + </Typography> |
| 137 | + |
| 138 | + <Grid container spacing={3}> |
| 139 | + {iconSwatches.map(({ key, label, desc }) => ( |
| 140 | + <Grid item xs={12} sm={6} md={2} key={key}> |
| 141 | + <Paper |
| 142 | + elevation={1} |
| 143 | + sx={{ |
| 144 | + p: 2, |
| 145 | + borderRadius: '12px', |
| 146 | + border: '1px solid #eee', |
| 147 | + textAlign: 'center', |
| 148 | + display: 'flex', |
| 149 | + flexDirection: 'column', |
| 150 | + alignItems: 'center', |
| 151 | + gap: 1, |
| 152 | + }} |
| 153 | + > |
| 154 | + <Box |
| 155 | + onClick={() => handleCopy(getColor(iconColors, key))} |
| 156 | + sx={{ |
| 157 | + width: 60, |
| 158 | + height: 60, |
| 159 | + borderRadius: '8px', |
| 160 | + backgroundColor: getColor(iconColors, key), |
| 161 | + cursor: 'pointer', |
| 162 | + border: '2px solid #ddd', |
| 163 | + '&:hover': { boxShadow: '0 0 0 3px rgba(0,0,0,0.1)' }, |
| 164 | + }} |
| 165 | + /> |
| 166 | + <Typography sx={{ fontWeight: 600, fontSize: '0.9rem' }}>{label}</Typography> |
| 167 | + <Typography sx={{ fontSize: '0.75rem', color: '#555' }}>{desc}</Typography> |
| 168 | + <Typography |
| 169 | + sx={{ |
| 170 | + fontSize: '0.75rem', |
| 171 | + backgroundColor: '#f5f5f5', |
| 172 | + borderRadius: '6px', |
| 173 | + px: 1, |
| 174 | + py: 0.3, |
| 175 | + mt: 0.5, |
| 176 | + fontFamily: 'monospace', |
| 177 | + }} |
| 178 | + > |
| 179 | + {getColor(iconColors, key)} |
| 180 | + </Typography> |
| 181 | + </Paper> |
| 182 | + </Grid> |
| 183 | + ))} |
| 184 | + </Grid> |
| 185 | + |
| 186 | + {/* Icon Examples */} |
| 187 | + <Box sx={{ mt: 4, p: 2, border: '1px solid #eee', borderRadius: '10px' }}> |
| 188 | + <Typography sx={{ fontSize: '0.95rem', fontWeight: 700, mb: 1 }}> |
| 189 | + Icon Examples |
| 190 | + </Typography> |
| 191 | + <Box sx={{ display: 'flex', gap: 3 }}> |
| 192 | + <Palette size={22} color={iconColors.default} /> |
| 193 | + <Eye size={22} color={iconColors.secondary} /> |
| 194 | + <Sun size={22} color={iconColors.brand} /> |
| 195 | + <Send size={22} color={iconColors.weather} /> |
| 196 | + <Star size={22} color={iconColors.dualTone} /> |
| 197 | + </Box> |
| 198 | + </Box> |
| 199 | + </Paper> |
| 200 | + |
| 201 | + {/* Snackbar */} |
| 202 | + <Snackbar |
| 203 | + open={snackbarOpen} |
| 204 | + autoHideDuration={2000} |
| 205 | + onClose={handleClose} |
| 206 | + anchorOrigin={{ vertical: 'bottom', horizontal: 'center' }} |
| 207 | + > |
| 208 | + <Alert onClose={handleClose} severity="success" sx={{ width: '100%' }}> |
| 209 | + Copied: {copiedText} |
| 210 | + </Alert> |
| 211 | + </Snackbar> |
| 212 | + </Container> |
| 213 | + ); |
| 214 | +} |
0 commit comments