Raul3418's picture
import React, { useState } from "react"; export default function AustraliaSite() { const [isOwner, setIsOwner] = useState(false); const [editing, setEditing] = useState(false); const [language, setLanguage] = useState("pt"); const [section, setSection] = useState("home"); const content = { pt: { home: { title: "Bem-vindo à Austrália", text: "Informações confiáveis sobre turismo, cultura, vistos, geografia e animais.", youtube: "https://youtube.com/seucanal", facebook: "https://facebook.com/seuperfil", instagram: "https://instagram.com/seuperfil", }, turismo: { title: "Turismo", text: "Explore Sydney Opera House, Grande Barreira de Corais, Uluru e praias famosas.", images: [ { src: "https://upload.wikimedia.org/wikipedia/commons/4/40/Sydney_Opera_House_Sails.jpg", alt: "Sydney Opera House" }, { src: "https://upload.wikimedia.org/wikipedia/commons/2/2b/Great_Barrier_Reef_1.jpg", alt: "Grande Barreira de Corais" }, ], }, alugueis: { title: "Preços de Aluguéis", table: [ { city: "Sydney", price: "R$ 2.500" }, { city: "Melbourne", price: "R$ 2.000" }, { city: "Adelaide", price: "R$ 1.500" }, ], }, vistos: { title: "Tipos de Vistos", text: "Turismo, estudo, trabalho e residência. Consulte sites oficiais." }, historia: { title: "História", text: "Povos aborígenes e colonização britânica." }, cultura: { title: "Cultura", text: "Mistura de tradições aborígenes, influência britânica e imigração multicultural.", images: [{ src: "https://upload.wikimedia.org/wikipedia/commons/f/fd/Aboriginal_Culture.jpg", alt: "Cultura Aborígene" }], }, geografia: { title: "Geografia e Clima", text: "Desertos, florestas tropicais, regiões temperadas e praias paradisíacas.", images: [{ src: "https://upload.wikimedia.org/wikipedia/commons/2/2b/Great_Barrier_Reef_1.jpg", alt: "Grande Barreira de Corais" }], }, animais: { title: "Animais", text: "Cangurus, coalas, ornitorrincos e demônios-da-tasmânia.", images: [{ src: "https://upload.wikimedia.org/wikipedia/commons/0/0c/Kangaroo_Australia_01_11_2008_-_retouch.JPG", alt: "Canguru" }], }, }, en: { home: { title: "Welcome to Australia", text: "Reliable info on tourism, culture, visas, geography and animals.", youtube: "https://youtube.com/seucanal", facebook: "https://facebook.com/seuperfil", instagram: "https://instagram.com/seuperfil", }, turismo: { title: "Tourism", text: "Explore Sydney Opera House, Great Barrier Reef, Uluru and famous beaches.", images: [ { src: "https://upload.wikimedia.org/wikipedia/commons/4/40/Sydney_Opera_House_Sails.jpg", alt: "Sydney Opera House" }, { src: "https://upload.wikimedia.org/wikipedia/commons/2/2b/Great_Barrier_Reef_1.jpg", alt: "Great Barrier Reef" }, ], }, alugueis: { title: "Rental Prices", table: [ { city: "Sydney", price: "$2,500" }, { city: "Melbourne", price: "$2,000" }, { city: "Adelaide", price: "$1,500" }, ], }, vistos: { title: "Visa Types", text: "Tourist, study, work and residence visas. Check official sites." }, historia: { title: "History", text: "Aboriginal peoples and British colonization." }, cultura: { title: "Culture", text: "Mix of Aboriginal traditions, British influence and multicultural immigration.", images: [{ src: "https://upload.wikimedia.org/wikipedia/commons/f/fd/Aboriginal_Culture.jpg", alt: "Aboriginal Culture" }], }, geografia: { title: "Geography & Climate", text: "Deserts, rainforests, temperate regions and paradisiacal beaches.", images: [{ src: "https://upload.wikimedia.org/wikipedia/commons/2/2b/Great_Barrier_Reef_1.jpg", alt: "Great Barrier Reef" }], }, animais: { title: "Animals", text: "Kangaroos, koalas, platypuses and Tasmanian devils.", images: [{ src: "https://upload.wikimedia.org/wikipedia/commons/0/0c/Kangaroo_Australia_01_11_2008_-_retouch.JPG", alt: "Kangaroo" }], }, }, // Adicione aqui 'es' e 'it' seguindo o mesmo padrão }; const handleLogin = () => { const user = prompt("Usuário:"); const pass = prompt("Senha:"); if (user === "LeofromRioAustralia" && pass === "BrasucanaAustralia") { setIsOwner(true); alert("Login realizado!"); } else { alert("Credenciais incorretas."); } }; const handleEditChange = (sectionKey, field, value) => { content[language][sectionKey][field] = value; }; const currentContent = content[language]; return ( <div className="font-sans min-h-screen bg-blue-900 text-white"> {/* Header */} <header className="flex items-center justify-between p-4 bg-blue-800 shadow-lg"> <div className="flex gap-2"> {["au","br","es","it"].map(f => ( <img key={f} src={`https://flagcdn.com/w40/${f}.png`} alt={f} className="w-10 cursor-pointer" onClick={() => setLanguage(f === "au" ? "en" : f)} /> ))} </div> <nav className="flex gap-2 text-sm md:text-base"> {Object.keys(currentContent).map(k => k !== "home" && ( <button key={k} onClick={() => setSection(k)}>{currentContent[k].title}</button> ))} </nav> {!isOwner ? ( <button onClick={handleLogin} className="bg-red-600 px-3 py-1 rounded hover:bg-red-700">Login do Dono</button> ) : ( <button onClick={() => setEditing(!editing)} className="bg-green-600 px-3 py-1 rounded hover:bg-green-700"> {editing ? "Parar Edição" : "Editar"} </button> )} </header> {/* Main Content */} <main className="p-6 space-y-6"> {editing && currentContent[section].text && ( <textarea value={currentContent[section].text} onChange={e => handleEditChange(section, "text", e.target.value)} className="w-full p-2 rounded text-black" /> )} {!editing && ( <div> <h2 className="text-xl font-bold mb-2">{currentContent[section].title}</h2> <p>{currentContent[section].text}</p> {currentContent[section].images?.map((img,i) => ( <img key={i} src={img.src} alt={img.alt} className="w-full rounded-xl mt-2"/> ))} {currentContent[section].table && ( <table className="w-full border mt-2 bg-white text-black rounded"> <thead> <tr>{Object.keys(currentContent[section].table[0]).map((h,i) => <th key={i} className="border p-2">{h}</th>)}</tr> </thead> <tbody> {currentContent[section].table.map((row,i) => ( <tr key={i}>{Object.values(row).map((v,j)=><td key={j} className="border p-2">{v}</td>)}</tr> ))} </tbody> </table> )} {section === "home" && ( <div className="flex gap-4 mt-4"> <a href={currentContent.home.youtube} target="_blank" className="underline">YouTube</a> <a href={currentContent.home.facebook} target="_blank" className="underline">Facebook</a> <a href={currentContent.home.instagram} target="_blank" className="underline">Instagram</a> </div> )} </div> )} </main> {/* Footer */} <footer className="bg-blue-800 text-center p-4 mt-6"> <p>Informações de fontes confiáveis: Tourism Australia, Australian Bureau of Statistics, Bureau of Meteorology.</p> </footer> </div> ); } - Initial Deployment
3815563 verified
|
Raw History Blame Contribute Delete
229 Bytes
---
title: https-leovovivendonaaustralia
emoji: 🐳
colorFrom: pink
colorTo: pink
sdk: static
pinned: false
tags:
- deepsite
---
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference