Convert backends to Firebase and combine projects
This commit is contained in:
70
RIT-EVENT-MANAGEMENT--main/components/DomainSelection.tsx
Normal file
70
RIT-EVENT-MANAGEMENT--main/components/DomainSelection.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { supabase } from '../supabase';
|
||||
|
||||
interface DomainSelectionProps {
|
||||
category: string;
|
||||
onSelectDomain: (domainId: string, domainName?: string) => void;
|
||||
onBack: () => void;
|
||||
}
|
||||
|
||||
const DomainSelection: React.FC<DomainSelectionProps> = ({ category, onSelectDomain, onBack }) => {
|
||||
const [domains, setDomains] = useState<any[]>([]);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchDomains = async () => {
|
||||
const { data } = await supabase.from('domains').select('*').eq('status', 'APPROVED').eq('category', category);
|
||||
if (data) {
|
||||
setDomains(data.sort((a: any, b: any) => a.name.localeCompare(b.name)));
|
||||
}
|
||||
};
|
||||
fetchDomains();
|
||||
}, [category]);
|
||||
|
||||
return (
|
||||
<section className="pt-40 pb-12 px-6 md:px-12 lg:px-24 bg-white animate-in fade-in slide-in-from-right-4 duration-500">
|
||||
<button
|
||||
onClick={onBack}
|
||||
className="flex items-center gap-2 text-[#f97316] font-black uppercase tracking-widest mb-10 group hover:translate-x-[-5px] transition-transform"
|
||||
>
|
||||
<i className="fas fa-arrow-left"></i>
|
||||
BACK TO CATEGORIES
|
||||
</button>
|
||||
|
||||
<h2 className="text-3xl md:text-4xl font-black text-center text-[#1A202C] mb-12 tracking-tighter uppercase">
|
||||
CHOOSE YOUR <span className="text-[#f97316]">DOMAIN</span>
|
||||
</h2>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-3 gap-8">
|
||||
{domains.map((domain) => (
|
||||
<div
|
||||
key={domain.id}
|
||||
onClick={() => onSelectDomain(domain.name, domain.name)}
|
||||
className="group relative h-[350px] rounded-[2rem] overflow-hidden cursor-pointer shadow-[0_10px_30px_rgba(0,0,0,0.1)] transition-all duration-500 hover:-translate-y-2 hover:shadow-2xl"
|
||||
>
|
||||
<img
|
||||
src={domain.image}
|
||||
alt={domain.name}
|
||||
className="w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110"
|
||||
/>
|
||||
<div className="absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent opacity-90"></div>
|
||||
|
||||
<div className="absolute bottom-8 left-8 right-8 flex flex-col items-start">
|
||||
<span className="bg-[#f97316] text-[10px] font-black text-white px-3 py-1 rounded-full uppercase tracking-[0.2em] mb-3">
|
||||
Domain
|
||||
</span>
|
||||
<h3 className="text-2xl font-black text-white tracking-tight transform transition-transform duration-500 group-hover:translate-x-2">
|
||||
{domain.name}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div className="absolute top-6 right-6 w-10 h-10 bg-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity border border-gray-200">
|
||||
<i className="fas fa-chevron-right text-gray-800 text-xs"></i>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default DomainSelection;
|
||||
Reference in New Issue
Block a user