diff --git a/App.tsx b/App.tsx index 105618a..33bbc6c 100755 --- a/App.tsx +++ b/App.tsx @@ -22,6 +22,7 @@ const defaultConfig = { titleSize: 'medium', subtitleSize: 'medium', alignment: 'middle', + horizontalAlignment: 'middle', clock: { enabled: true, size: 'medium', @@ -235,16 +236,16 @@ const App: React.FC = () => { } }; - const getTileSizeClass = (size: string) => { - switch (size) { - case 'small': - return 'w-28 h-28'; - case 'medium': - return 'w-32 h-32'; - case 'large': - return 'w-36 h-36'; + const getHorizontalAlignmentClass = (alignment: string) => { + switch (alignment) { + case 'left': + return 'justify-start'; + case 'middle': + return 'justify-center'; + case 'right': + return 'justify-end'; default: - return 'w-32 h-32'; + return 'justify-center'; } }; @@ -312,8 +313,8 @@ const App: React.FC = () => {
{categories.map((category) => (
-
-

{category.name}

+
+

{category.name}

{isEditing && ( )}
-
+
{category.websites.map((website) => ( { isEditing={isEditing} onEdit={setEditingWebsite} onMove={handleMoveWebsite} - className={getTileSizeClass(config.tileSize)} + tileSize={config.tileSize} /> ))} {isEditing && ( diff --git a/components/ConfigurationModal.tsx b/components/ConfigurationModal.tsx index 97a9a83..a4fcbcb 100644 --- a/components/ConfigurationModal.tsx +++ b/components/ConfigurationModal.tsx @@ -20,6 +20,7 @@ const ConfigurationModal: React.FC = ({ onClose, onSave subtitleSize: currentConfig.subtitleSize || 'medium', alignment: currentConfig.alignment || 'middle', tileSize: currentConfig.tileSize || 'medium', + horizontalAlignment: currentConfig.horizontalAlignment || 'middle', wallpaperBlur: currentConfig.wallpaperBlur || 0, wallpaperBrightness: currentConfig.wallpaperBrightness || 100, wallpaperOpacity: currentConfig.wallpaperOpacity || 100, @@ -328,6 +329,19 @@ const ConfigurationModal: React.FC = ({ onClose, onSave ]} />
+
+ + +
)} diff --git a/components/WebsiteTile.tsx b/components/WebsiteTile.tsx index 82e9c27..e90966c 100755 --- a/components/WebsiteTile.tsx +++ b/components/WebsiteTile.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Website } from '../types'; import { icons, ArrowLeft, ArrowRight, Pencil } from 'lucide-react'; @@ -7,30 +7,85 @@ interface WebsiteTileProps { isEditing: boolean; onEdit: (website: Website) => void; onMove: (website: Website, direction: 'left' | 'right') => void; - className?: string; + tileSize?: string; } -const WebsiteTile: React.FC = ({ website, isEditing, onEdit, onMove, className }) => { +const getTileSizeClass = (size: string | undefined) => { + switch (size) { + case 'small': + return 'w-28 h-28'; + case 'medium': + return 'w-32 h-32'; + case 'large': + return 'w-36 h-36'; + default: + return 'w-32 h-32'; + } +}; + +const getIconSize = (size: string | undefined) => { + switch (size) { + case 'small': + return 8; + case 'medium': + return 10; + case 'large': + return 12; + default: + return 10; + } +} + +const WebsiteTile: React.FC = ({ website, isEditing, onEdit, onMove, tileSize }) => { const LucideIcon = icons[website.icon as keyof typeof icons]; + const [isLoading, setIsLoading] = useState(false); + + const handleClick = (e: React.MouseEvent) => { + if (isEditing) { + e.preventDefault(); + return; + } + setIsLoading(true); + + // Simulate loading time (dev purpose) + // e.preventDefault(); + // setTimeout(() => { + // setIsLoading(false); + // }, 3500); // Small delay to show spinner before navigation + }; + + const iconSizeClass = `w-${getIconSize(tileSize)} h-${getIconSize(tileSize)}`; + const iconSizeLoadingClass = `w-${getIconSize(tileSize) - 4} h-${getIconSize(tileSize) - 4}`; return ( -