Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions frontend/src/App.js

This file was deleted.

13 changes: 13 additions & 0 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Header } from "./components/home/header";
import { SoulTracker } from "./components/home/soul";

function App() {
return (
<section className="max-w-screen-xl w-full mx-auto">
<Header />
<SoulTracker />
</section>
);
}

export default App;
54 changes: 54 additions & 0 deletions frontend/src/components/home/header.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React, { useState } from "react"; // Don't forget to import React and useState

const tabArray = [
{
name: "Journal",
icon: "📝",
id: 1,
},
{
name: "Garden",
icon: "🌸", // Changed icon for variety
id: 2,
},
{
name: "Ritual",
icon: "✨", // Changed icon for variety
id: 3,
},
];

export const Header = () => {
const [activeTab, setActiveTab] = useState(tabArray[0].id); // Set initial active tab

return (
<header className="flex flex-col gap-y-3 mx-auto max-w-screen-sm my-4 text-center">
{/* logo */}
<div className="text-soul-green text-3xl font-extrabold tracking-wider drop-shadow-sm">
🍁 Ember
</div>
<h2 className="text-xl text-gray-700 font-sans">Your soul companion</h2>

{/* tab navigator */}
<div className="flex justify-center items-center gap-x-2 max-w-md border border-gray-200 rounded-full bg-white shadow-lg p-2 mx-auto">
{tabArray.map((tab) => (
<div
key={tab.id}
onClick={() => setActiveTab(tab.id)} // Set active tab on click
className={`
flex items-center gap-x-1.5 p-2 rounded-full cursor-pointer transition-all duration-600
${
activeTab === tab.id
? "bg-ember-moss text-white shadow-md"
: "hover:bg-gray-100 text-gray-700"
}
`}
>
<span className="text-lg">{tab.icon}</span>
<span className="text-sm font-medium">{tab.name}</span>
</div>
))}
</div>
</header>
);
};
29 changes: 29 additions & 0 deletions frontend/src/components/home/soul.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useState } from "react";

export const SoulTracker = () => {
const [percent, setPercent] = useState(65);

const progressBarColor =
percent > 75
? "bg-emerald-500"
: percent > 40
? "bg-yellow-500"
: "bg-red-500";

return (
<div className="bg-white shadow-xl rounded-2xl p-4 w-full max-w-screen-lg mx-auto">
<div className="flex items-center justify-between mb-3">
<h1 className="text-xl font-semibold text-serene-sage">
Soul Wellness
</h1>
<div className="text-2xl font-bold text-gray-800">{percent}%</div>
</div>
<div className="bg-gray-200 h-3 rounded-full overflow-hidden">
<div
className={`h-full rounded-full transition-all duration-500 ease-out ${progressBarColor}`}
style={{ width: `${percent}%` }}
></div>
</div>
</div>
);
};