Berikut adalah implementasi website sederhana sesuai permintaan Anda menggunakan React dan CSS dengan fitur utama:
- Header dengan ikon simbolis Brad Pitt (silhouette, pose R&B) di sidebar
- Tema warna hitam metalik, ungu tua, dan emas
- Halaman utama berisi piringan hitam vinyl animasi yang berputar saat lagu diputar
- Embed player SoundCloud di bawah piringan hitam
- Lirik lagu scroll vertikal dengan highlight emas pada baris aktif
- Panel admin sederhana untuk input SoundCloud embed URL dan lirik lagu
- Tampilan responsif, smooth transitions, hover efek pada piringan hitam
- Jika cover art tidak ada, tampilkan siluet Brad Pitt default dengan gradien ungu-emas
Cara pakai
- Paste seluruh file ke proyek React (mis.
create-react-app).
- Jalankan
npm start.
- Akses panel admin lewat tombol "Admin" di header untuk menambah lagu.
- Pilih lagu dari playlist untuk melihat efek main dan lirik.
Source Code Lengkap
// App.js
import React, { useState, useEffect, useRef } from "react";
const colors = {
blackMetallic: "#121212",
darkPurple: "#2e004f",
gold: "#d4af37",
};
const defaultSilhouette = `data:image/svg+xml;utf8,
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">
<defs>
<linearGradient id="grad" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="%23d4af37"/>
<stop offset="100%" stop-color="%232e004f"/>
</linearGradient>
</defs>
<circle cx="100" cy="100" r="90" fill="url(%23grad)" />
<text x="50%" y="50%" fill="%23000000" font-family="Georgia, serif" font-size="40" font-weight="bold" text-anchor="middle" dy=".3em">
BP
</text>
</svg>`;
function Header({ onToggleAdmin }) {
return (
<header
style={{
height: "80px",
background: `linear-gradient(90deg, ${colors.darkPurple} 0%, ${colors.blackMetallic} 100%)`,
color: colors.gold,
display: "flex",
alignItems: "center",
padding: "0 20px",
fontFamily: "'Playfair Display', serif",
boxShadow: `0 2px 10px ${colors.gold}88`,
position: "fixed",
top: 0,
width: "100%",
zIndex: 100,
}}
>
<div style={{ fontSize: "1.8rem", fontWeight: "700", flexGrow: 1 }}>
Unreleased R&B
</div>
<button
onClick={onToggleAdmin}
style={{
background: "transparent",
border: `1.5px solid ${colors.gold}`,
borderRadius: "5px",
color: colors.gold,
fontSize: "1rem",
cursor: "pointer",
padding: "6px 14px",
fontFamily: "'Roboto', sans-serif",
transition: "background-color 0.3s ease",
}}
onMouseEnter={(e) =>
(e.currentTarget.style.backgroundColor = colors.gold)
}
onMouseLeave={(e) => (e.currentTarget.style.backgroundColor = "transparent")}
>
Admin
</button>
</header>
);
}
function Sidebar({ selectedSong, onSelect }) {
// Simulate silhouette Brad Pitt pose with svg (simple)
// For estathetic, black/purple/gold blend + microphone silhouette shape
return (
<aside
style={{
background: colors.blackMetallic,
width: "180px",
color: colors.gold,
fontFamily: "'Roboto', sans-serif",
display: "flex",
flexDirection: "column",
alignItems: "center",
padding: "20px 10px",
borderRight: `2px solid ${colors.gold}`,
boxShadow: `2px 0 10px ${colors.gold}88`,
position: "fixed",
top: "80px",
bottom: 0,
overflowY: "auto",
}}
>
{/* Brad Pitt symbolic silhouette */}
<div
style={{
marginBottom: 24,
width: 140,
height: 140,
background:
`radial-gradient(circle at center, ${colors.gold}66, ${colors.darkPurple}cc)`,
borderRadius: "50%",
position: "relative",
boxShadow: `0 0 20px ${colors.gold}99`,
display: "flex",
alignItems: "center",
justifyContent: "center",
filter: "drop-shadow(0 0 4px gold)",
}}
title="Brad Pitt Symbolic Silhouette"
>
<svg
width="80"
height="80"
viewBox="0 0 64 64"
fill="none"
xmlns="http://www.w3.org/2000/svg"
style={{ filter: "drop-shadow(0 0 1.5px gold)" }}
>
{/* Silhouette: simplified man with mic pose */}
<circle cx="32" cy="18" r="10" fill={colors.gold} />
<rect
x="28"
y="28"
width="8"
height="20"
rx="3"
fill={colors.darkPurple}
stroke={colors.gold}
strokeWidth="1.5"
/>
<line
x1="20"
y1="30"
x2="44"
y2="30"
stroke={colors.gold}
strokeWidth="2"
strokeLinecap="round"
/>
<rect
x="30"
y="22"
width="4"
height="6"
fill={colors.blackMetallic}
stroke={colors.gold}
strokeWidth="1"
rx="1"
/>
</svg>
</div>
<h2 style={{ marginBottom: "1rem", fontFamily: "'Playfair Display', serif" }}>
Songs
</h2>
{selectedSong.list.map((song, i) => (
<button
key={i}
onClick={() => onSelect(i)}
style={{
background:
selectedSong.currentIndex === i ? colors.gold : "transparent",
color:
selectedSong.currentIndex === i ? colors.blackMetallic : colors.gold,
padding: "8px 14px",
borderRadius: "6px",
cursor: "pointer",
textAlign: "left",
width: "100%",
marginBottom: "8px",
border: `1.5px solid ${colors.gold}`,
fontWeight: "600",
fontSize: "0.9rem",
transition: "all 0.3s ease",
fontFamily: "'Roboto', sans-serif",
}}
onMouseEnter={(e) => {
if (selectedSong.currentIndex !== i)
(e.currentTarget.style.backgroundColor = colors.gold + "44");
}}
onMouseLeave={(e) => {
if (selectedSong.currentIndex !== i) e.currentTarget.style.backgroundColor = "transparent";
}}
>
{song.title}
</button>
))}
</aside>
);
}
function VinylDisc({
coverArt,
isPlaying,
onClick,
tempo = 1,
altText = "Vinyl record",
}) {
// Put gold lines and dynamic shadows with CSS animation
//
// Animation speed depends on isPlaying and tempo
// If not playing stop spinning
const animationDuration = tempo > 0 ? 20 / tempo : 20;
return (
<div
onClick={onClick}
title="Vinyl Disc - Click to Play/Pause"
style={{
width: 280,
height: 280,
borderRadius: "50%",
backgroundColor: colors.blackMetallic,
boxShadow: `inset 0 0 20px ${colors.gold}88, 0 0 20px ${colors.gold}aa`,
display: "flex",
alignItems: "center",
justifyContent: "center",
cursor: "pointer",
position: "relative",
transition: "box-shadow 0.3s ease",
}}
className={isPlaying ? "spinning" : ""}
>
{/* vinyl details: concentric gold lines */}
<svg
viewBox="0 0 280 280"
width="280"
height="280"
style={{
borderRadius: "50%",
position: "absolute",
top: 0,
left: 0,
zIndex: 1,
pointerEvents: "none",
}}
>
{[...Array(8)].map((_, i) => {
const r = 140 - i * 12;
return (
<circle
key={i}
cx="140"
cy="140"
r={r}
stroke={colors.gold}
strokeWidth={i % 2 === 0 ? 2 : 1}
fill="none"
style={{
opacity: 0.25 + (i * 0.1),
filter: `drop-shadow(0 0 ${(i + 1) * 0.5}px ${colors.gold})`,
}}
/>
);
})}
</svg>
{/* Cover Art or Default silhouette */}
<img
src={coverArt}
alt={altText}
style={{
width: 160,
height: 160,
borderRadius: "50%",
boxShadow: `0 0 15px ${colors.gold}`,
objectFit: "cover",
zIndex: 2,
position: "relative",
userSelect: "none",
pointerEvents: "none",
}}
draggable={false}
/>
{/* Inner circle to simulate label */}
<div
style={{
position: "absolute",
width: 48,
height: 48,
borderRadius: "50%",
background: colors.darkPurple,
top: "50%",
left: "50%",
marginLeft: -24,
marginTop: -24,
boxShadow: `0 0 8px ${colors.gold}80 inset`,
zIndex: 3,
pointerEvents: "none",
}}
></div>
<style>
{`
@keyframes spin {
0% { transform: rotate(0deg);}
100% { transform: rotate(360deg);}
}
.spinning {
animation: spin ${animationDuration}s linear infinite;
}
.spinning:hover {
filter: drop-shadow(0 0 8px ${colors.gold});
}
div:hover {
box-shadow: inset 0 0 28px ${colors.gold}cc, 0 0 30px ${colors.gold}ee;
}
`}
</style>
</div>
);
}
function Lyrics({ lyrics, currentLine }) {
// lyrics: string[], currentLine: index of line active
// scroll vertically, highlight golden on active line
const containerRef = useRef(null);
useEffect(() => {
if (!containerRef.current) return;
const activeLine = containerRef.current.querySelector(
`.line${currentLine}`
);
if (activeLine) {
const top = activeLine.offsetTop;
const height = containerRef.current.clientHeight;
containerRef.current.scrollTo({
top: top - height / 3,
behavior: "smooth",
});
}
}, [currentLine]);
return (
<div
ref={containerRef}
style={{
overflowY: "auto",
maxHeight: "280px",
width: "320px",
fontFamily: "'Roboto', sans-serif",
color: colors.gold,
fontSize: "1.05rem",
lineHeight: "1.65rem",
borderLeft: `3px solid ${colors.gold}`,
paddingLeft: "15px",
userSelect: "none",
backgroundColor: colors.darkPurple + "bb",
borderRadius: "8px",
}}
>
{lyrics.map((line, i) => (
<p
key={i}
className={`line${i}`}
style={{
margin: "6px 0",
color: i === currentLine ? colors.gold : colors.gold + "bb",
fontWeight: i === currentLine ? "700" : "400",
background:
i === currentLine
? `linear-gradient(90deg, ${colors.gold}33, ${colors.gold}aa)`
: "transparent",
borderRadius: "4px",
transition: "all 0.3s ease",
padding: "2px 6px",
}}
>
{line || "\u00A0"}
</p>
))}
</div>
);
}
function SoundCloudPlayer({ embedUrl, playing, onPlayPause }) {
// SoundCloud embed player iframe
// Controlling SoundCloud iframe programmatically for play/pause is tricky and may require SoundCloud JS SDK.
// Here, we'll implement basic iframe embed with play/pause button below.
// To simplify, we sync playing state with click on vinyl disc,
// and embed iframe with play/pause is handled by user.
return (
<div
style={{
marginTop: "20px",
width: "328px",
aspectRatio: "16 / 9",
borderRadius: "12px",
overflow: "hidden",
boxShadow: `0 0 20px ${colors.gold}aa`,
}}
>
<iframe
title="SoundCloud Player"
width="100%"
height="100%"
scrolling="no"
frameBorder="no"
allow="autoplay"
src={embedUrl}
></iframe>
</div>
);
}
function AdminPanel({ onClose, onAddSong }) {
const [embedUrl, setEmbedUrl] = useState("");
const [lyricsText, setLyricsText] = useState("");
const [title, setTitle] = useState("");
function handleSubmit(e) {
e.preventDefault();
if (!embedUrl.trim() || !lyricsText.trim() || !title.trim()) {
alert("Please fill all fields");
return;
}
// Basic validation embed url contains "soundcloud"
if (!embedUrl.includes("soundcloud")) {
alert("Embed URL must be from SoundCloud");
return;
}
onAddSong({
embedUrl: embedUrl.trim(),
lyrics: lyricsText.trim().split("\n").map((s) => s.trim()),
title: title.trim(),
});
setEmbedUrl("");
setLyricsText("");
setTitle("");
onClose();
}
return (
<div
style={{
position: "fixed",
top: 80,
left: 180,
right: 0,
bottom: 0,
backgroundColor: colors.blackMetallic + "ee",
zIndex: 200,
display: "flex",
justifyContent: "center",
alignItems: "start",
paddingTop: "40px",
}}
onClick={(e) => {
if (e.target === e.currentTarget) onClose();
}}
aria-modal="true"
role="dialog"
>
<form
onSubmit={handleSubmit}
style={{
backgroundColor: colors.darkPurple,
padding: "24px 32px",
borderRadius: "12px",
width: "400px",
boxShadow: `0 0 20px ${colors.gold}dd`,
color: colors.gold,
fontFamily: "'Roboto', sans-serif",
display: "flex",
flexDirection: "column",
}}
>
<h2 style={{ marginBottom: "1.5rem", fontFamily: "'Playfair Display', serif" }}>
Admin Panel - Add Song
</h2>
<label style={{ marginBottom: 8 }}>
Song Title (for playlist)
<input
type="text"
value={title}
onChange={(e) => setTitle(e.target.value)}
style={{
marginTop: 4,
width: "100%",
borderRadius: 6,
backgroundColor: colors.blackMetallic,
color: colors.gold,
border: `1.5px solid ${colors.gold}`,
padding: "8px",
fontFamily: "'Roboto', sans-serif",
fontSize: "1rem",
}}
required
/>
</label>
<label style={{ marginBottom: 8 }}>
SoundCloud Embed URL
<input
type="url"
value={embedUrl}
onChange={(e) => setEmbedUrl(e.target.value)}
placeholder="https://w.soundcloud.com/player/?url=..."
style={{
marginTop: 4,
width: "100%",
borderRadius: 6,
backgroundColor: colors.blackMetallic,
color: colors.gold,
border: `1.5px solid ${colors.gold}`,
padding: "8px",
fontFamily: "'Roboto', sans-serif",
fontSize: "1rem",
}}
required
/>
</label>
<label style={{ marginBottom: 16 }}>
Lyrics (separate lines with new line)
<textarea
value={lyricsText}
onChange={(e) => setLyricsText(e.target.value)}
rows={8}
placeholder="Enter lyrics here..."
style={{
marginTop: 4,
width: "100%",
borderRadius: 6,
backgroundColor: colors.blackMetallic,
color: colors.gold,
border: `1.5px solid ${colors.gold}`,
padding: "8px",
fontFamily: "'Roboto', sans-serif",
fontSize: "1rem",
resize: "vertical",
}}
required
/>
</label>
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
}}
>
<button
type="submit"
style={{
backgroundColor: colors.gold,
border: "none",
borderRadius: 6,
color: colors.blackMetallic,
padding: "10px 20px",
fontWeight: "700",
fontSize: "1rem",
cursor: "pointer",
fontFamily: "'Roboto', sans-serif",
boxShadow: `0 0 10px ${colors.gold}aa`,
transition: "background-color 0.3s ease",
}}
onMouseEnter={(e) =>
(e.currentTarget.style.backgroundColor = "#b49023")
}
onMouseLeave={(e) => (e.currentTarget.style.backgroundColor = colors.gold)}
>
Add Song
</button>
<button
type="button"
onClick={onClose}
style={{
backgroundColor: "transparent",
border: `1.5px solid ${colors.gold}`,
borderRadius: 6,
color: colors.gold,
padding: "10px 20px",
cursor: "pointer",
fontFamily: "'Roboto', sans-serif",
fontSize: "1rem",
transition: "background-color 0.3s ease",
}}
onMouseEnter={(e) =>
(e.currentTarget.style.backgroundColor = colors.gold + "44")
}
onMouseLeave={(e) => (e.currentTarget.style.backgroundColor = "transparent")}
>
Cancel
</button>
</div>
</form>
</div>
);
}
function App() {
// State songs: {embedUrl, lyrics, title}[]
const [songs, setSongs] = useState(() => {
// Load from localStorage or empty array
const saved = localStorage.getItem("unreleasedRB_songs");
if (saved) {
try {
return JSON.parse(saved);
} catch {
return [];
}
}
return [];
});
const [currentIndex, setCurrentIndex] = useState(0);
const [isPlaying, setIsPlaying] = useState(false);
const [currentLine, setCurrentLine] = useState(0);
const [showAdmin, setShowAdmin] = useState(false);
const [coverArt, setCoverArt] = useState(defaultSilhouette);
const lyricsContainerRef = useRef(null);
// Parse cover art from SoundCloud embed URL or fallback
useEffect(() => {
if (songs.length === 0) {
setCoverArt(defaultSilhouette);
setCurrentLine(0);
setIsPlaying(false);
return;
}
// Extract track url from embedUrl query param "url"
const embedUrl = songs[currentIndex].embedUrl;
try {
const urlParams = new URLSearchParams(embedUrl.split("?")[1]);
const trackUrl = urlParams.get("url");
if (!trackUrl) {
setCoverArt(defaultSilhouette);
return;
}
// To get cover art, use SoundCloud public api or oEmbed endpoint.
//
// As SoundCloud APIs often require authentication, we can fake with oEmbed jsonp or no backend:
// Here, use `https://soundcloud.com/oembed?format=json&url=${trackUrl}` for cover art.
fetch(
`https://soundcloud.com/oembed?format=json&url=${encodeURIComponent(
trackUrl
)}`
)
.then((res) => res.json())
.then((data) => {
// oEmbed returns thumbnail_url
if (data.thumbnail_url) {
setCoverArt(data.thumbnail_url);
} else {
setCoverArt(defaultSilhouette);
}
setCurrentLine(0);
})
.catch(() => {
setCoverArt(defaultSilhouette);
setCurrentLine(0);
});
} catch {
setCoverArt(defaultSilhouette);
setCurrentLine(0);
}
setIsPlaying(false);
}, [currentIndex, songs]);
// Lyrics auto scroll line by line every ~4s when playing
useEffect(() => {
if (!isPlaying || songs.length === 0) return;
let interval = setInterval(() => {
setCurrentLine((line) => {
if (line + 1 >= songs[currentIndex].lyrics.length) {
setIsPlaying(false);
return line; // stop at end
}
return line + 1;
});
}, 4000);
return () => clearInterval(interval);
}, [isPlaying, currentIndex, songs]);
function handleAddSong(song) {
setSongs((prev) => {
const newSongs = [...prev, song];
localStorage.setItem("unreleasedRB_songs", JSON.stringify(newSongs));
return newSongs;
});
setCurrentIndex(songs.length); // new song index
setCurrentLine(0);
setIsPlaying(false);
}
function handleVinylClick() {
// toggle play/pause
if (songs.length === 0) return;
setIsPlaying((p) => !p);
}
return (
<>
<Header onToggleAdmin={() => setShowAdmin((v) => !v)} />
<Sidebar
selectedSong={{ list: songs, currentIndex }}
onSelect={(i) => {
setCurrentIndex(i);
setCurrentLine(0);
setIsPlaying(false);
}}
/>
<main
style={{
marginLeft: 180,
paddingTop: 100,
minHeight: "100vh",
background: `linear-gradient(135deg, ${colors.blackMetallic}, ${colors.darkPurple})`,
display: "flex",
justifyContent: "center",
alignItems: "start",
gap: 48,
paddingLeft: 40,
paddingRight: 40,
flexWrap: "wrap",
}}
>
{songs.length === 0 ? (
<div
style={{
fontFamily: "'Playfair Display', serif",
fontSize: "2rem",
color: colors.gold,
marginTop: "6rem",
maxWidth: "600px",
textAlign: "center",
userSelect: "none",
}}
>
Welcome. Please add unreleased R&B songs using the Admin panel.
</div>
) : (
<>
<div style={{ userSelect: "none" }}>
<VinylDisc
coverArt={coverArt}
isPlaying={isPlaying}
onClick={handleVinylClick}
altText={`Cover art - ${songs[currentIndex].title}`}
/>
<SoundCloudPlayer
embedUrl={songs[currentIndex].embedUrl}
playing={isPlaying}
onPlayPause={setIsPlaying}
/>
</div>
<Lyrics
lyrics={songs[currentIndex].lyrics}
currentLine={currentLine}
/>
</>
)}
</main>
{showAdmin && (
<AdminPanel onClose={() => setShowAdmin(false)} onAddSong={handleAddSong} />
)}
</>
);
}
export default App;
Penjelasan Fitur Tambahan dan Catatan
- Brad Pitt silhouette dibuat berupa icon SVG sederhana di sidebar agar tidak terlalu dominan.
- Piringan Hitam berupa lingkaran dengan concentric gold lines animasi CSS.
- Spin Speed: dibuat tetap, bisa di-adjust dengan properti tempo tapi default dipakai.
- SoundCloud Player di-embed langsung iframe SoundCloud. Kontrol play/pause via vinyl disc klik hanya toggle state UI.
- Lirik auto scroll menyorot baris aktif dengan background dan highlight emas.
- Admin Panel isi form judul lagu + SoundCloud embed URL + lirik (text area, pisah baris).
- Penyimpanan lagu dalam localStorage untuk persistensi data sederhana.
- Responsif minimal, menggunakan flex-wrap pada main untuk mobile.
- Font untuk judul menggunakan 'Playfair Display' (import bisa Anda tambahkan di index.html), untuk lirik dan UI pakai 'Roboto' sans-serif.
- Anda bisa menambahkan import Google Fonts berikut di
public/index.html head section:
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700&family=Roboto&display=swap" rel="stylesheet" />
Selamat mencoba, silakan ditingkatkan atau dikembangkan lagi sesuai kebutuhan! Jika Anda ingin saya buatkan versi HTML+JS murni tanpa React juga bisa.