/** * IosFrame — iPhone设备边框 * * 参考iPhone 15 Pro(393×852 logical pixels) * 含:灵动岛 + 状态栏(时间/信号/电池)+ Home Indicator + 圆角 * * 用法: * * * * * 自定义: * * ... * */ const iosFrameStyles = { wrapper: { display: 'inline-block', padding: 12, background: '#000', borderRadius: 60, boxShadow: '0 0 0 2px #1f2937, 0 20px 60px rgba(0,0,0,0.3)', position: 'relative', }, screen: { position: 'relative', borderRadius: 48, overflow: 'hidden', background: '#fff', }, statusBar: { position: 'absolute', top: 0, left: 0, right: 0, height: 54, display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '0 32px 0 32px', fontSize: 16, fontWeight: 600, fontFamily: '-apple-system, "SF Pro Text", sans-serif', zIndex: 20, pointerEvents: 'none', }, dynamicIsland: { position: 'absolute', top: 12, left: '50%', transform: 'translateX(-50%)', width: 124, height: 36, background: '#000', borderRadius: 999, zIndex: 30, }, statusIcons: { display: 'flex', alignItems: 'center', gap: 6, }, signalIcon: { display: 'flex', alignItems: 'flex-end', gap: 2, height: 12, }, signalBar: { width: 3, background: 'currentColor', borderRadius: 1, }, wifiIcon: { width: 16, height: 12, position: 'relative', }, batteryIcon: { width: 26, height: 12, border: '1.5px solid currentColor', borderRadius: 3, padding: 1, position: 'relative', opacity: 0.8, }, batteryCap: { position: 'absolute', top: 3, right: -3, width: 2, height: 6, background: 'currentColor', borderRadius: '0 1px 1px 0', }, content: { position: 'absolute', top: 54, left: 0, right: 0, bottom: 34, overflow: 'auto', }, homeIndicator: { position: 'absolute', bottom: 10, left: '50%', transform: 'translateX(-50%)', width: 140, height: 5, background: 'rgba(0,0,0,0.3)', borderRadius: 999, zIndex: 10, }, homeIndicatorDark: { background: 'rgba(255,255,255,0.5)', }, }; function IosFrame({ children, width = 393, height = 852, time = '9:41', battery = 100, darkMode = false, showStatusBar = true, showDynamicIsland = true, showHomeIndicator = true, }) { const textColor = darkMode ? '#fff' : '#000'; return (
{showStatusBar && (
{time}
)} {showDynamicIsland &&
}
{children}
{showHomeIndicator && (
)}
); } if (typeof window !== 'undefined') { window.IosFrame = IosFrame; }