-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
135 lines (124 loc) · 3.98 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import React, { useState, useRef } from 'react';
const LyricsCardMaker = () => {
const [title, setTitle] = useState('');
const [artist, setArtist] = useState('');
const [lyrics, setLyrics] = useState('');
const [bgColor, setBgColor] = useState('#ffffff');
const [textColor, setTextColor] = useState('#000000');
const [fontSize, setFontSize] = useState(16);
const cardRef = useRef(null);
const exportCard = () => {
if (!cardRef.current) return;
// TODO: Implement image export
console.log('Export card as image');
};
return (
<div className="flex flex-col gap-4 w-full max-w-2xl mx-auto p-4">
{/* Controls */}
<div className="flex flex-col gap-4 bg-white p-4 rounded shadow">
<h2 className="text-xl font-bold">Card Settings</h2>
<div className="flex gap-4">
<input
type="text"
value={title}
onChange={(e) => setTitle(e.target.value)}
placeholder="Song Title"
className="flex-1 p-2 border rounded"
/>
<input
type="text"
value={artist}
onChange={(e) => setArtist(e.target.value)}
placeholder="Artist Name"
className="flex-1 p-2 border rounded"
/>
</div>
<textarea
value={lyrics}
onChange={(e) => setLyrics(e.target.value)}
placeholder="Enter lyrics here..."
className="w-full p-2 border rounded h-32"
/>
<div className="grid grid-cols-3 gap-4">
<div>
<label className="block text-sm mb-1">Background</label>
<input
type="color"
value={bgColor}
onChange={(e) => setBgColor(e.target.value)}
className="w-full h-8"
/>
</div>
<div>
<label className="block text-sm mb-1">Text Color</label>
<input
type="color"
value={textColor}
onChange={(e) => setTextColor(e.target.value)}
className="w-full h-8"
/>
</div>
<div>
<label className="block text-sm mb-1">Font Size</label>
<input
type="number"
value={fontSize}
onChange={(e) => setFontSize(Number(e.target.value))}
min={12}
max={32}
className="w-full p-2 border rounded"
/>
</div>
</div>
<button
onClick={exportCard}
className="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600 transition-colors"
>
Export as Image
</button>
</div>
{/* Preview Card */}
<div
ref={cardRef}
className="bg-white rounded shadow-lg overflow-hidden"
style={{
backgroundColor: bgColor,
padding: '2rem',
minHeight: '400px'
}}
>
<h1
style={{
color: textColor,
fontSize: '2rem',
marginBottom: '0.5rem',
fontWeight: 'bold'
}}
>
{title || 'Untitled'}
</h1>
<h2
style={{
color: textColor,
fontSize: '1.25rem',
marginBottom: '2rem',
opacity: 0.8
}}
>
{artist || 'Unknown Artist'}
</h2>
<div
style={{
color: textColor,
fontSize: `${fontSize}px`,
whiteSpace: 'pre-wrap',
lineHeight: 1.6
}}
>
{lyrics || 'Your lyrics will appear here...'}
</div>
</div>
</div>
);
};
export default LyricsCardMaker;